Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » How to load two dependent models, change names in referenced types, and keep models consistent?
How to load two dependent models, change names in referenced types, and keep models consistent? [message #524721] Fri, 02 April 2010 02:43 Go to next message
Christoph Wienands is currently offline Christoph WienandsFriend
Messages: 55
Registered: July 2009
Member
Hey guys,

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
alias) -->
<epsilon.emf.loadModel name="Ecore1" alias="Ecore"
modelfile="${basedir}/highlevel.ecore"
metamodeluri="http://www.eclipse.org/emf/2002/Ecore" read="true"
store="true" />
<epsilon.emf.loadModel name="Ecore2" alias="Ecore"
modelfile="${basedir}/lowlevel.ecore"
metamodeluri="http://www.eclipse.org/emf/2002/Ecore" read="true"
store="true" />

<!-- adapt metamodels -->
<epsilon.eol src="${basedir}/adaptModels.eol">
<model ref="Ecore1" />
<model ref="Ecore2" />
</epsilon.eol>

<!-- save and dispose models from memory -->
<epsilon.disposeModels />

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
Re: How to load two dependent models, change names in referenced types, and keep models consistent? [message #524725 is a reply to message #524721] Fri, 02 April 2010 05:13 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Christoph,

At a first glance, this looks like it should work. I'll have a closer
look at this in a few hours (now about to board a flight) and get back
to you.

Cheers,
Dimitris

"Christoph Wienands" <cwienands@gmx.net> wrote:
> Hey guys,
>
> 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
> alias) -->
> <epsilon.emf.loadModel name="Ecore1" alias="Ecore"
> modelfile="${basedir}/highlevel.ecore"
> metamodeluri="http://www.eclipse.org/emf/2002/Ecore" read="true"
> store="true" />
> <epsilon.emf.loadModel name="Ecore2" alias="Ecore"
> modelfile="${basedir}/lowlevel.ecore"
> metamodeluri="http://www.eclipse.org/emf/2002/Ecore" read="true"
> store="true" />
>
> <!-- adapt metamodels -->
> <epsilon.eol src="${basedir}/adaptModels.eol">
> <model ref="Ecore1" />
> <model ref="Ecore2" />
> </epsilon.eol>
>
> <!-- save and dispose models from memory -->
> <epsilon.disposeModels />
>
> 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
>
>
>
Re: How to load two dependent models, change names in referenced types, and keep models consistent? [message #588113 is a reply to message #524721] Fri, 02 April 2010 05:13 Go to previous message
Dimitrios Kolovos is currently offline Dimitrios KolovosFriend
Messages: 1776
Registered: July 2009
Senior Member
Hi Christoph,

At a first glance, this looks like it should work. I'll have a closer
look at this in a few hours (now about to board a flight) and get back
to you.

Cheers,
Dimitris

"Christoph Wienands" <cwienands@gmx.net> wrote:
> Hey guys,
>
> 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
> alias) -->
> <epsilon.emf.loadModel name="Ecore1" alias="Ecore"
> modelfile="${basedir}/highlevel.ecore"
> metamodeluri="http://www.eclipse.org/emf/2002/Ecore" read="true"
> store="true" />
> <epsilon.emf.loadModel name="Ecore2" alias="Ecore"
> modelfile="${basedir}/lowlevel.ecore"
> metamodeluri="http://www.eclipse.org/emf/2002/Ecore" read="true"
> store="true" />
>
> <!-- adapt metamodels -->
> <epsilon.eol src="${basedir}/adaptModels.eol">
> <model ref="Ecore1" />
> <model ref="Ecore2" />
> </epsilon.eol>
>
> <!-- save and dispose models from memory -->
> <epsilon.disposeModels />
>
> 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
>
>
>
Previous Topic:How to load two dependent models, change names in referenced types, and keep models consistent?
Next Topic:Doubt about EGL in ANT
Goto Forum:
  


Current Time: Thu Apr 25 07:25:33 GMT 2024

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

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

Back to the top