Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Instantiating an ecore metamodel
Instantiating an ecore metamodel [message #423666] Mon, 06 October 2008 11:46 Go to next message
Eclipse UserFriend
Originally posted by: mahdider.students.uni-mainz.de

Hello,

this is a beginner's question but I did not find a solution for it up to
now. I want to create models, which conform to a given metamodel,
described in ecore. I expected some way of "instantiating" an xy.ecore
metamodel, but I could not find such a solution within the eclipse
modeling distribution.

What is the recommended way to deal with custom metamodels and models?

The models will later be transformed via QVTO, where checks for
conformance can of course be done. Still, I wonder if there is some tool
support for creating models based on a given metamodel?

Kind Regards,
Mahdi D-Manesh
Re: Instantiating an ecore metamodel [message #423667 is a reply to message #423666] Mon, 06 October 2008 12:06 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33133
Registered: July 2009
Senior Member
Mahdi,

Comments below.

Mahdi D-Manesh wrote:
> Hello,
>
> this is a beginner's question but I did not find a solution for it up
> to now. I want to create models, which conform to a given metamodel,
> described in ecore. I expected some way of "instantiating" an xy.ecore
> metamodel, but I could not find such a solution within the eclipse
> modeling distribution.
I'm not sure how many meta levels we're cross in this question. If you
have Xyz.ecore there's be an XyzFactory and you's use
XyzFactory.eINSTANCE.createAbc where Abc is some EClass in Xyz.ecore.
Now Abc itself can be any type of model (with any number of metas in
front of it). So Abc might be XSDComplexTypeDefinition, i.e., it might
represent a <xsd:complexType> in an XML Schema. But we can't know in
EMF itself how an instance of a complex type should be created. We can
read and write XML Schemas and manipulate the metamodel, but deciding
how instances that conform to it should be created is something that
must be built and designed specifically for that meta model. Of course
for this specific example, what we've done is implement XSDEcoreBuilder
which provides mechanism for converting an XSD model instance to an
Ecore model instance; from that corresponding Ecore model, we can create
an instance that conforms to the Ecore model and hence indirectly we're
creating an instance that conforms to the XSD. This is one approach you
could consider.
>
> What is the recommended way to deal with custom metamodels and models?
>
> The models will later be transformed via QVTO, where checks for
> conformance can of course be done. Still, I wonder if there is some
> tool support for creating models based on a given metamodel?
Of course it might be that your question is really simple. You might
notice for example, that when you've opened a *.ecore with the Sample
Ecore Editor, you can right click on an EClass and invoke Create Dynamic
Instance... to create an instance that corresponds to your Ecore...
>
> Kind Regards,
> Mahdi D-Manesh


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Instantiating an ecore metamodel [message #423668 is a reply to message #423667] Mon, 06 October 2008 12:31 Go to previous message
Eclipse UserFriend
Originally posted by: mahdider.students.uni-mainz.de

Hi Ed,

actually it was really about the very simple case!

My issue was that I tried to find that menu from the *.ecore root and
not from an element like the package.

Thanks again for the fast response and for the detailed explanation.

Kind Regards,
Mahdi


Ed Merks schrieb:
> Mahdi,
>
> Comments below.
>
> Mahdi D-Manesh wrote:
>> Hello,
>>
>> this is a beginner's question but I did not find a solution for it up
>> to now. I want to create models, which conform to a given metamodel,
>> described in ecore. I expected some way of "instantiating" an xy.ecore
>> metamodel, but I could not find such a solution within the eclipse
>> modeling distribution.
> I'm not sure how many meta levels we're cross in this question. If you
> have Xyz.ecore there's be an XyzFactory and you's use
> XyzFactory.eINSTANCE.createAbc where Abc is some EClass in Xyz.ecore.
> Now Abc itself can be any type of model (with any number of metas in
> front of it). So Abc might be XSDComplexTypeDefinition, i.e., it might
> represent a <xsd:complexType> in an XML Schema. But we can't know in
> EMF itself how an instance of a complex type should be created. We can
> read and write XML Schemas and manipulate the metamodel, but deciding
> how instances that conform to it should be created is something that
> must be built and designed specifically for that meta model. Of course
> for this specific example, what we've done is implement XSDEcoreBuilder
> which provides mechanism for converting an XSD model instance to an
> Ecore model instance; from that corresponding Ecore model, we can create
> an instance that conforms to the Ecore model and hence indirectly we're
> creating an instance that conforms to the XSD. This is one approach you
> could consider.
>>
>> What is the recommended way to deal with custom metamodels and models?
>>
>> The models will later be transformed via QVTO, where checks for
>> conformance can of course be done. Still, I wonder if there is some
>> tool support for creating models based on a given metamodel?
> Of course it might be that your question is really simple. You might
> notice for example, that when you've opened a *.ecore with the Sample
> Ecore Editor, you can right click on an EClass and invoke Create Dynamic
> Instance... to create an instance that corresponds to your Ecore...
>>
>> Kind Regards,
>> Mahdi D-Manesh
Previous Topic:model with 2 nodes
Next Topic:multiple namespaces in one editor supported?
Goto Forum:
  


Current Time: Tue Apr 16 14:44:32 GMT 2024

Powered by FUDForum. Page generated in 0.65451 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top