Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTo] Standalone transformation
[QVTo] Standalone transformation [message #524713] Fri, 02 April 2010 00:15 Go to next message
PBarendrecht is currently offline PBarendrechtFriend
Messages: 36
Registered: November 2009
Location: Eindhoven, Netherlands
Member
Hi all,

I've been working on a transformation for quite some time, it is finally finished. Now I would like to write a Java program that transforms any input-model to an output model by using my transform.qvto file.

I read somewhere on the Forums this should be possible. I looked at a few pages:
http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava
http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F

My knowledge about Java is very basic: I just use a text editor like notepad to write simple main-classes and compile them with javac in a terminal.

From the above links I understood I have to include several Jar files:

Quote:
org.eclipse.emf.ecore_2.6.0.v200912121603.jar
org.eclipse.emf.common_2.6.0.v200912121603.jar
org.eclipse.emf.ecore.xmi_2.5.0.v200912121603.jar
net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar
org.eclipse.ocl_3.0.0.v200912161120.jar
org.eclipse.ocl.ecore_3.0.0.v200912161120.jar
-- QVTo jars ----------
org.eclipse.m2m.qvt.oml
org.eclipse.m2m.qvt.oml.common
org.eclipse.m2m.qvt.oml.cst.parser
org.eclipse.m2m.qvt.oml.emf.util
org.eclipse.m2m.qvt.oml.ecore.imperativeocl

However, my ecore.jar version is "org.eclipse.emf.ecore_2.5.0.v200906151043.jar" (I just updated Eclipse by clicking Help -> Check for Updates)?
Furthermore, how can I include those files? When I use "import ...jar" it doesn't work.

Next, I could write the transformation call by using the TransformationExecutor class. I have to refer to the qvto file and specify locations for input- and output files. Is it possible to parametrize this information? I would like to be able to use arguments in the terminal and specify which input model to use.

Finally the used meta-models must be registered in some way, but I don't understand how I should do this.

I hope somebody can provide me with a basic example and some explanation Smile
Re: [QVTo] Standalone transformation [message #524950 is a reply to message #524713] Sun, 04 April 2010 17:00 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi PBarendrecht ,

Comments are in-lined below.

Regards,
Sergey.


PBarendrecht wrote:
> Hi all,
>
> I've been working on a transformation for quite some time, it is finally
> finished. Now I would like to write a Java program that transforms any
> input-model to an output model by using my transform.qvto file.
>
> I read somewhere on the Forums this should be possible. I looked at a
> few pages:
> http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava
> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F
>
>
> My knowledge about Java is very basic: I just use a text editor like
> notepad to write simple main-classes and compile them with javac in a
> terminal.
>
> From the above links I understood I have to include several Jar files:
>
> Quote:
>> org.eclipse.emf.ecore_2.6.0.v200912121603.jar
>> org.eclipse.emf.common_2.6.0.v200912121603.jar
>> org.eclipse.emf.ecore.xmi_2.5.0.v200912121603.jar
>> net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar
>> org.eclipse.ocl_3.0.0.v200912161120.jar
>> org.eclipse.ocl.ecore_3.0.0.v200912161120.jar
>> -- QVTo jars ----------
>> org.eclipse.m2m.qvt.oml
>> org.eclipse.m2m.qvt.oml.common
>> org.eclipse.m2m.qvt.oml.cst.parser
>> org.eclipse.m2m.qvt.oml.emf.util
>> org.eclipse.m2m.qvt.oml.ecore.imperativeocl

You have mixed up two different topics - (1) running QVTo transformation
as standalone application and (2) ordinary execution of QVTo
transformation from Java source.

I suppose your case is (2). Then you should create Java plug-in in your
Eclipse workspace and put Java code for QVTo invocation (mentioned in
http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava) in some Java method.

As I already wrote to you in email there's perfect complete example of
such task in "org.eclipse.m2m.qvt.oml.econ2009.tutorial" plug-in.
Eclipse CVS:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org .eclipse.qvtoml/examples/org.eclipse.m2m.qvt.oml.econ2009.tu torial/?root=Modeling_Project

Handy way for using that tutorial:
- check out tutorial plug-in from CVS to workspace
- launch new Eclipse instance
- call "New Other.." (Ctrl+N) wizard and browse for "QVT Operationl
EclipseCon2009 Tutorial" located in "QVT Operational Tutorials" folder


>
> However, my ecore.jar version is
> "org.eclipse.emf.ecore_2.5.0.v200906151043.jar" (I just updated Eclipse
> by clicking Help -> Check for Updates)?
> Furthermore, how can I include those files? When I use "import ...jar"
> it doesn't work.
>
> Next, I could write the transformation call by using the
> TransformationExecutor class. I have to refer to the qvto file and
> specify locations for input- and output files. Is it possible to
> parametrize this information? I would like to be able to use arguments
> in the terminal and specify which input model to use.

Yes, it's possible. Try the sample from
"org.eclipse.m2m.qvt.oml.econ2009.tutorial".

>
> Finally the used meta-models must be registered in some way, but I don't
> understand how I should do this.

Just create your metamodel and generate Java-code for it. Then in new
Eclipse instance it'll be accessible just like Ecore or UML models.

>
> I hope somebody can provide me with a basic example and some explanation :)
Re: [QVTo] Standalone transformation [message #525239 is a reply to message #524950] Mon, 05 April 2010 19:28 Go to previous messageGo to next message
PBarendrecht is currently offline PBarendrechtFriend
Messages: 36
Registered: November 2009
Location: Eindhoven, Netherlands
Member
Hi Sergey,

Thanks for your reply. I completely overlooked the part about Java in your e-mail, I'm sorry.

I'm not sure how I should use the mentioned plug-in. When I create a .editor of an own model in Eclipse, I can right-click it and choose "Run As -> Eclipse Application". However, when I right-click the tutorial directory or any subdirectory, this option isn't available, neither is it in the "new -> Other" window.

Furthermore, I'm not sure I understand the difference between the Java plug-in and a standalone. Isn't it possible to create a standalone Java application (by including the used JAR files)?

The intention is that I can use the terminal to transform models conforming to a certain meta-model, for example like this:

java -jar Transform.jar -t MyTransformation.qvto -i inputmodel -o outputmodel -p parameter1=value,parameter2=value


I know I have to include the meta-models in some kind of Java format, but it would be nice to have a "flexible transformation (qvto) file", i.e. the possibility to slightly change the transformation (but of course still use the same included meta-models).

Is this possible?

[Updated on: Mon, 05 April 2010 19:33]

Report message to a moderator

Re: [QVTo] Standalone transformation [message #559447 is a reply to message #525239] Thu, 16 September 2010 15:58 Go to previous messageGo to next message
Macca1892 is currently offline Macca1892Friend
Messages: 14
Registered: May 2010
Junior Member
Hi PBarendrecht ,

If you have not given up, I hope that I can give you some clue

You just need to create a new Eclipse plugin project, say HelloWorld. Some examples:
http://www.eclipse.org/articles/Article-Your%20First%20Plug- in/YourFirstPlugin.html
http://www.ibm.com/developerworks/library/os-ecplug/

Then, use some part of the code in qvto.ecore2uml.invoke of "org.eclipse.m2m.qvt.oml.econ2009.tutorial", for using TransformationExecutor

Run your edited HelloWorld eclipse plugin

I think it is necessary to create an Eclipse plugin in order to use the TransformationExecutor because the URIs of your local files can only be referred to in runtim of an Eclipse plugin

Hope that helps
Re: [QVTo] Standalone transformation [message #723005 is a reply to message #559447] Wed, 07 September 2011 12:14 Go to previous message
Cindy  is currently offline Cindy Friend
Messages: 59
Registered: May 2011
Member
Hey have you got the solution of this problem? could you give me some clue if so? i have been trapped by this for several days:(
Previous Topic:[ATL]: how do you debug you transformations
Next Topic:[QVT] Replacing entities in a transformation
Goto Forum:
  


Current Time: Fri Mar 29 04:43:02 GMT 2024

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