[ETL] Modifying referenced model [message #1386893] |
Sun, 22 June 2014 16:01 |
José Manuel Cruz Messages: 2 Registered: June 2014 |
Junior Member |
|
|
Hi,
I'm having a problem with a particular scenario involving ETL.
I have two models: a and b, conforming to metamodels A and B.
Every instance in model a has a reference to another instance in model b.
Then there's a third metamodel: Z.
So now what I'm trying to do is a transformation from model a to some model z (conforming to metamodel Z), modifying b in the process.
So a transformation rule would look like this:
rule ExampleRule
transform x : A!SomeAClass
to y : Z!SomeZClass {
/* Create y from x */
x.referencedBElement.attribute = newValue;
}
I have a couple of Ant targets that look like this:
<target name="loadModels">
<epsilon.emf.loadModel name="a" modelFile="models/a.xmi" metamodelFile="metamodels/A.ecore" read="true" store="false" />
<epsilon.emf.loadModel name="b" modelFile="models/b.xmi" metamodelFile="metamodels/B.ecore" read="true" store="true" />
<epsilon.emf.loadModel name="z" modelFile="models/z.xmi" metamodelFile="metamodels/Z.ecore" read="false" store="true" />
</target>
<target name="transformation" depends="loadModels">
<epsilon.etl src="transformations/Transformation.etl">
<model ref="a" />
<model ref="b" />
<model ref="z" />
</epsilon.etl>
</target>
So what I'm trying to do is to obtain a fresh new model z and the existing model b with new values in some of its instance attributes.
But after I run this I get the b.xmi file completely empty.
I know ETL allows the modification of the source model, so that if I load model a with store=true, I can modify it in a rule like the one before. But this modification seems to work only with the instance in the transform clause of the rule.
If I set model b to store=true but define no rule with a class of B in the transform clause, then no instance is created or modified and I obtain an empty model, losing the previous content.
So I'm just wondering if there's a way of making this possible, or if I have to rearrange the scenario to get what I want.
Thanks in advance,
José Manuel
|
|
|
|
Re: [ETL] Modifying referenced model [message #1387162 is a reply to message #1387041] |
Tue, 24 June 2014 14:25 |
José Manuel Cruz Messages: 2 Registered: June 2014 |
Junior Member |
|
|
Hi,
I was working on a minimal example when, after some initial errors, I managed to make it work.
I think I spotted the source of my problems and in the end got my scenario running. It was related to model a, which I generate from another transformation, and apparently the whole proccess didn't work if I start from an already generated model a, instead of generating it on another task in the same ant launch file.
I don't understand exactly what the cause of the error was, but that's not the point of this thread.
The true point is that indeed you can modify a referenced model. The scenario I presented is perfectly feasible and pose no problems, so I consider this thread closed.
Many thanks and sorry for the inconvenience,
José Manuel
|
|
|
|
Powered by
FUDForum. Page generated in 0.04580 seconds