Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] XMI identifier(How to handle XMI Identifier in EMF VM)
[ATL] XMI identifier [message #674038] Wed, 25 May 2011 16:11 Go to next message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
Hi all,

I'm trying to migrate models that contain xmi identifier thanks to ATL, and I'm facing a strange problem.

I added a "__xmiID__ <- from.__xmiID__" binding in my rules and ATL diplays me the following message:

Manual setting of <unnamed>:MyElement XMI ID.

But when I open the generated model, the xmi id are not the correct ones and so references based on identifiers fail.
I tried to follow step by step the generation and I saw that method setId(Object element, Object id) from EMFModelAdapter is called. If I try to browse the resource thanks to:

System.out.println("Resource: "+xmiResource+" contains: ");
TreeIterator<EObject> ti = xmiResource.getAllContents();
while(ti.hasNext()){
	EObject eObj = ti.next();
	System.out.println("	- "+xmiResource.getID(eObj)+" : "+eObj);
}


Data displayed in the console are correct, each element has got the correct xmi identifier.

But when the transformation process arrives to the out model extraction phase, xmi identifiers have been changed ... it seems to be due to the method recreateResourceIfNeeded(EMFModel, URI, String, boolean) contained in EMFExtractor class. This method creates a new resource with a given URI and put the contents from model's resource into the new one. So the map containing the elements' id is lost.

I tried to put the elements'id in the new resource by copying them from the model resource. Unfortunately, the map doesn't contain id anymore ... and I don't know why, they have been change to null.

I hope someone will be able to give me some help.

Thanks in advance,

Aurélien

Re: [ATL] XMI identifier [message #674057 is a reply to message #674038] Wed, 25 May 2011 17:05 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
I don't know if you can adjust but in refining mode the ids are kept as is.
Re: [ATL] XMI identifier [message #674218 is a reply to message #674057] Thu, 26 May 2011 08:02 Go to previous messageGo to next message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
Thanks Sylvain, but in fact I'm working on a tool that provides a migration after metamodel evolution, so if I'm right only exogenous transformations can be used if metamodels are different.
Re: [ATL] XMI identifier [message #674231 is a reply to message #674218] Thu, 26 May 2011 08:30 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Have you tried in regular VM ? this may work
Re: [ATL] XMI identifier [message #674237 is a reply to message #674231] Thu, 26 May 2011 08:55 Go to previous messageGo to next message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
Well If I try to use the regular VM, xmi id are correctly set but the following error appears :

Quote:

org.eclipse.m2m.atl.engine.vm.VMException: Feature libraryName is not changeable
at A.__applyModelDefinition2ModelDefinition(1 : NTransientLink;) : ??#38(modeldefinition_in_TO_modeldefinition_out.atl[51:4-51:51])
local variables = {modeldefinition=OUT1!<unnamed>, from_modeldefinition=IN1!MyModel, link=TransientLink {rule = 'ModelDefinition2ModelDefinition', sourceElements = {from_modeldefinition = IN1!MyModel}, targetElements = {modeldefinition = OUT1!<unnamed>}, variables = {}}, self=modeldefinition_in_TO_modeldefinition_out : ASMModule}
local stack = [OUT1!<unnamed>]

I try to comment the migration action that uses this binding and the migration ends correctly but not all the elements have been migrate.

My metamodel is contained in several Ecore files, it seems that the regular VM doesn't take in account the dependencies, even if in try to add them as input of the transformation. So some of the elements are not sets by the transformation.

[Updated on: Thu, 26 May 2011 08:57]

Report message to a moderator

Re: [ATL] XMI identifier [message #674238 is a reply to message #674237] Thu, 26 May 2011 09:09 Go to previous messageGo to next message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
The error is due to the fact that feature libraryName is derived ... so not changeable. But I don't understand why EMF VM can handle it and not the Regular one.
Re: [ATL] XMI identifier [message #674240 is a reply to message #674238] Thu, 26 May 2011 09:13 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
The regular VM works in dynamic EMF mode, while the EMF VM will work directly on the generated code if the metamodel is generated using EMF.
This can lead to behavioral differences.

Concerning your metamodel problem you can still simulate a full meta-model. You just create a new ecore metamodel where you create a fake EClass that will inherit from an EClass of each of the referenced metamodels. You then use this metamodel as the metamodel for the transformation.
Re: [ATL] XMI identifier [message #674242 is a reply to message #674240] Thu, 26 May 2011 09:22 Go to previous messageGo to next message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
Thank you for your help Sylvain, I will try to simulate a full meta-model.
Re: [ATL] XMI identifier [message #674271 is a reply to message #674242] Thu, 26 May 2011 11:18 Go to previous message
Aur is currently offline AurFriend
Messages: 29
Registered: August 2010
Junior Member
In fact the loss of XMI id when using EMF VM seems to be due to the method commitToResource() implemented in EMFModel class.
This method is called by EMFModelAdapter.finalizeModel() method, and it removes some of the element stored in the model's ressource.

Deleting these elements also modify the map that contains xmi id, so that's why they disappear.
Previous Topic:[ATL]
Next Topic:[Xtext] Reload behavior after changing ecore file
Goto Forum:
  


Current Time: Thu Apr 18 14:18:35 GMT 2024

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

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

Back to the top