Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Text to EMF Model Generator
Text to EMF Model Generator [message #1810973] Thu, 22 August 2019 15:58 Go to next message
Eclipse UserFriend
I am in the process to replace an existing EMF model (stored in XMI resources) with a textual DSL. The existing meta model contains many partitions and I want to start small and just start with one partition (one with only incoming references). The DSL incorporates certain simplifications so shall not be based on the existing meta model. For interop [1] I need to generate the "old" model files from the DSL.

So what I need is some form of model-2-model transformation, preferably triggered from the IGenerator2 (I have a version that converts all the models in a "full build"). The issue I have is that the IGenerator2 is triggered file by file. One way would be to create proxies for all objects outside of the file being generated at the moment. However, is this the "correct" way to do?! I am a bit lost.

Thanks!
Simon


[1] with interop I mean other model partitions will reference the non-dsl meta model elements and all the existing software consuming the non-dsl models shall be left untouched (i.e. the DSL is just "syntactic sugar" for the developers)

Re: Text to EMF Model Generator [message #1810988 is a reply to message #1810973] Fri, 23 August 2019 00:10 Go to previous messageGo to next message
Eclipse UserFriend
No doubt Christian will have a more detailed answer pointers, but one approach would be to use an IDerivedStateComputer to actually synthesize the alternative form of the model on the fly and store it in resource.getContent().get(1). I do that for example for a *.xcore resource where I synthesize the same model as is in a *.ecore resource and as in a *.genmodel resource, i.e., an EPackage and a GenModel, storing them in "slots" 1 and 2 in the resource's contents. Then other applications that aren't aware of *.xcore can nevertheless reference EPackages and GenModels directly in the *.xcore resource. Of course the other applications would still need the infrastructure in place (installed) for loading the DSL resource, but that really does work quite well...
Re: Text to EMF Model Generator [message #1810994 is a reply to message #1810988] Fri, 23 August 2019 04:15 Go to previous messageGo to next message
Eclipse UserFriend
I try to avoid modifying the existing code. It should be unaware of the DSL for the moment. I have modified my conversion code now to create EMF proxies for everything "outside" and just generate the local file. This actually seems to work so far. I have to do some more serious testing to see how it goes. I'll post my findings later.
Re: Text to EMF Model Generator [message #1811067 is a reply to message #1810994] Mon, 26 August 2019 07:05 Go to previous message
Eclipse UserFriend
for the record: replacing any cross-referenced element outside of the currently processed resource with proxies works perfectly fine. I have a running incremental build from DSL to XMI files. I had to fiddle with XMI IDs to keep those stable (i.e. not randomly generated UUIDs).
Previous Topic:Left recursive grammar rule
Next Topic:xtend template generator not working in deployed app
Goto Forum:
  


Current Time: Mon May 19 05:49:04 EDT 2025

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

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

Back to the top