Mapping from DSL specific ecore to a model ecore [message #1228873] |
Wed, 08 January 2014 03:49  |
Eclipse User |
|
|
|
Hello,
Happy new year to all!!
I have an existing model ecore and want to create a DSL for it. But the structure of that model doesn't fit to the DSL I like to create. So my intention is to create a DSL and than map/create the data model instance from the DSL's model instance.
Can you point me to the direction where I can do this mapping?
The Generator seems a place, but I would prefer to get the resource of my mapped data model as parameter in the 'doGenerate' method. So another location seems t obe better.
Thank you,
Mark
|
|
|
|
|
Re: Mapping from DSL specific ecore to a model ecore [message #1228967 is a reply to message #1228928] |
Wed, 08 January 2014 07:49   |
Eclipse User |
|
|
|
Hi,
I don't wanna do the transformation when executing MWE to generate the stuff!
The transformation should be done, when I use the generated editor typing code in my DSL and save the file.
So the ordinary use case is:
- create a DSL and generate the editor from it
- launch the generated bundles
- use the editor to write code in my DSL's grammar.
- save the file and you get the DSL's EMF Resource with the model in it
- generate any code using the generated xtend generator class
What I want is:
- create a DSL and generate the editor from it
- launch the generated bundles
- use the editor to write code in my DSL's grammar.
- save the file and you get the DSL's EMF Resource with the model in it
- transform this data model into a model instance of the customers ecore
- generate any code using the generated xtend generator class from the model of the customers ecore
I already tried to import the big ecore and created a DSL from it, but the result was not very good. Even if I deleted unnecessary stuff and changed the grammar I didn't achieved a good result.
But I can create an instance of the complex model from the DSL's model which was created from scratch. For this I have to create corresponding objects in the big model, set a lot of default values, non containing cross references and so on. It doesn't matter for me, if I do this in code or using m2m.
I just wanted to know, if there is a good place to start this transformation, when saving the code in my DSL editor. Thats why I came to the idea, do this in the xtend generator class. But my feeling says this is not a good place to do such a transformation.
I cannot change the big model, because its the one from the customer.
Regards,
Mark
[Updated on: Wed, 08 January 2014 08:13] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.63019 seconds