|How to load two dependent models, change names in referenced types, and keep models consistent? [message #588104]
||Fri, 02 April 2010 02:43
| Christoph Wienands
Registered: July 2009
I have the following task to solve: I have multiple Ecore models that form a
hierarchy, so types from lower-level models are reused in higher-level
models. Among other things I need to rename pretty much every type in those
models. So the challenge is to load all those models into memory (or
whereever they get loaded), so that when I rename a type in a lower-level
model, the places in the higher-level models where that type is used get
properly updated. I figured I will load all models (I'm using Ant, so it's
the 'epsilon.emf.loadModel' task), make the changes, and hope that all
models get saved after completion.
Just FYI, you can do this manually in the Sample Ecore Model Editor (haven't
tried any others). You load the top-level model, which will trigger loading
the lower-level models, change the name in a lower-level-model type, and the
upper level model will automatically be adapted and kept consistent.
Here is an Ant snippet that shows what I'm currently doing:
<!-- load all participating models into the same model group (via
<epsilon.emf.loadModel name="Ecore1" alias="Ecore"
<epsilon.emf.loadModel name="Ecore2" alias="Ecore"
<!-- adapt metamodels -->
<model ref="Ecore1" />
<model ref="Ecore2" />
<!-- save and dispose models from memory -->
The problem is that even though I rename model elements in the lower-level
model file, after everything is said and done (and saved) nothing has
changed in the saved high-level model. Interestingly enough, at runtime I do
see that the names of the lower-level types referenced by the higher-level
model elements (e.g. EType of references) has changed.
Any idea why the higher-level model would not store the changed dependencies
on the lower-level types? Alternatively, I'll take ideas about other
approaches as well :-)
Thanks a lot, Christoph
Powered by FUDForum
. Page generated in 0.02139 seconds