Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [ETL]Creating xmi file from ETL transformation output file(.model)([ETL]Creating xmi file from ETL transformation output file(.model))
[ETL]Creating xmi file from ETL transformation output file(.model) [message #1700890] Tue, 07 July 2015 22:32 Go to next message
mana zargar is currently offline mana zargarFriend
Messages: 16
Registered: April 2015
Junior Member
Hi All,

I have a quick question .Does anyone know how to create xmil file from (.model) file as a result of a ETL transformation ?


Thank you
Mana
Re: [ETL]Creating xmi file from ETL transformation output file(.model) [message #1700892 is a reply to message #1700890] Tue, 07 July 2015 23:00 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Mana,

Does the following screencast help?

https://www.youtube.com/watch?v=6jRFLrEC0l4

Cheers,
Dimitris
Re: [ETL]Creating xmi file from ETL transformation output file(.model) [message #1701200 is a reply to message #1700892] Thu, 09 July 2015 19:22 Go to previous messageGo to next message
mana zargar is currently offline mana zargarFriend
Messages: 16
Registered: April 2015
Junior Member
Hi Dimitris,

Thank you very much. So, you mean (.model) file format is xmi, I guess .
Re: [ETL]Creating xmi file from ETL transformation output file(.model) [message #1701206 is a reply to message #1701200] Thu, 09 July 2015 20:31 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Mana,

This is correct.

Cheers,
Dimitris
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 Go to previous messageGo to next message
Dmitriy T. is currently offline Dmitriy T.Friend
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 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

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
Re: [ETL]Creating xmi file from ETL transformation output file(.model) [message #1838153 is a reply to message #1838135] Wed, 17 February 2021 16:03 Go to previous message
Dmitriy T. is currently offline Dmitriy T.Friend
Messages: 2
Registered: February 2021
Junior Member
Hi Dimitris,

Thank you.
Previous Topic:EOL-native model instance creation
Next Topic:Using reflection
Goto Forum:
  


Current Time: Sat Apr 27 11:36:10 GMT 2024

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

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

Back to the top