Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Instance of Ecore.ecore(How can I generate an ecore model from an instance of Ecore.ecore ?)
Instance of Ecore.ecore [message #1129055] Tue, 08 October 2013 08:40 Go to next message
aurel pestell is currently offline aurel pestell
Messages: 12
Registered: October 2013
Location: Sweden
Junior Member
Hello,

My first post here !
In my project, I have a model-to-Model transformation using Atl.
It maps the AST ecore metamodel generated by Xtext to the metamodel of Ecore itself (Ecore.ecore).
So, when I write some class definitions in my Xtext DSL, I get an XMI instance of Ecore.ecore (for instance: MyClass!name is mapped to Eclass!name).
My question is: how can I generate the Ecore metamodel from this XMI file ?

I hope it is clear enough, I am quite new to MDE.

Thanks in advance !

Aurel
Re: Instance of Ecore.ecore [message #1129961 is a reply to message #1129055] Wed, 09 October 2013 05:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Aurel,

Comments below.

On 08/10/2013 4:37 PM, aurel pestell wrote:
> Hello,
>
> My first post here !
> In my project, I have a model-to-Model transformation using Atl.
> It maps the AST ecore metamodel generated by Xtext to the metamodel of
> Ecore itself (Ecore.ecore).
I see.
> So, when I write some class definitions in my Xtext DSL, I get an XMI
> instance of Ecore.ecore (for instance: MyClass!name is mapped to
> Eclass!name).
I.e., you end up with some type of *.ecore resource containing an
EPackage containing some EClassifiers...
> My question is: how can I generate the Ecore metamodel from this XMI
> file ?
You're asking how you can generate Java code from your *.ecore
resource? You'd need to create a *.genmodel like what you see in the
tutorials and use that to generate the code.
>
> I hope it is clear enough, I am quite new to MDE.
>
> Thanks in advance !
>
> Aurel
Re: Instance of Ecore.ecore [message #1163893 is a reply to message #1129961] Thu, 31 October 2013 09:37 Go to previous message
aurel pestell is currently offline aurel pestell
Messages: 12
Registered: October 2013
Location: Sweden
Junior Member
Hello Ed Merks, sorry for the late response !

My question was more about transforming a Xtext DSL code into an ecore representation.
I managed to do it, it is not super easy but it basically works that way:

1) DslCode.mydsl===parsed into "Ecore AST" representation (using Xtext) then serialized using EMF api===> DslCode.xmi
2) DslCode.xmi ===Mydsl.ecore-to-Ecore.ecore ATL transformation===> DslCodeEcoreRepresentation.xmi
3) DslCodeEcoreRepresentation.xmi ===Deserialization using EMF api==> DslCodeEcoreRepresentation.ecore

Then you can produce the genmodel and generate Java code (for free).

It just works perfectly and is very time saving compared to other solutions (Xtend templates or DoSwitch+Dynamic Ecore).

If somebody is interested, I help, just post a message here.
Previous Topic:Get EClasses that extend a given EClass
Next Topic:Read-Only attributes persisted in model.uml and caused into error
Goto Forum:
  


Current Time: Sat Oct 25 18:33:06 GMT 2014

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

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