Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Launch atl transformations programmatically
[ATL] Launch atl transformations programmatically [message #690798] Thu, 30 June 2011 08:48 Go to next message
mingyi  is currently offline mingyi Friend
Messages: 3
Registered: June 2011
Junior Member
Hello everyone,

I'm working on a project which needs to lanch an owl2ecore atl transformation programmatically. In the transformation, I use the metamodel of Ecore in EMF Registry as metamodel of Ecore. In my code to lanch this atl transformation, I have problem to load the metamodel of Ecore. Here's my code to load the metamodel of Ecore :

index.php/fa/3183/0/

What should I do with this ?
Thanks very much.

Mingyi
  • Attachment: code.jpg
    (Size: 16.01KB, Downloaded 710 times)
Re: [ATL] Launch atl transformations programmatically [message #690916 is a reply to message #690798] Thu, 30 June 2011 12:23 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hi mingyi,

Did you use the "ATL Plugin" wizard ?
Actually, it provides a way to launch a transformation by using the class generated by the wizard.
Re: [ATL] Launch atl transformations programmatically [message #691316 is a reply to message #690916] Fri, 01 July 2011 08:16 Go to previous messageGo to next message
mingyi  is currently offline mingyi Friend
Messages: 3
Registered: June 2011
Junior Member
No, I didn't. How could I use it ?

[Updated on: Fri, 01 July 2011 08:17]

Report message to a moderator

Re: [ATL] Launch atl transformations programmatically [message #691382 is a reply to message #691316] Fri, 01 July 2011 10:56 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hi! Did you install the plugin ATL for Eclipse ?
If you didn't, install it with the update site. Then, you will be able to create a new "ATL plugin" from the wizard. The wizard will generate several files to launch your transformation by code.

Re: [ATL] Launch atl transformations programmatically [message #692462 is a reply to message #691382] Mon, 04 July 2011 13:41 Go to previous messageGo to next message
Yulia B is currently offline Yulia BFriend
Messages: 16
Registered: June 2011
Junior Member
Hi!

I also need to launch ATL transformation programmatically. I've created the plugin with wizard as you suggested. So Java class A2B was created automatically and its main method should launch A2B.atl. Then I've created another class to launch the transformation (actually I need to launch a chaining of several transformations) and call A2B.main(models_paths) from there.
The following error has occured:
org.eclipse.m2m.atl.core.ATLCoreException: Error loading /Test1/TypeA.ecore: java.io.FileNotFoundException: \Test1\TypeA.ecore (System cannot find the path)
	at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:70)
	at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:84)
	at org.eclipse.m2m.atl.sample.files.A2B.loadModels(A2B.java:115)
	at org.eclipse.m2m.atl.sample.files.A2B.main(A2B.java:77)
	at org.eclipse.m2m.atl.sample.files.Launch.main(Launch.java:13)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException: \Test1\TypeA.ecore (System cannot find the path)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
	at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:65)
	... 4 more
Caused by: java.io.FileNotFoundException: \Test1\TypeA.ecore (System cannot find the path)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(Unknown Source)
	at org.eclipse.emf.ecore.resource.impl.FileURIHandlerImpl.createInputStream(FileURIHandlerImpl.java:105)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:301)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1254)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
	... 6 more


So the metamodels cannot be accessed. When I created the ATL plugin the wizard offered to choose metamodel from one of registered packages URI. There weren't my metamodels in the list of registtered packages inspite of they were present at the workspace at the Test1 project. What should I do to use my metamodels? How can I make a "registered package URI" from them? What does it mean?

Thank you in advance!
Re: [ATL] Launch atl transformations programmatically [message #692487 is a reply to message #692462] Mon, 04 July 2011 14:38 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hi Yulia!

Look at this topic just below this one :

http://www.eclipse.org/forums/index.php/mv/msg/214674/686524/#msg_686524

It was my problem...You have to fill correctly the .properties file with good paths Smile!
Re: [ATL] Launch atl transformations programmatically [message #692778 is a reply to message #692487] Tue, 05 July 2011 08:11 Go to previous messageGo to next message
Yulia B is currently offline Yulia BFriend
Messages: 16
Registered: June 2011
Junior Member
Hi!

Thank you very much for the reply!
I tried to set a path as you wrote in that topic, but this exception occured:
org.eclipse.m2m.atl.core.ATLCoreException: Error loading platform:/pluginName/src/pluginName/files/metamodelA.ecore: java.net.MalformedURLException: unknown protocol: platform
	at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:70)
	at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:84)
	at pluginName.files.ATLJavaClass.loadModels(ATLJavaClass.java:123)
	at pluginName.files.ATLJavaClass.main(ATLJavaClass.java:83)
	at pluginName.files.LaunchATLJavaClass.main(LaunchATLJavaClass.java:14)
Caused by: org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.net.MalformedURLException: unknown protocol: platform
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:315)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:397)
	at org.eclipse.m2m.atl.core.emf.EMFInjector.inject(EMFInjector.java:65)
	... 4 more
Caused by: java.net.MalformedURLException: unknown protocol: platform
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl.createInputStream(URIHandlerImpl.java:176)
	at org.eclipse.emf.ecore.resource.impl.ExtensibleURIConverterImpl.createInputStream(ExtensibleURIConverterImpl.java:301)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1254)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:255)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:270)
	... 6 more


Do you know what's wrong? I've set the following path in ATLJavaClass.properties file:
ATLJavaClass.metamodels.metamodelA= platform:/pluginName/src/pluginName/files/metamodelA.ecore
Re: [ATL] Launch atl transformations programmatically [message #692855 is a reply to message #692778] Tue, 05 July 2011 11:00 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hi,

Your path is wrong instead of :
ATLJavaClass.metamodels.metamodelA= platform:/pluginName/src/pluginName/files/metamodelA.ecore


The topic I wrote says :
platform:/plugin/plugin-id/src/uml2problem/files/problem.ecore

So if your ATL plugin is integrated (with dependencies) in another Eclipse-plugin your path must be :
ATLJavaClass.metamodels.metamodelA= platform:/plugin/your ATL plugin-ID/src/pluginName/files/metamodelA.ecore


If you created a class in the ATL Plugin to launch the transformation the path must be :
ATLJavaClass.metamodels.metamodelA=src/pluginName/files/metamodelA.ecore


Tell if it doesn't work!

Regards.
Re: [ATL] Launch atl transformations programmatically [message #692891 is a reply to message #692855] Tue, 05 July 2011 12:25 Go to previous messageGo to next message
Yulia B is currently offline Yulia BFriend
Messages: 16
Registered: June 2011
Junior Member
Hi,

OK, I've done it, thank you very much!
It works and a result is correct, but.. many messages as following:
Resource for org.eclipse.emf.ecore.impl.EClassImpl@1c9b9ca (eProxyURI: platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement) is null; cannot be referenced
are shown at console.

I suppose this is caused by some problem with my ATL file. Maybe the same reason cause the following warnings that are shown during ordinary ATL file launching:
Metamodel contains several classifiers with same name: ETypeParameter
Metamodel contains several classifiers with same name: ecore::ETypeParameter
(There are many warnings like that.)

But, once more, it works and the result is correct.

Just in case you have ever had problems like that.. Do you have any thoughts?
Re: [ATL] Launch atl transformations programmatically [message #692921 is a reply to message #692891] Tue, 05 July 2011 13:31 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Sorry but I can't help you for this question. I am still a noob to ATL... Smile

Try asking this question in a new topic!

Regards.
Re: [ATL] Launch atl transformations programmatically [message #692927 is a reply to message #692921] Tue, 05 July 2011 13:35 Go to previous message
Yulia B is currently offline Yulia BFriend
Messages: 16
Registered: June 2011
Junior Member
Thank you in any case! Smile
Previous Topic:[QVTo] Blackbox example - Cannot find imported compilation unit
Next Topic:[ATL] Profile and Stereotype Application in Target Model
Goto Forum:
  


Current Time: Sat Nov 29 10:04:22 GMT 2014

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

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