Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » [MOFScript] Problems on running a transformation using the Java API(Either the model or metamodel )
[MOFScript] Problems on running a transformation using the Java API [message #491561] Thu, 15 October 2009 03:17 Go to next message
Antonio Dias is currently offline Antonio Dias
Messages: 8
Registered: July 2009
Junior Member
I'm trying to run a transformation programatically, which uses the UML metamodel. I've managed to run a transformation that uses another metamodel in the .ecore format, but now, when I try to run an example which uses the UML metamodel, it doesn't work.

Looking through other posts, I've seen that I must add:
execMgr.lookupAndAddSourceMetaModel("uml","http://www.eclipse.org/uml2/2.1.0/UML");

to my code, in order to load the UML metamodel.

When I execute my java class which runs the transformation (this: http://pastebin.com/f8f8e8ec), I get this as output: http://pastebin.com/f19813ee2

Does anyone know why this might be happening or have a suggestion on what should I do to execute transformations programatically, using the UML metamodel?
Re: [MOFScript] Problems on running a transformation using the Java API [message #493111 is a reply to message #491561] Fri, 23 October 2009 08:12 Go to previous messageGo to next message
Jon Oldevik is currently offline Jon Oldevik
Messages: 17
Registered: July 2009
Junior Member
Hi Antonio,
you shouldn't have to use the call execMgr.lookupAndAddSourceMetaModel("uml","http://www.eclipse.org/uml2/2.1.0/UML"); -- in your case, since your are parsing the transformation, this is handled in the parser.

However, you need to ensure that the UML is in fact loaded. When running outside of Eclipse, you need to explicitly do this, for instance by adding a call to: UMLPackage lePackage = UMLPackage.eINSTANCE;

Then you also need to ensure that the UML URI in the transformation (http://www.eclipse.org/uml2/2.1.0/UML) matches the UML uri of the UML library you link with you Java app. (Under Galileo, this might be http://www.eclipse.org/uml2/3.0.0/UML).


/ Jon Oldevik
Re: [MOFScript] Problems on running a transformation using the Java API [message #493386 is a reply to message #493111] Sun, 25 October 2009 16:12 Go to previous message
Antonio Dias is currently offline Antonio Dias
Messages: 8
Registered: July 2009
Junior Member
Hi Jon,

thank you for taking the time to answer my message. I didn't know where should I call: UMLPackage lePackage = UMLPackage.eINSTANCE, so I googled it and I came across a solution suggested by Gøran K. Olsen in another message: http://pastebin.com/fda7239e

That solved my problem!

Jon Oldevik wrote on Fri, 23 October 2009 04:12
Hi Antonio,
you shouldn't have to use the call execMgr.lookupAndAddSourceMetaModel("uml","http://www.eclipse.org/uml2/2.1.0/UML"); -- in your case, since your are parsing the transformation, this is handled in the parser.

However, you need to ensure that the UML is in fact loaded. When running outside of Eclipse, you need to explicitly do this, for instance by adding a call to: UMLPackage lePackage = UMLPackage.eINSTANCE;

Then you also need to ensure that the UML URI in the transformation (http://www.eclipse.org/uml2/2.1.0/UML) matches the UML uri of the UML library you link with you Java app. (Under Galileo, this might be http://www.eclipse.org/uml2/3.0.0/UML).


/ Jon Oldevik

Previous Topic:Modeling Technologies for C++ Dlls
Next Topic:[MOFScript] Different results when running transformations programmatically and in the plugin
Goto Forum:
  


Current Time: Tue Sep 23 00:28:51 GMT 2014

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

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