Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » One model + ETL; multiple targets
One model + ETL; multiple targets [message #748286] Mon, 24 October 2011 15:57 Go to next message
Eclipse User is currently offline Eclipse User
Messages: 257
Registered: July 2009
Senior Member
Hi

Writing a driver for doing multiple outputs of multiple instances of one
model element type for EGL is documented well in previous post with a
similar title to this post. How would one achieve the same using EGL?

Starting from one model with x number of X elements then generate
multiple models for each X element and persist the new model?
-H
Re: One model + ETL; multiple targets [message #753593 is a reply to message #748286] Thu, 27 October 2011 22:04 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio Hoyos
Messages: 155
Registered: October 2009
Senior Member

Hello,

Quote:
How would one achieve the same using EGL?
I would asume you ment using ETL Wink.

Quote:
Starting from one model with x number of X elements then generate
multiple models for each X element and persist the new model?


Is the number x dynamic or is it known before hand?

If it is known before hand, I have never tried it, but I think something in the lines of this should work: You can use x number of epsilon.emf.loadModel targets in your launch.xml (or epsilon run configuration) to produce multiple output model files. Give each model a unique name, but give them all the same alias. Something like:

<target name="loadModel1">
    <epsilon.emf.loadModel
        name="model1"
        alias="outputModel"
	modelfile="model1.xmi"
	metamodeluri="http://www.mymetamodel.com"
	read="false"
	store="store"
	/>
</target>
...
<target name="loadModelx">
    <epsilon.emf.loadModel
        name="modelx"
        alias="outputModel"
	modelfile="modelx.xmi"
	metamodeluri="http://www.mymetamodel.com"
	read="false"
	store="store"
	/>
</target>

Then in your ETL rules use outputModel as the from model identifier.

If x is dynamic... Is there an ant expert who can tell us if ant supports loops? If not, you will be required to use epsilon standalone, i.e. call ETL from java. Look at the epsilon standalone example for etl (in the repository or the website) and modify the java code so that invocation of etl is inside a loop. Using my own implementation of epsilon standalone, it is something in the lines of:

URI inputModel = URI.createFileURI(inputModelFile.getRawLocation().toString());
for(i = 0; i < x; i++ {
    URI outputModel = URI.createFileURI("C:/model-gen/model" + i + ".xmi");
    EtlExecutor etlExecutor;
    etlExecutor = new EtlExecutor("pathToETlSource");
    etlExecutor.addSourceModel("inputModel", inputModel,    URI.createURI("metamodelIn"));
    etlExecutor.addTargetModel("model" + i, outputModel,  URI.createURI("metamodelOut"));
    etlExecutor.execute();
}


Greetings,

Horacio



Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: One model + ETL; multiple targets [message #753875 is a reply to message #753593] Sat, 29 October 2011 18:16 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-Dominguez
Messages: 309
Registered: January 2010
Senior Member
Hi,

Ant by itself does not support for loops. However, you could use the <for> Ant task, from Ant Contrib. I haven't tried it, though.

Cheers,
Antonio

[Updated on: Sat, 29 October 2011 18:17]

Report message to a moderator

Re: One model + ETL; multiple targets [message #754283 is a reply to message #753875] Tue, 01 November 2011 19:22 Go to previous messageGo to next message
Louis Rose is currently offline Louis Rose
Messages: 440
Registered: July 2009
Location: York, United Kingdom
Senior Member
Hi,

It's also worth noting that ETL rules can create more than one target element. For example:

rule Foo2BarBaz
  transform  s : Input!Foo
  to t1 : FirstOutput!Bar,
     t2 : SecondOutput!Baz {

   // Mappings, for example:
   t1.name = s.name;
   t2.name = s.name;
}


If you want to create different model elements in different models and know the number of target models in advance, this might be a viable option.

Cheers,
Louis.
Re: One model + ETL; multiple targets [message #1215796 is a reply to message #754283] Thu, 28 November 2013 07:34 Go to previous messageGo to next message
Ethem Arkin is currently offline Ethem Arkin
Messages: 1
Registered: September 2010
Junior Member
Is it possible to define two input models for the rule?
Re: One model + ETL; multiple targets [message #1219619 is a reply to message #1215796] Thu, 05 December 2013 00:14 Go to previous message
Dimitris Kolovos is currently offline Dimitris Kolovos
Messages: 883
Registered: July 2009
Senior Member
Hi,

Each ETL rule can define only one source (from) role. However, it's possible to transform groups of elements from multiple models that match specific patterns using the pattern language of Epsilon (EPL) + ETL. Could you please elaborate a bit more on your use case so that I can provide more specific guidance?

Cheers,
Dimitris
Previous Topic:Running ANT tasks from bash console
Next Topic:Automatically derive and apply rules by model comparison possible?
Goto Forum:
  


Current Time: Thu Oct 23 00:44:39 GMT 2014

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

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