|
|
|
|
|
|
|
|
|
|
Re: ATL Refining Using the API [message #1007531 is a reply to message #1007349] |
Wed, 06 February 2013 05:45  |
Eclipse User |
|
|
|
Hi Sylvain,
Thank you for you suggestion. However, the problem has to be different.
My xmi file looks like this: (this is a fragment of it)
<elements xsi:type="atl:SimpleOutPatternElement" location="277:3-281:4" varName="connected_Output_Param" variableExp="/0/@elements.4/@outPattern/@elements.29/@bindings.2/@value">
<commentsBefore>--- connect value</commentsBefore>
<type xsi:type="ocl:OclModelElement" location="277:27-277:50" name="ConnectedElement" model="/63"/>
<bindings location="279:4-279:83" propertyName="connectionEnd">
<value xsi:type="ocl:IteratorExp" location="279:19-279:83" name="any">
<source xsi:type="ocl:NavigationOrAttributeCallExp" location="279:19-279:56" name="ownedParameter">
<source xsi:type="ocl:VariableExp" location="279:19-279:41" referredVariable="/0/@elements.4/@variables.6"/>
</source>
<body xsi:type="ocl:OperatorCallExp" location="279:66-279:82" operationName="=">
<source xsi:type="ocl:NavigationOrAttributeCallExp" location="279:66-279:72" name="name">
<source xsi:type="ocl:VariableExp" location="279:66-279:67" referredVariable="/0/@elements.4/@outPattern/@elements.27/@bindings.0/@value/@iterators.0"/>
</source>
<arguments xsi:type="ocl:StringExp" location="279:75-279:82" stringSymbol="value"/>
</body>
<iterators location="279:62-279:63" varName="e" variableExp="/0/@elements.4/@outPattern/@elements.27/@bindings.0/@value/@body/@source/@source"/>
</value>
</bindings>
<bindings location="280:4-280:25" propertyName="context">
<value xsi:type="ocl:VariableExp" location="280:13-280:25" referredVariable="/0/@elements.4/@outPattern/@elements.13"/>
</bindings>
</elements>
As you can see, the OperatorCallExp has operationName attribute present. This applies to the entire file.
The problem is that I am trying to run the XMI to ATL conversion from a standalone java application. This conversion, however, works fine from an atl plugin.
To make the tcs.extractor work I first register the needed MetaModels in the following way:
getResourceSet().getResourceFactoryRegistry().getExtensionToFactoryMap().put("xmi", new XMIResourceFactoryImpl());
getResourceSet().getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl());
URI ecoreURITCS = URI.createFileURI("Meta/TCS.ecore");
Resource resourcePackageTCS = resourceSet.getResource(ecoreURITCS, true);
EPackage ePackageTCS = (EPackage)resourcePackageTCS.getContents().get(0);
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gmt/tcs/2007/TCS", ePackageTCS);
URI ecoreURIat = URI.createFileURI("Meta/ATL-TCS.xmi");
Resource resourcePackageTCSat = resourceSet.getResource(ecoreURIat, true);
EObject ePackageAT = resourcePackageTCSat.getContents().get(0);
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gmt/tcs/2007/TCS", ePackageAT);
URI ecoreURIATL = URI.createFileURI("Meta/ATL.ecore");
Resource resourcePackage = resourceSet.getResource(ecoreURIATL, true);
EPackage ePackageOCL = (EPackage)resourcePackage.getContents().get(1);
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gmt/2005/OCL", ePackageOCL);
EPackage ePackageATL = (EPackage)resourcePackage.getContents().get(0);
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gmt/2005/ATL", ePackageATL);
EPackage ePackagePT = (EPackage)resourcePackage.getContents().get(2);
EPackage.Registry.INSTANCE.put("http://www.eclipse.org/gmt/2005/PrimitiveTypes", ePackagePT);
getResourceSet().getPackageRegistry().put("http://www.omg.org/XMI", EcorePackage.eINSTANCE);
getResourceSet().getPackageRegistry().put("http://www.w3.org/2001/XMLSchema-instance", EcorePackage.eINSTANCE);
So, the extractor gets the correct MetaModels injected, and the XMI file is also correct. Any ideas, why it fails?
Thank you in advance for any tip or suggestion!
Greg L
|
|
|
Powered by
FUDForum. Page generated in 0.06802 seconds