Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL] Modifying referenced model(Modifying a model referenced by the source model of a transformation rule)
[ETL] Modifying referenced model [message #1386893] Sun, 22 June 2014 16:01 Go to next message
José Manuel Cruz is currently offline José Manuel CruzFriend
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 #1387041 is a reply to message #1386893] Mon, 23 June 2014 16:32 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

Hi José Manuel,

Could you please put together a minimal example [1] we can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [ETL] Modifying referenced model [message #1387162 is a reply to message #1387041] Tue, 24 June 2014 14:25 Go to previous messageGo to next message
José Manuel Cruz is currently offline José Manuel CruzFriend
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
Re: [ETL] Modifying referenced model [message #1387237 is a reply to message #1387162] Tue, 24 June 2014 21:04 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2182
Registered: July 2009
Location: York, UK
Senior Member

No worries - glad this worked!

Cheers,
Dimitris
Previous Topic:[EPL] Execution semantics
Next Topic:[ECL] How to match hierarchical models?
Goto Forum:
  


Current Time: Sat Sep 21 10:31:56 GMT 2024

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

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

Back to the top