Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Problem trying to transform uml programmatically (Uml Profile not recognized/found?)
[ATL] Problem trying to transform uml programmatically [message #514988] Wed, 17 February 2010 12:27 Go to next message
Shaman_Mahmoudi  is currently offline Shaman_Mahmoudi Friend
Messages: 16
Registered: February 2010
Junior Member
Hi,

I am trying to programmatically transform an uml model to mp, and it seems that the uml profile associated with the uml model is not loaded with it because it is complaining about the line where the stereotypes are accessed. Do I have to specify where the UML profile file is and how?

The error message is:

org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: IN!Package1:UML!Package.getValue(org.eclipse.m2m.atl.engine. emfvm.lib.OclUndefined,java.lang.String)
at __applyEcimMomToMIMType(ECIMtoMP.atl[47:13-47:86])
local variables: self=thisModule, link=org.eclipse.m2m.atl.engine.emfvm.lib.TransientLink@36ae36ae, s=IN!Package1:UML!Package, t=OUT!<unnamed>:MP!MimType, copyRightType=OUT!<unnamed>:MP!CopyrightType
at __exec__(ECIMtoMP.atl)
local variables: self=thisModule, e=org.eclipse.m2m.atl.engine.emfvm.lib.TransientLink@36ae36ae
at main(ECIMtoMP.atl)
local variables: self=thisModule



Here is the code

                   // Initial Setup
		ILauncher launcher = CoreService.getLauncher("EMF-specific VM");
		ModelFactory factory = CoreService.createModelFactory(launcher.getDefaultModelFactoryName());
		IInjector injector = CoreService.getInjector(factory.getDefaultInjectorName());
		IExtractor extractor = CoreService.getExtractor(factory.getDefaultExtractorName());
	
		//metamodels
		final IReferenceModel umlMetamodel = factory.newReferenceModel();
		injector.inject(umlMetamodel, "http://www.eclipse.org/uml2/2.1.0/UML");
		final IReferenceModel mpMetaModel = factory.newReferenceModel(); 
		injector.inject(mpMetaModel, "file:/C:/Mp.ecore");
		
		// Creating models
		IModel umlModel = factory.newModel(umlMetamodel);
		IModel mpModel = factory.newModel(mpMetaModel);
		
		//load the input-file
		injector.inject(umlModel, inputFile.getFullPath().toString());
		
		Map<String, Object> options = new HashMap<String, Object>();
		options.put("allowInterModelReferences", "true");
		options.put("profile", "true");

		
		// Getting launcher
		
		launcher.initialize(options);
			
		// Launching
		launcher.addInModel(umlModel,"IN","UML");
		launcher.addOutModel(mpModel, "OUT", "MP");
		
		launcher.addLibrary("HelperFunctions", launcher.loadModule(asmF));
		
		launcher.launch(ILauncher.RUN_MODE, 
						new NullProgressMonitor(), 
						options, 
						asmA,
						asmB,
						asmC,
						asmD,
						asmE);
		


Thanks in advance!

[Updated on: Wed, 17 February 2010 12:29]

Report message to a moderator

Re: [ATL] Problem trying to transform uml programmatically [message #515006 is a reply to message #514988] Wed, 17 February 2010 08:38 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 297
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040208060101030308090605
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

Le 17/02/2010 13:27, Shaman_Mahmoudi a écrit :
> Hi,
>
> I am trying to programmatically transform an uml model to mp, and it
> seems that the uml profile associated with the uml model is not loaded
> with it because it is complaining about the line where the stereotypes
> are accessed. Do I have to specify where the UML profile file is and how?
>
> The error message is:
>
> org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found:
> IN!Package1:UML!Package.getValue(

I guess the problem is here:
org.eclipse.m2m.atl.engine.
> emfvm.lib.OclUndefined,

You have to check before calling the method that the stereotype you give
as argument isn't null.
Anyway, the error message should be more explicit, I will take a look at
that.

Best regards,

William

java.lang.String)
> at __applyEcimMomToMIMType(ECIMtoMP.atl[47:13-47:86])
> local variables: self=thisModule,
> link=mailto:org.eclipse.m2m.atl.engine.emfvm.lib.TransientLink@36ae36ae,
> s=IN!Package1:UML!Package, t=OUT!<unnamed>:MP!MimType,
> copyRightType=OUT!<unnamed>:MP!CopyrightType
> at __exec__(ECIMtoMP.atl)
> local variables: self=thisModule,
> e=mailto:org.eclipse.m2m.atl.engine.emfvm.lib.TransientLink@36ae36ae
> at main(ECIMtoMP.atl)
> local variables: self=thisModule
>
>
> Here is the code
>
>
> // Initial Setup
> ILauncher launcher = CoreService.getLauncher("EMF-specific VM");
> ModelFactory factory =
> CoreService.createModelFactory(launcher.getDefaultModelFacto ryName());
> IInjector injector =
> CoreService.getInjector(factory.getDefaultInjectorName());
> IExtractor extractor =
> CoreService.getExtractor(factory.getDefaultExtractorName());
>
> //metamodels
> final IReferenceModel umlMetamodel = factory.newReferenceModel();
> injector.inject(umlMetamodel, "http://www.eclipse.org/uml2/2.1.0/UML");
> final IReferenceModel mpMetaModel = factory.newReferenceModel();
> injector.inject(mpMetaModel, "file:/C:/Mp.ecore");
>
> // Creating models
> IModel umlModel = factory.newModel(umlMetamodel);
> IModel mpModel = factory.newModel(mpMetaModel);
>
> //load the input-file
> injector.inject(umlModel, inputFile.getFullPath().toString());
>
> Map<String, Object> options = new HashMap<String, Object>();
> options.put("","true");
> options.put("allowInterModelReferences", "true");
> options.put("profile", "true");
>
>
> // Getting launcher
>
> launcher.initialize(options);
>
> // Launching
> launcher.addInModel(umlModel,"IN","UML");
> launcher.addOutModel(mpModel, "OUT", "MP");
>
> launcher.addLibrary("HelperFunctions", launcher.loadModule(asmF));
>
> launcher.launch(ILauncher.RUN_MODE, new NullProgressMonitor(), options,
> asmA,
> asmB,
> asmC,
> asmD,
> asmE);
>
>
>
> Thanks in advance!

--
Ne manquez pas notre prochaine formation ATL inter entreprises:
ATL - Paris - du 2 au 3 Décembre 2009
Pour plus de dates et pour le détail de cette formation:
http://www.obeo.fr/pages/formations/fr

Don't forget our next ATL training:
ATL - Paris - 2009 December from 2th to 3th
More dates and training program on:
http://www.obeo.fr/pages/formations/fr

--------------040208060101030308090605
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"

YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------040208060101030308090605--
Re: [ATL] Problem trying to transform uml programmatically [message #515012 is a reply to message #515006] Wed, 17 February 2010 13:52 Go to previous messageGo to next message
Shaman_Mahmoudi  is currently offline Shaman_Mahmoudi Friend
Messages: 16
Registered: February 2010
Junior Member
HI,

Yes I believe there is the error.

By the way, in the UML input file, it searches for the profile in the same dir where the input file is. I am injecting the input file into a model, so maybe it does not preserve the location of from where it was injected from? Hence why it can not find hte profile file? Should I load the model in a different way maybe and not use inject?
Re: [ATL] Problem trying to transform uml programmatically [message #515280 is a reply to message #515012] Thu, 18 February 2010 10:57 Go to previous messageGo to next message
Shaman_Mahmoudi  is currently offline Shaman_Mahmoudi Friend
Messages: 16
Registered: February 2010
Junior Member
I have tried to run it through an ant task, and I get the same errror message.

If I run it through the atls own run configuration, it works just fine.

In the ant task, I superimposed all the atl files to one single one due to that superimpose is not currently supported in the officially released ATL.

module ECIMtoMP;
create OUT : MP from IN : UML, INPROFILE : UML;

uses HelperFunctions;


and the ant task:

<project name="TransformNow" default="uml2mp" basedir=".">
	<property name="atl.launcher" value="EMF-specific VM"/>
    <target name="uml2mp">
		<atl.loadModel name="UML" metamodel="MOF" nsURI="http://www.eclipse.org/uml2/2.1.0/UML" />
		<atl.loadModel name="MP" metamodel="MOF" path=C:/ATLPROJECT/Mp.ecore" />
		<atl.loadModel name="myUML" metamodel="UML" path="C:/ATLPROJECT/myUMLModel.uml" />
        <atl.loadModel name="myProfile" metamodel="UML" path="C:/ATLPROJECT/ECIM_Base_Profile.profile.uml" /> 
  		
		<atl.launch path="C:/ATLPROJECT/ECIMtoMP.asm">
			<option name="allowInterModelReferences" value="true"/> 
			<option name="profile" value="true"/>
			<option name="supportUML2Stereotypes" value="true"/>
			<inmodel name="INPROFILE" model="myProfile"/>
 			<inmodel name="IN" model="myUML"/>			
 			<outmodel name="OUT" model="myMP" metamodel="MP"/>
 			<library name="HelperFunctions" path="C:/ATLPROJECT/HelperFunctions.asm" />
		</atl.launch >
		
	</target>
</project>



And the error message:

BUILD FAILED
C:\ATLPROJECT\run.xml:9: Operation not found: IN!Package1:UML!Package.getValue(org.eclipse.m2m.atl.engine. emfvm.lib.OclUndefined,java.lang.String)

Total time: 2 seconds

Looking through the code for the ant task, it is more or less doing the model loading, and launching the transformation in the same way I am trying to do.

And here somebody else is experiencing the same issue, http://www.eclipse.org/forums/index.php?t=msg&&th=15 3944&goto=495233#msg_495233

[Updated on: Thu, 18 February 2010 13:05]

Report message to a moderator

Re: [ATL] Problem trying to transform uml programmatically [message #515379 is a reply to message #515280] Thu, 18 February 2010 15:46 Go to previous messageGo to next message
Shaman_Mahmoudi  is currently offline Shaman_Mahmoudi Friend
Messages: 16
Registered: February 2010
Junior Member
Hi,

It works if I use LauncherService.launch instead which I found a very good example in AtlLaunchConfigurationDelegate.java. I have to go back and see why it did not work with the other options.
Re: [ATL] Problem trying to transform uml programmatically [message #520245 is a reply to message #515379] Thu, 11 March 2010 16:50 Go to previous message
Shaman_Mahmoudi  is currently offline Shaman_Mahmoudi Friend
Messages: 16
Registered: February 2010
Junior Member
Ok, I thought everything was fine unti I started to retrieve the modules and libraries from bundles instead of from workspace. I do not get any error messages, but the transformation is not done correctly. It seems that the asm files have to be in the workspace to work properly.

I have tried these two approaches and neither works:


libraries.put("HelperFunctions", (new FileInputStream("C:\\Users\\qmahsha\\IBM\\rationalsdp\\workspace\\M2M\\ATL\\HelperFunctions.asm")));

libraries.put("HelperFunctions", bundleM2M.getEntry("/ATL/HelperFunctions.asm").openStream());



However, in the first example, if I change the workspace dir to the current running worskpace, it will work. But if the file is retrieved outside workspace, it will not work.

Ohh I see that the problem exists for the provided run configuration ATL Transformation launcher aswell. It is not possible to set the library file to something which is not in the workspace.

When I try to load from a bundle, I get this error when transforming:

org.eclipse.m2m.atl.engine.emfvm.VMException: Operation not found: thisModule.isReadOnly(org.eclipse.uml2.uml.internal.impl.Cla ssImpl,java.lang.String)
at __applyEcimMoClassToClassType(MOClassMappingRules.atl[131:15 -131:50])
local variables: self=thisModule, link=org.eclipse.m2m.atl.engine.emfvm.lib.TransientLink@52405240, s=IN!Class1:UML!Class, t=OUT!<unnamed>:MP!ClassType, stereotype='ECIM Base Profile::EcimMoClass', visibleSet=Set {'<unknown>!EXPERIMENTAL:UML!EnumerationLiteral', '<unknown>!CURRENT:UML!EnumerationLiteral', '<unknown>!DEPRECATED:UML!EnumerationLiteral'}
at __exec__(ECIMtoMP.atl)
local variables:
at main(ECIMtoMP.atl)
local variables: self=thisModule

[Updated on: Fri, 12 March 2010 11:29]

Report message to a moderator

Previous Topic:[QVTO] Order of mapped objects
Next Topic:Problem with references and lazy rules
Goto Forum:
  


Current Time: Tue Oct 22 21:43:54 GMT 2019

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

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

Back to the top