Home » Modeling » Epsilon » Calling ETL from Java with "partial" reset(Trying to merge multiple instances of one meta-model in a single instance of a mother without reloading the latter.)
Calling ETL from Java with "partial" reset [message #1281870] |
Tue, 01 April 2014 13:39 |
Philip Makedonski Messages: 10 Registered: May 2013 |
Junior Member |
|
|
Hi,
I am trying to merge multiple instances of one meta-model in a single instance of a mother without reloading the latter. Let me try to elaborate on this:
I have a model instance of meta-model A and multiple instances of meta-model B. What I want to do is execute the same ETL module on all instances of B and the single instance of A. Typically, a self-contained execution is not a problem:
* 0. load ETL,
* 1. load A,
* 2. load Bi,
* 3. execute ETL,
* 4. reset (dispose of A, Bi, ETL),
* 5. repeat (go to 0.)
But since with time A grows, loading and disposing A for each B comprises a major impact on performance. Thus, I've been trying to modify the workflow at least for a set of B instances (B1 ... Bn), where it becomes:
* 0. load ETL,
* 1. load A,
* 2. load Bi,
* 3. execute ETL,
* 4. dispose of Bi,
* 5. repeat (go to 2),
* 6. dispose of A, ETL,
Now I'm not quite sure whether this is possible at all, looking at the implementations for IModule.reset() does not really help so far, but maybe I am looking at the wrong place. Any advice will be appreciated. Here is some sample code illustrating what I am after:
//initialise and load ETL source
module = createModule();
module.parse(getFile(getSource()));
//load merged model (A)
module.getContext().getModelRepository().addModel(getDecentModel(location));
//iterate over models to be merged (Bi)
for (int i : list) {
//load Bi instance
IModel famixModel = getFamixModel(location,i);
module.getContext().getModelRepository().addModel(famixModel);
//execute ETL
preProcess();
result = execute(module);
postProcess();
//remove the merged instance Bi - neither
//module.getContext().getModelRepository().getModelByName("FAMIX").dispose();
//nor
//module.getContext().getModelRepository().removeModel(famixModel);
//seems to work as the ETL transformations are not executed after the first iteration
//perhaps I am missing reset the module without disposing of the source or at least of the merged target A
//default approach which works but has potential performance implications
module.reset();
//reload
module.parse(getFile(getSource()));
module.getContext().getModelRepository().addModel(getDecentModel(location));
}
module.getContext().getModelRepository().dispose();
|
|
|
Re: Calling ETL from Java with "partial" reset [message #1282080 is a reply to message #1281870] |
Tue, 01 April 2014 21:04 |
|
Hi,
Does the following do the trick?
IModel a = ...;
a.load();
for every Bi {
EtlModule module = new EtlModule();
module.parse(...);
IModel b = ...;
b.load();
module.getContext().getModelRepository().addModel(a);
module.getContext().getModelRepository().addModel(b);
module.execute();
b.dispose();
}
a.dispose();
Cheers,
Dimitris
|
|
| | |
Re: Calling ETL from Java with "partial" reset [message #1357495 is a reply to message #1282456] |
Thu, 15 May 2014 14:52 |
Jens Neuschulz Messages: 3 Registered: May 2014 |
Junior Member |
|
|
Hi,
I have a similar problem. I'm trying to transform many source files of one metamodel into many target files of another one metamodel using one ETL. Creating a new ETL Module for every transformation takes a long time and decreases the performance. Using one ETL Module and reloading the source and the target models doesn't work. The content of the source file is changing before every load.
Here is my code:
module = createModule();
module.parse(getFile(getSource()));
for (int i = 0; i < 10000; i++) {
preProcess();
for (IModel model : getModels()) {
module.getContext().getModelRepository().addModel(model);
}
result = execute(module);
postProcess();
module.getContext().getModelRepository().dispose();
}
public List<IModel> getModels() throws Exception {
List<IModel> models = new ArrayList<IModel>();
models.add(createEmfModel("fin5412013", "models/MT541Instance.model", "models/fin5412013.ecore", true, false));
models.add(createEmfModel("sese02300105", "models/sese023Transformed.model", "models/sese02300105.ecore", false, true));
return models;
}
Any help?
Many thanks Jens
|
|
| | | | | | | | | |
Re: Calling ETL from Java with "partial" reset [message #1803027 is a reply to message #1802995] |
Thu, 21 February 2019 08:58 |
|
Hi Kelsey,
I've had a closer look at the EVL code and while the intention was never to be able to reuse modules it appears that providing the module with a fresh context, as follows, should do the trick:
EvlModule module = new EvlModule();
module.parse(...);
...
module.execute(); // First execution
EvlContext context = new EvlContext();
module.setContext(context);
context.setModule(module);
module.execute(); // Second execution without re-parsing
Could you please give it a try and let me know if it works for you?
Cheers,
Dimitris
|
|
| | | | | | |
Goto Forum:
Current Time: Wed Sep 25 15:45:59 GMT 2024
Powered by FUDForum. Page generated in 0.11389 seconds
|