| [EOL][ETL] Specify Target Model during runtime [message #781553] |
Sat, 21 January 2012 11:36  |
Chris Martin 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 #782943 is a reply to message #781553] |
Tue, 24 January 2012 14:30   |
|
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
EngD Student
University Of York
|
|
|
|
| Re: [EOL][ETL] Specify Target Model during runtime [message #786547 is a reply to message #781553] |
Mon, 30 January 2012 10:01   |
|
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
EngD Student
University Of York
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02029 seconds