|
|
|
|
Re: [ETL]Creating xmi file from ETL transformation output file(.model) [message #1838126 is a reply to message #1701206] |
Wed, 17 February 2021 01:20 |
Dmitriy T. Messages: 2 Registered: February 2021 |
Junior Member |
|
|
Hello Everyone,
I have a related question. How can I generate XMI output when running a standalone ETL application?
I reproduced the above YouTube example and I got DBInstance(1).model (please see the attached). I suppose this is a valid XMI file.
Then I tried to execute the same transformation as a standalone application using the following code.
package test;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.eclipse.epsilon.common.util.StringProperties;
import org.eclipse.epsilon.emc.emf.EmfModel;
import org.eclipse.epsilon.etl.launch.EtlRunConfiguration;
public class Main {
public static void main(String[] args) throws Exception {
String mapping = "OO2DB.etl";
String sourceMetaModel1 = "OO.ecore";
String sourceMetaModel2 = "TM.ecore";
String targetMetaModel1 = "DB.ecore";
String targetMetaModel2 = "SimpleTrace.ecore";
String sourceModel1 = "OOInstance.model";
String sourceModel2 = "OO2DB.model";
String targetModel1 = "DBInstance.model";
String targetModel2 = "Trace.model";
String sourceName1 = "OO";
String sourceName2 = "OO2DB";
String targetName1 = "DB";
String targetName2 = "Trace";
Path root = Paths.get(Main.class.getResource("").toURI());
Path modelsRoot = root.getParent().resolve("models");
String sourceMetaModelPath1 = modelsRoot.resolve(sourceMetaModel1).toAbsolutePath().toUri().toString();
String sourceMetaModelPath2 = modelsRoot.resolve(sourceMetaModel2).toAbsolutePath().toUri().toString();
String targetMetaModelPath1 = modelsRoot.resolve(targetMetaModel1).toAbsolutePath().toUri().toString();
String targetMetaModelPath2 = modelsRoot.resolve(targetMetaModel2).toAbsolutePath().toUri().toString();
String sourceModelPath1 = modelsRoot.resolve(sourceModel1).toAbsolutePath().toUri().toString();
String sourceModelPath2 = modelsRoot.resolve(sourceModel2).toAbsolutePath().toUri().toString();
String targetModelPath1 = modelsRoot.resolve(targetModel1).toAbsolutePath().toUri().toString();
String targetModelPath2 = modelsRoot.resolve(targetModel2).toAbsolutePath().toUri().toString();
StringProperties sourceProperties1 = new StringProperties();
sourceProperties1.setProperty(EmfModel.PROPERTY_NAME, sourceName1);
sourceProperties1.setProperty(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI, sourceMetaModelPath1);
sourceProperties1.setProperty(EmfModel.PROPERTY_MODEL_URI, sourceModelPath1);
StringProperties sourceProperties2 = new StringProperties();
sourceProperties2.setProperty(EmfModel.PROPERTY_NAME, sourceName2);
sourceProperties2.setProperty(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI, sourceMetaModelPath2);
sourceProperties2.setProperty(EmfModel.PROPERTY_MODEL_URI, String sourceModelPath2);
StringProperties targetProperties1 = new StringProperties();
targetProperties1.setProperty(EmfModel.PROPERTY_NAME, targetName1);
targetProperties1.setProperty(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI, targetMetaModelPath1);
targetProperties1.setProperty(EmfModel.PROPERTY_MODEL_URI, targetModelPath1);
StringProperties targetProperties2 = new StringProperties();
targetProperties2.setProperty(EmfModel.PROPERTY_NAME, targetName2);
targetProperties2.setProperty(EmfModel.PROPERTY_FILE_BASED_METAMODEL_URI, targetMetaModelPath2);
targetProperties2.setProperty(EmfModel.PROPERTY_MODEL_URI, targetModelPath2);
targetProperties1.setProperty(EmfModel.PROPERTY_READONLOAD, "false");
targetProperties1.setProperty(EmfModel.PROPERTY_STOREONDISPOSAL, "true");
targetProperties2.setProperty(EmfModel.PROPERTY_READONLOAD, "false");
targetProperties2.setProperty(EmfModel.PROPERTY_STOREONDISPOSAL, "true");
EtlRunConfiguration runConfig = EtlRunConfiguration.Builder()
.withScript(root.resolve(mapping))
.withModel(new EmfModel(), sourceProperties1)
.withModel(new EmfModel(), sourceProperties2)
.withModel(new EmfModel(), targetProperties1)
.withModel(new EmfModel(), targetProperties2)
.withProfiling()
.build();
runConfig.run();
runConfig.dispose();
}
}
I generated DBInstance(2). Which is, if I understand correctly, not in XMI format.
How can I fix this?
Thanks,
Dmitriy
[Updated on: Thu, 18 February 2021 12:05] Report message to a moderator
|
|
|
Re: [ETL]Creating xmi file from ETL transformation output file(.model) [message #1838135 is a reply to message #1838126] |
Wed, 17 February 2021 09:15 |
|
Hi Dmitry,
Both documents are valid XMI. The extra xmi:XMI tag in the first one is there because the model contains several top-level instances of "Database", which suggests that you may have not unticked the "Read on load" option in the target model of your transformation and hence every time you run the transformation, an additional database is added to the model.
Thanks,
Dimitris
|
|
|
|
Powered by
FUDForum. Page generated in 0.04100 seconds