Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EOL][ETL] Specify Target Model during runtime
[EOL][ETL] Specify Target Model during runtime [message #781553] Sat, 21 January 2012 16:36 Go to next message
Chris Martin is currently offline Chris MartinFriend
Messages: 6
Registered: January 2012
Junior Member
Hi,
I need to write an ETL Transformation from 1 source model to 1 out of 6 possible Target Models. To find the right Target Model, I have a second model, which contains information that are used to determine which Metamodel should be used for the target model.
I would like to use EOL to read the information from the second model and determine which target model is to be used. Is it possible to start the ETL transformation afterwards from within the eol?

Another way I tried to get the problem solved, was by writing an own Ant Task, which reads the information from the second model and sets the property of the Target Metamodel in the Ant file. But as I said, I would like to use eol to do this.

Thanks,
Chris
Re: [EOL][ETL] Specify Target Model during runtime [message #781605 is a reply to message #781553] Sat, 21 January 2012 19:45 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 594
Registered: January 2010
Location: Birmingham, UK
Senior Member

Hi Chris,

Epsilon does not have any predefined operations for invoking ETL transformations from EOL. However, you could make your own tool for calling ETL from EOL as an external plugin. Have you checked this example?

http://eclipse.org/gmt/epsilon/examples/index.php?example=org.eclipse.epsilon.examples.tools

Alternatively, you could invoke EOL from an Ant task and then create the ETL Ant task itself from the EOL file, using EOL's support for handling native Java types. This is one of the approaches that can be used to test ETL transformations from EUnit, our unit testing framework. Check this screencast (particularly, the "inline Ant task" case):

http://eclipse.org/gmt/epsilon/cinema/player.php?screencast=eunit-etl

In this case we're creating the model loading tasks and not the ETL task, but you could apply the same approach to the ETL task.

Hope it helps,
Antonio
icon14.gif  Re: [EOL][ETL] Specify Target Model during runtime [message #782166 is a reply to message #781605] Mon, 23 January 2012 09:42 Go to previous messageGo to next message
Chris Martin is currently offline Chris MartinFriend
Messages: 6
Registered: January 2012
Junior Member
Thanks a lot, the second link was exactly what I was looking for Smile
Re: [EOL][ETL] Specify Target Model during runtime [message #782943 is a reply to message #781553] Tue, 24 January 2012 19:30 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

Hi,

You can also take the "stand alone" approach. By executing Epsilon from Java you can query the model that holds the information of the specific target model and then use it to execute the ETL transformations on it. The standalone example needs some tweaking (I can't share my version, sorry), but it would be something in the lines of:
eolExecutor = new EolExecutor("ModelQueries.eol");
eolExecutor.addSourceModelByURI("infoModel", infoModel, "http://MyInfoEcore");
// Query the Model for the correct model for transformation
eolExecutor.executeOperation("getCorrectModel");
model = (String) eolExecutor.getResult();
// Use the imodel name to get the path
String targetModel = MyModelsBasePath + model + ".xmi"
// Execute the transformation
etlExecutor = new EtlExecutor("Transformation.etl");
etlExecutor.addSourceModelByURI("sourceModel", sourceModel, "http://MySourceEcore");
etlExecutor.addTargetModelByURI("targetModel", targetModel, "http://MyTargetEcore");
etlExecutor.execute();


Cheers


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: [EOL][ETL] Specify Target Model during runtime [message #784431 is a reply to message #782943] Fri, 27 January 2012 14:19 Go to previous messageGo to next message
Chris Martin is currently offline Chris MartinFriend
Messages: 6
Registered: January 2012
Junior Member
Thanks for your help.
I solved my problem by implenting a Java Plugin, which starts the ETL based on the Java standalone example. But now I have one remaining question. Is it possible to import
variables to the ETL transformation? So something like the <uses ref="a" as="b"/> in the Ant workflow, but as a Java method?

Best Regards, Chris
Re: [EOL][ETL] Specify Target Model during runtime [message #786547 is a reply to message #781553] Mon, 30 January 2012 15:01 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 240
Registered: October 2009
Location: Mexico
Senior Member

Hi Chris,

Glad it helped. You actually can (as far as I know).

In the execute method of the standalone implementation you create a module, depending on the Epsilon language you are using. You can then use this module to import variables to your execution environment. In the code below I added the null variable to the context (to overcome a bug that existed in EGL). So the first parameter to the createReadOnlyVariable method is the name you will use to identify you variable and the second parameter the value.

public void execute() throws RiskcException {
    module = createModule();
    module.getContext().getFrameStack().put(Variable.createReadOnlyVariable("null", null));
}


Once in your Epsilon language you can recall the value of the variable by using the name you assigned to it. I haven't looked but there is probably a method to create read/write variables which could be another method to share information between executions. For example this could be another solution to your dynamic model loading issue.

Regards,


Horacio Hoyos Rodriguez
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: [EOL][ETL] Specify Target Model during runtime [message #787180 is a reply to message #786547] Tue, 31 January 2012 08:49 Go to previous messageGo to next message
Chris Martin is currently offline Chris MartinFriend
Messages: 6
Registered: January 2012
Junior Member
Thanks again for your help, the createReadOnlyVariable method did the trick for me. I really appreciate your fast help in the forum.

Best Regards, Chris
icon4.gif  Re: [EOL][ETL] Specify Target Model during runtime [message #792909 is a reply to message #787180] Tue, 07 February 2012 15:00 Go to previous messageGo to next message
Chris Martin is currently offline Chris MartinFriend
Messages: 6
Registered: January 2012
Junior Member
Hi,

After everything went fine with the Java Plugin I have now encountered a problem with the user interaction System.user.choose, when I call it in the ETL, which was called by the Java Plugin from within the EOL.
If i call the following code in a normal ETL everything runs as it should.
pre {
	var a : Sequence;
	a.add("asd");
	a.add("das");
	var result = System.user.choose("test", a);
	}

But if I start the ETL Transformation by using the Javaplugin, all I get is a massive spam of
[epsilon.eol - test.eol] Not a valid number : 
[epsilon.eol - test.eol] Please select a choice from 1 to 2
[epsilon.eol - test.eol] test
[epsilon.eol - test.eol] 1) asd
[epsilon.eol - test.eol] 2) das

Is there any way of fixing this?

Best Regards, Chris
Re: [EOL][ETL] Specify Target Model during runtime [message #792927 is a reply to message #792909] Tue, 07 February 2012 15:20 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2154
Registered: July 2009
Location: York, UK
Senior Member

Hi Chris,

You need to add the following line to your code just before you run your transformation:

module.getContext().setUserInput(new JFaceUserInput(new PrettyPrinterManager()));

Cheers,
Dimitris
icon14.gif  Re: [EOL][ETL] Specify Target Model during runtime [message #792975 is a reply to message #792927] Tue, 07 February 2012 16:19 Go to previous messageGo to next message
Chris Martin is currently offline Chris MartinFriend
Messages: 6
Registered: January 2012
Junior Member
Hi,
wow you guys are really fast answering questions. Thank you, you help me out a lot.

Best Regards, Chris
Re: [EOL][ETL] Specify Target Model during runtime [message #1831548 is a reply to message #784431] Sun, 23 August 2020 01:33 Go to previous message
Eclipse UserFriend
Chris Martin wrote on Fri, 27 January 2012 14:19
Thanks for your help.
I solved my problem by implenting a Java Plugin, which starts the ETL based on the Java standalone example. But now I have one remaining question. Is it possible to import
variables to the ETL transformation? So something like the <uses ref="a" as="b"/> in the Ant workflow, but as a Java method?

Best Regards, Chris

Hi,
is it possible to share the java plugin that you created to solve the issue, or maybe a template of that, that would be helpful. Thank you
Previous Topic:Cross-cutting in EuGENia / diagram tab caption
Next Topic:Problems with Epsilon installation on a Mac
Goto Forum:
  


Current Time: Thu Mar 28 19:52:52 GMT 2024

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

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

Back to the top