Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Running ATL transformation on UML model outside of Eclipse
Running ATL transformation on UML model outside of Eclipse [message #1755019] Mon, 27 February 2017 01:02 Go to next message
Michele Guerriero is currently offline Michele GuerrieroFriend
Messages: 6
Registered: June 2016
Junior Member
Hello everyone. I created an ATL transformation, EMFTVM compiled, which transforms an UML model with applied my own UML profile, into a target model, for which I have an ecore metamodel.
So far I run the transformation using an Eclipse launch configuration. From the launch configuration panel I browse the EMF registry in order to select the URI for the input UML metamodel, which is: http://www.eclipse.org/uml2/5.0.0/UML. Then I browse my workspace in order to select my ecore file as the output metamodel. This way the transformation works correctly.

What I want to do now is to run the transformation outside of Eclipse. In order to do so, I need the ecore file for the input and output metamodel. Looking for the ecore file of the UML metamodel, I ended up with unzipping the org.eclipse.uml2.uml_5.2.2.v20161114-0827.jar file in the "plugin" folder of my Eclipse installation. The UML.ecore file is then under the "model" folder. If I open the UML.ecore file with a text editor I can see nsURI="http://www.eclipse.org/uml2/5.0.0/UML", so I suppose this file corresponds to the metamodel that I select from the EMF registry when I launch the transformation. The problem is that if I copy the UML.ecore file into my workspace and I run the transformation, this time giving for the input metamodel the path to the UML.ecore file, the transformation doesn't work. In particular it raises the following error:

org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.UnsupportedOperationException: UML!Device::getAppliedStereotypes()

If I open the UML.ecore file using the Sample Ecore Model Editor I can see that the getAppliedStereotypes() and all the other operations for handling stereotypes are actually available, so I cannot understand why of that error.

How can I solve this problem? Am I using the right metamodel for UML?

Thanks a lot in advance for any help and suggestion.
Re: Running ATL transformation on UML model outside of Eclipse [message #1755021 is a reply to message #1755019] Mon, 27 February 2017 05:45 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

The UML metamodel specifies the implementation of its EOperations in Java (amongst other things). Therefore, you cannot use the UML ecore file directly, but you should always refer to its namespace URI. Outside Eclipse, you need the entire UML plugin jar file.

Cheers,
Dennis
Re: Running ATL transformation on UML model outside of Eclipse [message #1755031 is a reply to message #1755021] Mon, 27 February 2017 09:17 Go to previous messageGo to next message
Michele Guerriero is currently offline Michele GuerrieroFriend
Messages: 6
Registered: June 2016
Junior Member
Hello Dennis, thanks a lot for your reply. So if I got it right, first of of all I have include the plugin jar when I package my application. Should I then register the URI into the EMF registry? So far I programmatically register the ecore metamodels I need into the EMF registry, as my application is running outside of Eclipse cannot rely on Eclipse. What should I do in the case of the UML metamodel?
Re: Running ATL transformation on UML model outside of Eclipse [message #1755046 is a reply to message #1755031] Mon, 27 February 2017 13:50 Go to previous messageGo to next message
Michele Guerriero is currently offline Michele GuerrieroFriend
Messages: 6
Registered: June 2016
Junior Member
Update: I added org.eclipse.uml2.uml_5.2.2.jar, org.eclipse.uml2.types_2.0.0.jar and org.eclipse.uml2.common_2.1.0.jar as dependencies of my application and I register the UML metamodel into my resource set in the following way:

EPackage umlPack = UMLPackage.eINSTANCE;
EPackage.Registry.INSTANCE.put(umlPack.getNsURI(), umlPack);

Moreover I added a resource factory implementation for UML models:

rs.getResourceFactoryRegistry().getExtensionToFactoryMap().put("uml", new UMLResourceFactoryImpl());

Now I'm able to run the transformation programmatically and to match some rules. The strange problem now is with the execution of methods for handling UML stereotypes. In particular, when I run the transformation from within Eclipse, the method getAppliedStereotypes() returns effectively the list of stereotypes applied to a UML element. When I run the transformation from my java application the same method always return an empty Sequence, even though there are actually stereotypes applied in the input UML model. I though this could be a problem related to the version of ATL and EMF that I'm importing in my application, but even after matching the imported versions with those I've currently installed in eclipse (e.g. 3.8 for ATL), the problem persists. Any idea about this new problem?
Re: Running ATL transformation on UML model outside of Eclipse [message #1755433 is a reply to message #1755046] Fri, 03 March 2017 10:47 Go to previous messageGo to next message
Michele Guerriero is currently offline Michele GuerrieroFriend
Messages: 6
Registered: June 2016
Junior Member
still stucked with this problem, does anyone have an idea of why I'm getting this behavior?
Re: Running ATL transformation on UML model outside of Eclipse [message #1755786 is a reply to message #1755433] Wed, 08 March 2017 08:24 Go to previous message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 589
Registered: September 2012
Location: Belgium
Senior Member

Have you tried org.eclipse.uml2.uml.internal.impl.UMLPackageImpl.init() ?

Cheers,
Dennis
Previous Topic:Problem with comparison
Next Topic:Pivot's OCL and ATL's OCL compatibility
Goto Forum:
  


Current Time: Fri Apr 26 15:34:33 GMT 2024

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

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

Back to the top