I'm doing some model transformation with ETL and at the end I would like to add some notation elements from the GMF notation.ecore enabling me to open the resulting model in my editors.
During the transformation development I realized that the EPackageRegistryView is packed with other registered meta models and that the notation meta model is already listed there. So, I went ahead and added to my ant file the following:
However, I cannot access any types of gmfNotation (like Diagram) - I get a type-not-found-exception. To make sure that I set up everything correctly I also tried a similar ant file as provided in the epsilon blog:
<epsilon.eol>
new gmfNotation!Diagram;
<model ref="gmfNotation"/>
</epsilon.eol>
But without any success. What do I need to do to use the meta model in my transformation?
At the moment, you're loading the GMF notation metamodel itself. What
you need to do is to load a model that conforms to that metamodel instead.
Cheers,
Dimitris
On 03/11/2010 12:04, Henning wrote:
> Hello!
>
> I'm doing some model transformation with ETL and at the end I would like
> to add some notation elements from the GMF notation.ecore enabling me to
> open the resulting model in my editors. During the transformation
> development I realized that the EPackageRegistryView is packed with
> other registered meta models and that the notation meta model is already
> listed there. So, I went ahead and added to my ant file the following:
> <epsilon.emf.loadRegisteredMetamodel
> name="gmfNotation"
> metamodeluri="http://www.eclipse.org/gmf/runtime/1.0.2/notation"/>
>
>
> However, I cannot access any types of gmfNotation (like Diagram) - I get
> a type-not-found-exception. To make sure that I set up everything
> correctly I also tried a similar ant file as provided in the
> http://epsilonblog.wordpress.com/2009/05/24/new-in-epsilon-0 -8-5/:
>
> <epsilon.eol>
> new gmfNotation!Diagram;
> <model ref="gmfNotation"/>
> </epsilon.eol>
>
>
> But without any success. What do I need to do to use the meta model in
> my transformation?
>
> Thanks for your help,
>
> Henning
At the moment, you're loading the GMF notation metamodel itself.
This exactly what I want to do! Because I want to use the notation::Diagram type in my target model.
My setup is like that: I use a source model (compliant to a Source meta model) to transform it to a target model (compliant to Target meta model). In order to use my GMF editors to edit models compliant to the target meta model I need the Notation:Diagram element.
Another way to put it is: I need to have two models (each is conform to a different meta model) but to be serialized in one (XMI) file.
Henning wrote:
> Quote:
>> At the moment, you're loading the GMF notation metamodel itself.
>
> This exactly what I want to do! Because I want to use the
> notation::Diagram type in my target model.
Not quite I'm afraid. What you're doing with this is loading the
registered metamodel as an EMF Ecore model. Therefore, the metamodel
you're coding against in your EOL is Ecore (e.g. gmfNotation!EClass.all
should return all the classes in the registered notation metamodel).
>
> My setup is like that: I use a source model (compliant to a Source meta
> model) to transform it to a target model (compliant to Target meta
> model). In order to use my GMF editors to edit models compliant to the
> target meta model I need the Notation:Diagram element.
At the moment the EMF driver doesn't support multiple metamodelURIs per
model but what you can do is to create a 3rd metamodel which somehow
references the 2 metamodels (target and notation) (e.g. by containing 2
dummy classes which inherit from classes in the target and notation
metamodels), register it and then use its URI as the metamodelURI of
your combined target model.
>
> Another way to put it is: I need to have two models (each is conform to
> a different meta model) but to be serialized in one (XMI) file.
>
> How can I do that?
>
> Best regards,
>
> Henning
>
>
If none of these make sense, please let me know and I can come up with a
concrete example.
I have decided to solve the problem with Java. I will just do some post processing of my created model and simply append the needed notation:diagram element.
But still: Thanks for making clear what the EMF driver is capable of right now!