Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » [ATL API] Launch ATL transf with cross-references
[ATL API] Launch ATL transf with cross-references [message #1385977] Thu, 12 June 2014 15:08
Antonio M. Moreno is currently offline Antonio M. Moreno
Messages: 13
Registered: November 2012
Junior Member
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
Previous Topic:additional function
Next Topic:Fwd: XText in combination wit ATL
Goto Forum:
  


Current Time: Sat Sep 20 18:21:25 GMT 2014

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

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