Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] using QVTO on dynamic EMF models
[QVTO] using QVTO on dynamic EMF models [message #108705] Sun, 26 July 2009 04:20 Go to next message
Derek Palma is currently offline Derek PalmaFriend
Messages: 141
Registered: July 2009
Senior Member
Hi,

I am generating EMF models using the reflective API, not using code
generation. Other than this I just have a bunch of EMF models and their
packages and instances exist before the QVTO execution would ever happen. I
would like to use these models as input and output metamodels for
transformations. The final code as to run outside of Eclipse, i.e. I have to
be able to execute the transformations from a Java program. Also, I would
like to compile the QVTO source at runtime (because it can be generated
and/or changed in the field) so I need to be able to compile the source and
then execute the transformations on dynamic EMF models.

Would this be possible with QVTO as it stands today? I am just wondering if
there are any plug-in dependencies that would prevent me from doing what I
want.

Thanks in advance for your help.

Derek
Re: [QVTO] using QVTO on dynamic EMF models [message #108748 is a reply to message #108705] Mon, 27 July 2009 13:13 Go to previous messageGo to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Derek,

See some comments inlined.

Regards,
/Radek

On Sun, 26 Jul 2009 06:20:11 +0200, Derek Palma <derek.palma@gmail.com>
wrote:

> Hi,
>
> I am generating EMF models using the reflective API, not using code
> generation. Other than this I just have a bunch of EMF models and their
> packages and instances exist before the QVTO execution would ever happen.

QVTo can operate on both dynamic models and those that conform to
metamodels
in the global package registry.
The main usecase for dynamic models we have considered is the
transformation
development time, in which case the metamodel is often defined at the same
time
as the transformation.
Once developed, the transformation gets deployed, referenced metamodels
typically
get published via the global package registry, IOW made automatically
available to QVTo.

> I would like to use these models as input and output metamodels for
> transformations. The final code as to run outside of Eclipse, i.e. I
> have to
> be able to execute the transformations from a Java program. Also, I would
> like to compile the QVTO source at runtime (because it can be generated
> and/or changed in the field) so I need to be able to compile the source
> and
> then execute the transformations on dynamic EMF models.

We are not ready to execute outside Eclipse yet and will provide this
feature
in the upcoming Helios release. The recently released QVTo implementation
(in Galileo) still imposes Eclipse dependency.

Yes, you can compile and execute qvto sripts on the fly at runtime. More
precisely,
this is the only option with the latest release. In Helios, compiled QVTo
XMI
will be possible to execute.

In case you have no requirement to stick with the released QVTo version,
this functionality
should be available soon in the Helios dev stream.

>
> Would this be possible with QVTO as it stands today? I am just wondering
> if
> there are any plug-in dependencies that would prevent me from doing what
> I
> want.
>
> Thanks in advance for your help.
>
> Derek
>
Re: [QVTO] using QVTO on dynamic EMF models [message #108762 is a reply to message #108748] Mon, 27 July 2009 14:50 Go to previous messageGo to next message
Derek Palma is currently offline Derek PalmaFriend
Messages: 141
Registered: July 2009
Senior Member
Hi Raddek,

Thanks for the detailed answer.

I have just a few clarifications:

1) It sounds like it is not possible to modify QVTo tranformations after
development time. My specific use case requires that I be able to add/edit
transformtation to applied to my models in field (after development time).
So based on your answer I will conclude this feature is not supported nor is
planned. Is is this absolutely correct?

2) What is the general time frame for availablility of the QVTo code for
execution outside eclipse? Specifically, when do you think I could try it?

Thanks,
Derek


"Radek Dvorak" <radek.dvorak@borland.com> wrote in message
news:op.uxp9pgbahj1a1g@czprl-rdvorak2.emea.borl.net...
> Hi Derek,
>
> See some comments inlined.
>
> Regards,
> /Radek
>
> On Sun, 26 Jul 2009 06:20:11 +0200, Derek Palma <derek.palma@gmail.com>
> wrote:
>
>> Hi,
>>
>> I am generating EMF models using the reflective API, not using code
>> generation. Other than this I just have a bunch of EMF models and their
>> packages and instances exist before the QVTO execution would ever happen.
>
> QVTo can operate on both dynamic models and those that conform to
> metamodels
> in the global package registry.
> The main usecase for dynamic models we have considered is the
> transformation
> development time, in which case the metamodel is often defined at the same
> time
> as the transformation.
> Once developed, the transformation gets deployed, referenced metamodels
> typically
> get published via the global package registry, IOW made automatically
> available to QVTo.
>
>> I would like to use these models as input and output metamodels for
>> transformations. The final code as to run outside of Eclipse, i.e. I
>> have to
>> be able to execute the transformations from a Java program. Also, I would
>> like to compile the QVTO source at runtime (because it can be generated
>> and/or changed in the field) so I need to be able to compile the source
>> and
>> then execute the transformations on dynamic EMF models.
>
> We are not ready to execute outside Eclipse yet and will provide this
> feature
> in the upcoming Helios release. The recently released QVTo implementation
> (in Galileo) still imposes Eclipse dependency.
>
> Yes, you can compile and execute qvto sripts on the fly at runtime. More
> precisely,
> this is the only option with the latest release. In Helios, compiled QVTo
> XMI
> will be possible to execute.
>
> In case you have no requirement to stick with the released QVTo version,
> this functionality
> should be available soon in the Helios dev stream.
>
>>
>> Would this be possible with QVTO as it stands today? I am just wondering
>> if
>> there are any plug-in dependencies that would prevent me from doing what
>> I
>> want.
>>
>> Thanks in advance for your help.
>>
>> Derek
>>
>
Re: [QVTO] using QVTO on dynamic EMF models [message #264958 is a reply to message #108762] Mon, 27 July 2009 21:36 Go to previous messageGo to next message
Derek Palma is currently offline Derek PalmaFriend
Messages: 141
Registered: July 2009
Senior Member
Hi Raddek,

Please disregard my comment 1) in the previous message. I was focused on the
wrong text when I wrote it. Sorry!

It should be:
1) Where is the best code example for calling QVTo from java on an abitrary
transformation?

I presume I just need to register my dynamically generated EMF models before
I invoke the transformation (like any EMF model).

Item 2 has not changed:

2) What is the general time frame for availablility of the QVTo code for
execution outside eclipse? Specifically, when do you think I could try it?

Thanks very much for your help.
Derek


"Derek Palma" <derek.palma@gmail.com> wrote in message
news:h4kes2$92i$1@build.eclipse.org...
> Hi Raddek,
>
> Thanks for the detailed answer.
>
> I have just a few clarifications:
>
> 1) It sounds like it is not possible to modify QVTo tranformations after
> development time. My specific use case requires that I be able to add/edit
> transformtation to applied to my models in field (after development time).
> So based on your answer I will conclude this feature is not supported nor
> is planned. Is is this absolutely correct?
>
> 2) What is the general time frame for availablility of the QVTo code for
> execution outside eclipse? Specifically, when do you think I could try it?
>
> Thanks,
> Derek
>
>
> "Radek Dvorak" <radek.dvorak@borland.com> wrote in message
> news:op.uxp9pgbahj1a1g@czprl-rdvorak2.emea.borl.net...
>> Hi Derek,
>>
>> See some comments inlined.
>>
>> Regards,
>> /Radek
>>
>> On Sun, 26 Jul 2009 06:20:11 +0200, Derek Palma <derek.palma@gmail.com>
>> wrote:
>>
>>> Hi,
>>>
>>> I am generating EMF models using the reflective API, not using code
>>> generation. Other than this I just have a bunch of EMF models and their
>>> packages and instances exist before the QVTO execution would ever
>>> happen.
>>
>> QVTo can operate on both dynamic models and those that conform to
>> metamodels
>> in the global package registry.
>> The main usecase for dynamic models we have considered is the
>> transformation
>> development time, in which case the metamodel is often defined at the
>> same time
>> as the transformation.
>> Once developed, the transformation gets deployed, referenced metamodels
>> typically
>> get published via the global package registry, IOW made automatically
>> available to QVTo.
>>
>>> I would like to use these models as input and output metamodels for
>>> transformations. The final code as to run outside of Eclipse, i.e. I
>>> have to
>>> be able to execute the transformations from a Java program. Also, I
>>> would
>>> like to compile the QVTO source at runtime (because it can be generated
>>> and/or changed in the field) so I need to be able to compile the source
>>> and
>>> then execute the transformations on dynamic EMF models.
>>
>> We are not ready to execute outside Eclipse yet and will provide this
>> feature
>> in the upcoming Helios release. The recently released QVTo implementation
>> (in Galileo) still imposes Eclipse dependency.
>>
>> Yes, you can compile and execute qvto sripts on the fly at runtime. More
>> precisely,
>> this is the only option with the latest release. In Helios, compiled QVTo
>> XMI
>> will be possible to execute.
>>
>> In case you have no requirement to stick with the released QVTo version,
>> this functionality
>> should be available soon in the Helios dev stream.
>>
>>>
>>> Would this be possible with QVTO as it stands today? I am just wondering
>>> if
>>> there are any plug-in dependencies that would prevent me from doing what
>>> I
>>> want.
>>>
>>> Thanks in advance for your help.
>>>
>>> Derek
>>>
>>
>
Re: [QVTO] using QVTO on dynamic EMF models [message #277799 is a reply to message #264958] Mon, 27 July 2009 22:24 Go to previous messageGo to next message
Derek Palma is currently offline Derek PalmaFriend
Messages: 141
Registered: July 2009
Senior Member
I found some code to run a transformation from Java in an earlier posting
and tweaked it for my purpose which addressed my question in the previous
message. I included it below. It raised a few questions:

I was wondering what the assumptions are regarding the package registries.
For EPackages referenced by the transformation which are not available in
the input resource, where does the QVT runtime look for packages when it
executes the transformation. I guess it would be the workspace registry
(???) Since my models are dynamically generated (outside of a plugin) and
need to make sure I make them available for the tranformation when I run it
within Eclipse.

Another issue also about EPackge resolution but from inside the QVT editor.
From the MetaModel Explorer I can see all my .ecore models under the
'workspace' sub tree. However, the QVT editor does not seem to pick these up
in the 'modeltype' statement. Is there a way I can register these so QVT
editor can see them without writing a just to do this plug-in (the only way
I know) ?

Thanks,
Derek

import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.common.util.BasicDiagnostic;
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.m2m.qvt.oml.BasicModelExtent;
import org.eclipse.m2m.qvt.oml.ExecutionContextImpl;
import org.eclipse.m2m.qvt.oml.ExecutionDiagnostic;
import org.eclipse.m2m.qvt.oml.ModelExtent;
import org.eclipse.m2m.qvt.oml.TransformationExecutor;

public class QVTHelper {

public static void transform(URI transformationURI, Resource inputResource,
Resource outputResource) {

TransformationExecutor executor = new
TransformationExecutor(transformationURI);

ModelExtent input = new BasicModelExtent(inputResource.getContents());
ModelExtent output = new BasicModelExtent();

ExecutionContextImpl context = new ExecutionContextImpl();
ExecutionDiagnostic diagnostic = executor.execute(context, input, output);

if(diagnostic.getSeverity() == Diagnostic.OK) {
outputResource.getContents().addAll(output.getContents());
} else {
IStatus status = BasicDiagnostic.toIStatus(diagnostic);
// InvokeActivator.getDefault().getLog().log(status);
}
}
}


"Derek Palma" <derek.palma@gmail.com> wrote in message
news:h4l6lm$7h2$1@build.eclipse.org...
> Hi Raddek,
>
> Please disregard my comment 1) in the previous message. I was focused on
> the wrong text when I wrote it. Sorry!
>
> It should be:
> 1) Where is the best code example for calling QVTo from java on an
> abitrary transformation?
>
> I presume I just need to register my dynamically generated EMF models
> before I invoke the transformation (like any EMF model).
>
> Item 2 has not changed:
>
> 2) What is the general time frame for availablility of the QVTo code for
> execution outside eclipse? Specifically, when do you think I could try it?
>
> Thanks very much for your help.
> Derek
>
>
> "Derek Palma" <derek.palma@gmail.com> wrote in message
> news:h4kes2$92i$1@build.eclipse.org...
>> Hi Raddek,
>>
>> Thanks for the detailed answer.
>>
>> I have just a few clarifications:
>>
>> 1) It sounds like it is not possible to modify QVTo tranformations after
>> development time. My specific use case requires that I be able to
>> add/edit transformtation to applied to my models in field (after
>> development time). So based on your answer I will conclude this feature
>> is not supported nor is planned. Is is this absolutely correct?
>>
>> 2) What is the general time frame for availablility of the QVTo code for
>> execution outside eclipse? Specifically, when do you think I could try
>> it?
>>
>> Thanks,
>> Derek
>>
>>
>> "Radek Dvorak" <radek.dvorak@borland.com> wrote in message
>> news:op.uxp9pgbahj1a1g@czprl-rdvorak2.emea.borl.net...
>>> Hi Derek,
>>>
>>> See some comments inlined.
>>>
>>> Regards,
>>> /Radek
>>>
>>> On Sun, 26 Jul 2009 06:20:11 +0200, Derek Palma <derek.palma@gmail.com>
>>> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am generating EMF models using the reflective API, not using code
>>>> generation. Other than this I just have a bunch of EMF models and their
>>>> packages and instances exist before the QVTO execution would ever
>>>> happen.
>>>
>>> QVTo can operate on both dynamic models and those that conform to
>>> metamodels
>>> in the global package registry.
>>> The main usecase for dynamic models we have considered is the
>>> transformation
>>> development time, in which case the metamodel is often defined at the
>>> same time
>>> as the transformation.
>>> Once developed, the transformation gets deployed, referenced metamodels
>>> typically
>>> get published via the global package registry, IOW made automatically
>>> available to QVTo.
>>>
>>>> I would like to use these models as input and output metamodels for
>>>> transformations. The final code as to run outside of Eclipse, i.e. I
>>>> have to
>>>> be able to execute the transformations from a Java program. Also, I
>>>> would
>>>> like to compile the QVTO source at runtime (because it can be generated
>>>> and/or changed in the field) so I need to be able to compile the source
>>>> and
>>>> then execute the transformations on dynamic EMF models.
>>>
>>> We are not ready to execute outside Eclipse yet and will provide this
>>> feature
>>> in the upcoming Helios release. The recently released QVTo
>>> implementation
>>> (in Galileo) still imposes Eclipse dependency.
>>>
>>> Yes, you can compile and execute qvto sripts on the fly at runtime. More
>>> precisely,
>>> this is the only option with the latest release. In Helios, compiled
>>> QVTo XMI
>>> will be possible to execute.
>>>
>>> In case you have no requirement to stick with the released QVTo version,
>>> this functionality
>>> should be available soon in the Helios dev stream.
>>>
>>>>
>>>> Would this be possible with QVTO as it stands today? I am just
>>>> wondering if
>>>> there are any plug-in dependencies that would prevent me from doing
>>>> what I
>>>> want.
>>>>
>>>> Thanks in advance for your help.
>>>>
>>>> Derek
>>>>
>>>
>>
>
Re: [QVTO] using QVTO on dynamic EMF models [message #372754 is a reply to message #264958] Wed, 29 July 2009 10:54 Go to previous messageGo to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Derek,

Sorry for the late response.
See responses inlined, hopefully it helps.

Regards,
/Radek

> It should be:
> 1) Where is the best code example for calling QVTo from java on an
> abitrary transformation?

http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava

>
> I presume I just need to register my dynamically generated EMF models
> before I invoke the transformation (like any EMF model).
>

For solving this issue with QVTo 2.0 release,
see https://bugs.eclipse.org/bugs/show_bug.cgi?id=284989

Yes, you have to provide your custom EPackage registry in which you
populate
the metamodel packages loaded from the workspace

>
> 2) What is the general time frame for availablility of the QVTo code for
> execution outside eclipse? Specifically, when do you think I could try
> it?

I assume the end of Sept. We still have to define our plan in details.



> Thanks very much for your help.
> Derek
>
>
> "Derek Palma" <derek.palma@gmail.com> wrote in message
> news:h4kes2$92i$1@build.eclipse.org...
>> Hi Raddek,
>>
>> Thanks for the detailed answer.
>>
>> I have just a few clarifications:
>>
>> 1) It sounds like it is not possible to modify QVTo tranformations
>> after development time. My specific use case requires that I be able to
>> add/edit transformtation to applied to my models in field (after
>> development time). So based on your answer I will conclude this feature
>> is not supported nor is planned. Is is this absolutely correct?
>>
>> 2) What is the general time frame for availablility of the QVTo code
>> for execution outside eclipse? Specifically, when do you think I could
>> try it?
>>
>> Thanks,
>> Derek
>>
>>
>> "Radek Dvorak" <radek.dvorak@borland.com> wrote in message
>> news:op.uxp9pgbahj1a1g@czprl-rdvorak2.emea.borl.net...
>>> Hi Derek,
>>>
>>> See some comments inlined.
>>>
>>> Regards,
>>> /Radek
>>>
>>> On Sun, 26 Jul 2009 06:20:11 +0200, Derek Palma
>>> <derek.palma@gmail.com> wrote:
>>>
>>>> Hi,
>>>>
>>>> I am generating EMF models using the reflective API, not using code
>>>> generation. Other than this I just have a bunch of EMF models and
>>>> their
>>>> packages and instances exist before the QVTO execution would ever
>>>> happen.
>>>
>>> QVTo can operate on both dynamic models and those that conform to
>>> metamodels
>>> in the global package registry.
>>> The main usecase for dynamic models we have considered is the
>>> transformation
>>> development time, in which case the metamodel is often defined at the
>>> same time
>>> as the transformation.
>>> Once developed, the transformation gets deployed, referenced
>>> metamodels typically
>>> get published via the global package registry, IOW made automatically
>>> available to QVTo.
>>>
>>>> I would like to use these models as input and output metamodels for
>>>> transformations. The final code as to run outside of Eclipse, i.e. I
>>>> have to
>>>> be able to execute the transformations from a Java program. Also, I
>>>> would
>>>> like to compile the QVTO source at runtime (because it can be
>>>> generated
>>>> and/or changed in the field) so I need to be able to compile the
>>>> source and
>>>> then execute the transformations on dynamic EMF models.
>>>
>>> We are not ready to execute outside Eclipse yet and will provide this
>>> feature
>>> in the upcoming Helios release. The recently released QVTo
>>> implementation
>>> (in Galileo) still imposes Eclipse dependency.
>>>
>>> Yes, you can compile and execute qvto sripts on the fly at runtime.
>>> More precisely,
>>> this is the only option with the latest release. In Helios, compiled
>>> QVTo XMI
>>> will be possible to execute.
>>>
>>> In case you have no requirement to stick with the released QVTo
>>> version, this functionality
>>> should be available soon in the Helios dev stream.
>>>
>>>>
>>>> Would this be possible with QVTO as it stands today? I am just
>>>> wondering if
>>>> there are any plug-in dependencies that would prevent me from doing
>>>> what I
>>>> want.
>>>>
>>>> Thanks in advance for your help.
>>>>
>>>> Derek
>>>>
>>>
>>
>
Re: [QVTO] using QVTO on dynamic EMF models [message #372842 is a reply to message #277799] Wed, 29 July 2009 11:11 Go to previous message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
See my comments.

> I found some code to run a transformation from Java in an earlier
> posting and tweaked it for my purpose which addressed my question in the
> previous message. I included it below. It raised a few questions:
>
> I was wondering what the assumptions are regarding the package
> registries. For EPackages referenced by the transformation which are not
> available in the input resource, where does the QVT runtime look for
> packages when it executes the transformation. I guess it would be the
> workspace registry (???) Since my models are dynamically generated
> (outside of a plugin) and need to make sure I make them available for
> the tranformation when I run it within Eclipse.

Should have been answered in one of my other posts in this thread.

>
> Another issue also about EPackge resolution but from inside the QVT
> editor. From the MetaModel Explorer I can see all my .ecore models under
> the 'workspace' sub tree. However, the QVT editor does not seem to pick
> these up in the 'modeltype' statement. Is there a way I can register
> these so QVT editor can see them without writing a just to do this
> plug-in (the only way I know) ?

You need to register the ecore file in your QVT project property page,
at 'QVT Settings/Metamodel Mappings'.
Previous Topic:[ATL] how to navigate in 2 source models of the same metamodel?
Next Topic:How to generate ATL (ecore) model from ATL file
Goto Forum:
  


Current Time: Wed Feb 05 18:56:47 GMT 2025

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

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

Back to the top