Perhaps this question has been beforehand answered, but I was not able to find it.
I'm developing some Java snippet to call to an ATL transformation which the following header:
create OUT : Maude from IN : Behavior, INATL : ATL;
I'm currently using the ATL API under the org.eclipse.m2m.atl.core and org.eclipse.m2m.atl.engine.emfvm libraries, as it is explained at the ATL Developer Guide. For example, the Behavior model is loaded as follow:
/* Load Behavior Metamodel */
IReferenceModel behMM = mF.newReferenceModel();
injector.inject(behMM, URI.createURI(BehaviorPackage.eNS_URI).toString());
/* Load Behavior Model */
IModel behModel = mF.newModel(behMM);
injector.inject(behModel, FileManager.getDefault().getBehaviorFile().getFullPath().toString());
However, one of the input models, specifically the Behavior model has several cross-references to other file in the file system (in this case in the same folder):
<els xsi:type="behavior:Object" id="A">
<classGD href="default.gcs#//@packagesGD.0/@classesGD.0"/>
</els>
Thus, I have added to the options map the "allowInterModelReferences" option:
Map<String, Object> options = new HashMap<String, Object>();
options.put("allowInterModelReferences", Boolean.TRUE);
Although the transformation works fine when it is launched with an ATL Launch Configuration, when it is fired from the Java code, the typical exception meaning that the cross-refs and its eProxyURI did not work correctly is raised.
The call to the AtlLauncher is:
transformationLauncher.launch(ILauncher.RUN_MODE, null, options,
Transformations.class.getResourceAsStream("BehOcl2Maude.asm"));
I am wondering if the problem is with the Behavior IModel instance, since the input model is an IModel instance and the referenced one (the default.gcs) is not at the object level - it is just a file in the file system. I mean, do I have to load the referenced model as an IModel instance? In this case, how are the cross-references resolved? I know that Resources and ResourceSet of EMF API may resolve this. How can an IModel be created from a Resource instance?
Quote:ATL Version: 3.5.0RC2 (2014/05/26)
Eclipse Kepler RPC Version
Java: 1.7
SO: Mac OS X Mavericks
Thank you in advance!
Antonio