Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Execute atl in a java program
icon5.gif  Execute atl in a java program [message #897038] Fri, 20 July 2012 21:46 Go to next message
iram castaneda is currently offline iram castanedaFriend
Messages: 1
Registered: July 2012
Junior Member
hi guys
I am newbie with atl and I need to execute a program in java that runs on atl, it requires the program receives three inputs...
a) an ecore file ( file.ecore) is the metamodel source.
b) an ecore file ( file.ecore) is the metamodel target.
c) an file of an source model. file .pl_xelha(is an SPL language)
d) the ATL program

it should generate an output:
a) file of the target mode. file.pl_xelha(SPL language)

I am not certain how it should work...

Any suggestion, recommendation, code, algorithm or pray is welcome.

Very Happy
thank you!
Re: Execute atl in a java program [message #897276 is a reply to message #897038] Mon, 23 July 2012 13:28 Go to previous messageGo to next message
Holger S is currently offline Holger SFriend
Messages: 4
Registered: January 2012
Junior Member

i think this link might help you:

Re: Execute atl in a java program [message #897409 is a reply to message #897276] Tue, 24 July 2012 03:35 Go to previous messageGo to next message
Fernando Gonzalez is currently offline Fernando GonzalezFriend
Messages: 3
Registered: July 2012
Junior Member
We are trying to transform from one model to another model using the same metamodel as input and output.
There are several examples out there but some classes or methods have been deprecated.
The ATL.Zip by Milanovic has been deprecated too as he says.

Is there a newer example we could use ?

The launcher takes as input an asm module, so I guess I need to compile my ATL module but I don't know how.

Help anyone ?

Thanks in advance
Re: Execute atl in a java program [message #898735 is a reply to message #897409] Fri, 27 July 2012 11:46 Go to previous messageGo to next message
Gunnar Arndt is currently offline Gunnar ArndtFriend
Messages: 62
Registered: June 2012
You can easily replace the deprecated methods of ATLLauncher by valid ones with an additional parameter.
This is the code I am currently using for that purpose (still having problems during the transformation, though):
final Map<String, ASMEMFModel> models = new HashMap<String, ASMEMFModel>();

			final AtlEMFModelHandler modelHandler = (AtlEMFModelHandler) AtlModelHandler
			final EMFModelLoader modelLoader = (EMFModelLoader) modelHandler
			 * Create the metamodels' URIs.
			final URI modelTransformationModelResource = 
			final URI otxModelResource = 
			final URI hmiModelResource = 
			 * Load the metamodels by their previously created URI.
			final ASMEMFModel modelTransformationMetaModel = modelLoader
					.loadModel("ModelTransformation", modelLoader.getMOF(),
			final ASMEMFModel otxMetaModel = modelLoader.loadModel("otx",
					modelLoader.getMOF(), otxModelResource);
			final ASMEMFModel hmiMetaModel = modelLoader.loadModel("hmi",
					modelLoader.getMOF(), hmiModelResource);
			 * Load the input model from the given file.
			final URI inputModelUri = URI.createFileURI(inputFile.getPath());
			final ASMEMFModel modelTransformationInputModel = modelLoader
					.loadModel("IN", modelTransformationMetaModel,
			 * Create output models (TODO allow inter-model references!).
			final URI otxOutputUri = URI.createFileURI(new File(folder
					.getAbsolutePath(), "out.otx").getPath());
			final ASMEMFModel otxOutputModel = (ASMEMFModel) modelLoader
					.newModel("OUT", otxOutputUri.toFileString(), otxMetaModel);

			final URI hmiOutputUri = URI.createFileURI(new File(folder
					.getAbsolutePath(), "out.hmi").getPath());
			final ASMEMFModel hmiOutputModel = (ASMEMFModel) modelLoader
					.newModel("hmi", hmiOutputUri.toFileString(), hmiMetaModel);

			models.put("transformate", modelTransformationMetaModel);
			models.put("otx", otxMetaModel);
			models.put("otxHmi", hmiMetaModel);
			models.put("IN", modelTransformationInputModel);
			models.put("OUT", otxOutputModel);
			models.put("hmi", hmiOutputModel);
			 * Determine the compiled ATL rule file.
			final URL atlAsmUrl = new URL(
			 * Important: Allow inter-model references.
			final Map<String, String> options = new HashMap<String, String>();
			options.put("allowInterModelReferences", "true");
			// options.put("outputModelContentTypesDetection", "true");
			 * Perform the model-to-model transformation.
			AtlLauncher.getDefault().launch(atlAsmUrl, Collections.emptyMap(),
					models, Collections.emptyMap(), Collections.emptyList(),
					options);, otxOutputUri.toFileString());

You'll have to replace the file names, of course.
Re: Execute atl in a java program [message #900236 is a reply to message #898735] Mon, 06 August 2012 01:29 Go to previous message
Fernando Gonzalez is currently offline Fernando GonzalezFriend
Messages: 3
Registered: July 2012
Junior Member
What kind of project do you create ?
I assume you are using the classes from
I installed the ModelPro but I still get some errors of objects that
can't be found.
Previous Topic:NoClassDefFound on programmatic launch of the families2persons example
Next Topic:How to call an EOperation in atl program?
Goto Forum:

Current Time: Sun Jun 24 18:58:43 GMT 2018

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

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

Back to the top