Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Running ATL in Java creates empty XMI document
[ATL] Running ATL in Java creates empty XMI document [message #510091] Tue, 26 January 2010 14:18
Eclipse UserFriend
Originally posted by:

Hi everyone,

I encountered a problem running an ATL Transformation in Java. I used
the example given from the JWT project and edited it to my models. But
somehow the result is an empty XMI document. To verify that I edited
everything correctly, here's my code:

private void createResources() {
modelLoader = new AtlEMFModelHandler().createModelLoader();

sparqlasResource =
SparqlasFactory.eINSTANCE.getClass().getResourceAsStream("/metamodel/sparqlas.ecore ");//$NON-NLS-1$
sparqlResource =
SparqlFactory.eINSTANCE.getClass().getResourceAsStream("/metamodel/sparql.ecore ");//$NON-NLS-1$

asmUrl =
ATLTransformation.class.getResource("/resources/sparqlas2sparql.asm ");//$NON-NLS-1$

private Map<String, ASMEMFModel> initMetamodels() {

Map<String, ASMEMFModel> models = new HashMap<String, ASMEMFModel>();

try {
sparqlasMetamodel = (ASMEMFModel) modelLoader.loadModel(
"sparqlas", modelLoader.getMOF(), sparqlasResource);//$NON-NLS-1$

sparqlMetamodel = (ASMEMFModel) modelLoader.loadModel(
"rq", modelLoader.getMOF(), sparqlResource);//$NON-NLS-1$
} catch (IOException e) {

models.put("sparqlas", sparqlasMetamodel);//$NON-NLS-1$ // here it
must be "sparqlas", else error
models.put("rq", sparqlMetamodel);//$NON-NLS-1$ // here it seems to
be irrelevant, whether "rq" or anything else
return models;

public boolean transform(Resource resource) {
boolean success = false;


Map<String, ASMEMFModel> models = new HashMap<String, ASMEMFModel>();
models = initMetamodels(); // für ATLTransformationPostProcessor Zeile

String inFilePath = resource.getURI().toFileString();
String outFilePath = resource.getURI().toFileString() + ".rq";

try {

// with regards to
org.eclipse.jwt.transformations.bpmn.internal.ATLTransformat ion
// nsformations/jwt-transformation-bpmn/?root=Technology_Projec t

// get/create models
ASMEMFModel sparqlasInputModel = (ASMEMFModel) modelLoader.loadModel(
"IN", sparqlasMetamodel, inFilePath);//$NON-NLS-1$
ASMEMFModel sparqlOutputModel = (ASMEMFModel) modelLoader.newModel(
"OUT", URI.createFileURI(outFilePath).toString(),

// load models
models.put("IN", sparqlasInputModel);//$NON-NLS-1$
models.put("OUT", sparqlOutputModel);//$NON-NLS-1$

// launch
Collections.EMPTY_MAP, models, Collections.EMPTY_MAP,
Collections.EMPTY_LIST, Collections.EMPTY_MAP);, new

success = true;

} catch (Exception e) {
isInTransformation = false;
this.currentResource = null;

return success;

I think the problem lies within the ASM file, even if I have no idea how
that is possible. Anyway, I tried the exact code with the Familes2Persons
example and it worked out just fine. Any help would be highly appreciated.

Mark Schneider
Previous Topic:Declarative QVT Execution
Next Topic:[ATL] ADT compatibility with eclipse and EMF
Goto Forum:

Current Time: Sat Jun 06 05:40:57 GMT 2020

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

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

Back to the top