Calling ETL from Java with "partial" reset [message #1281870] |
Tue, 01 April 2014 09:39  |
Eclipse User |
|
|
|
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 #1357495 is a reply to message #1282456] |
Thu, 15 May 2014 10:52   |
Eclipse User |
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07296 seconds