[ATL] XMI identifier [message #674038] |
Wed, 25 May 2011 16:11 |
Aur 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 #674237 is a reply to message #674231] |
Thu, 26 May 2011 08:55 |
Aur 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
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05189 seconds