Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Empty XMI when running a transformation from an eclipse plugin(Using the MoDisco java Metamodel and EMFTVM )
Empty XMI when running a transformation from an eclipse plugin [message #1753173] Thu, 02 February 2017 12:46 Go to next message
Thibault beziers la fosse is currently offline Thibault beziers la fosseFriend
Messages: 10
Registered: February 2017
Junior Member
Hello, I'm trying to refine a model from the MoDisco java MetaModel. When I launch the transformation from the ATL EMFTVM Configuration, it works fine, but I want to do this as an eclipse plug-in command.

Using MoDisco programmatically, I generate a java-model of an eclipse java project, but then when I launch the ATL transformation, either the xmi model is empty, or the previous java model hasn't changed at all.

Here's a sample of the java code:

		execEnv = FACTORY.createExecEnv();	
		resourceSet = new ResourceSetImpl();
		
		Metamodel inOutMetamodel = EmftvmFactory.eINSTANCE.createMetamodel();
		inOutMetamodel.setResource(resourceSet.getResource(URI.createURI("platform:/plugin/org.eclipse.gmt.modisco.java/model/java.ecore"), true));		
		execEnv.registerMetaModel("MM", inOutMetamodel);		
		
		inOutModel = EmftvmFactory.eINSTANCE.createModel();
		inOutModel.setResource(resourceSet.getResource(URI.createURI("/Model/Model_java.xmi"), true));		
		execEnv.registerInOutModel("IN", inOutModel);
		
		ModuleResolver moduleResolver = new DefaultModuleResolver(transformationDir, resourceSet);					
		execEnv.loadModule("platform:/plugin/model2test/transformation/", "m2t");	
		
		TimingData timingData = new TimingData();
		timingData.finishLoading();
		execEnv.run(timingData);
		timingData.finish();
		
		inOutModel.getResource().save(Collections.emptyMap());


Here's the header of the ATL file:

		-- @atlcompiler emftvm
		-- @nsURI MM=http://www.eclipse.org/MoDisco/Java/0.2.incubation/java

		module m2t;
		create OUT : MM refining IN : MM;		


During the execution, the debug mode showed that both the Metamodel and the Model has been found, but still, nothing happen.

If you could give me an advice, that would be very helpful. The whole project is attached if you need more details.

Thank you

[Updated on: Thu, 02 February 2017 19:25]

Report message to a moderator

Re: Empty XMI when running a transformation from an eclipse plugin [message #1753208 is a reply to message #1753173] Thu, 02 February 2017 16:56 Go to previous messageGo to next message
Andre Landi is currently offline Andre LandiFriend
Messages: 6
Registered: December 2016
Location: Brazil
Junior Member
Hello,

You already try use
inOutMetamodel.setResource(JavaFactory.eINSTANCE.eResource());

instead
inOutMetamodel.setResource(resourceSet.getResource(URI.createURI(MMInOut), true));

and use
execEnv.registerMetaModel("MM", "http://www.eclipse.org/MoDisco/Java/0.2.incubation/java");

instead
execEnv.registerMetaModel("MM", "platform:/plugin/org.eclipse.gmt.modisco.java/model/java.ecore");
Re: Empty XMI when running a transformation from an eclipse plugin [message #1753230 is a reply to message #1753208] Thu, 02 February 2017 19:27 Go to previous messageGo to next message
Thibault beziers la fosse is currently offline Thibault beziers la fosseFriend
Messages: 10
Registered: February 2017
Junior Member
Thank you for your answer, I tried using "http://www.eclipse.org/MoDisco/Java/0.2.incubation/java" as the MetaModel URL, but it's still not working.
Re: Empty XMI when running a transformation from an eclipse plugin [message #1753242 is a reply to message #1753230] Thu, 02 February 2017 21:12 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

Hmm, for the Ecore or UML metamodel you could just use something like this:
EcorePackage.eINSTANCE.eResource()

However, MoDisco's JavaPackage somehow does not inherit from EObject, and so does not provide the eResource() method, so you cannot use this strategy.

Another trick you may use, is to load the metamodel by its nsURI *after* the model; loading the model triggers the ResourceSet to load the metamodel as well, and then you can just fetch it from the ResourceSet by its namespace URI ("http://www.eclipse.org/MoDisco/Java/0.2.incubation/java"). If in doubt, you can always set a debugging breakpoint to introspect the contents of the resourceSet after loading the model.


Cheers,
Dennis
Re: Empty XMI when running a transformation from an eclipse plugin [message #1753265 is a reply to message #1753242] Fri, 03 February 2017 08:52 Go to previous message
Thibault beziers la fosse is currently offline Thibault beziers la fosseFriend
Messages: 10
Registered: February 2017
Junior Member
It seems to be working using your tips,
Thank you Dennis
Previous Topic:Metamodel constraints in ATL HOT
Next Topic:ATL Metamodel
Goto Forum:
  


Current Time: Thu Apr 25 08:44:59 GMT 2024

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

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

Back to the top