Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Acces QVT-O transformations from other folders or plug-ins
Acces QVT-O transformations from other folders or plug-ins [message #990611] Thu, 13 December 2012 12:27 Go to next message
Dietrich Travkin is currently offline Dietrich TravkinFriend
Messages: 13
Registered: July 2009
Junior Member
Hello,

is there a way to access (call) a QVT-O transformation from within another transformation although the accessed transformation is in another directory or plug-in? I'd like to do something like the following

transformation MyCallingTransformation(inout model:MyModel)
	access transformation MyCalledTransformation(inout model:MyModel);


while MyCalledTransformation is in another directory in the Eclipse workspace and in another plug-in project. Can I use an URI like 'platform:/plugin/de.xyz.myplugin/transforms/MyCalledTransformation.qvto' or '../../de.xyz.myplugin/transforms/MyCalledTransformation.qvto' to access the transformation?

Best regards,
Dietrich
Re: Acces QVT-O transformations from other folders or plug-ins [message #990722 is a reply to message #990611] Thu, 13 December 2012 16:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The grammar suggests access uses an ordinary package name (a
transformation is both a package and a class).

In
\GIT\org.eclipse.qvto\tests\org.eclipse.m2m.tests.qvt.oml\parserTestData\models\transf_inheritance\A.qvto
you will find an example.

import models.transf_inheritance.Lib;
import models.transf_inheritance.nested.A;

modeltype ECORE uses ecore('http://www.eclipse.org/emf/2002/Ecore');

transformation A(inout m:ECORE)
extends transformation models::transf_inheritance::nested::A(inout
m:ECORE)
-- implicit library import with extension semantics of the 'Lib'
;

main() {
m.objectsOfType(ECORE::EClass)->forEach(c) { addSuffix(c); };
}

helper addSuffix(inout n : ECORE::ENamedElement) {
n.name := addSuffix(n.name);
return;
}


HTH

Ed Willink

On 13/12/2012 16:21, Dietrich Travkin wrote:
> Hello,
>
> is there a way to access (call) a QVT-O transformation from within
> another transformation although the accessed transformation is in
> another directory or plug-in? I'd like to do something like the following
>
>
> transformation MyCallingTransformation(inout model:MyModel)
> access transformation MyCalledTransformation(inout model:MyModel);
>
>
> while MyCalledTransformation is in another directory in the Eclipse
> workspace and in another plug-in project. Can I use an URI like
> 'platform:/plugin/de.xyz.myplugin/transforms/MyCalledTransformation.qvto'
> or '../../de.xyz.myplugin/transforms/MyCalledTransformation.qvto' to
> access the transformation?
>
> Best regards,
> Dietrich
Re: Acces QVT-O transformations from other folders or plug-ins [message #991527 is a reply to message #990722] Wed, 19 December 2012 16:57 Go to previous messageGo to next message
Dietrich Travkin is currently offline Dietrich TravkinFriend
Messages: 13
Registered: July 2009
Junior Member
Hi Ed,

thank you, that was the right hint. Now, I have another problem:

I'm trying to call a transformation within another transformation, but there seems to be no way to create an input model for the called transformation which is not empty, but contains a certain set of objects. My calling transformation looks something like the following:

import MyModel2Ecore;

modeltype Mapping uses ...

transformation CallingTransformation(inout inputMapping:Mapping)
	access transformation MyModel2Ecore(inout inputMapping:Mapping)
{
	main()
	{
		var inputObject:= inputMapping.rootObjects()![SomeRoot].applications->select(newInput: SomeType| newInput.name = 'Some Name')![SomeOtherType];
		
		// 1. idea: create an empty model and add the desired objects
		//var model : Mapping := design2PatternMapping.createEmptyModel().oclAsType(Mapping);
		// inputObject cannot be added to the empty model or set to be the root of the model

		// 2. idea: copy the given model end remove all elements, but the desired ones
		var model : Mapping := design2PatternMapping.copy().oclAsType(Mapping);
		
		// this seems to remove the root including all contained elements :-(
		// I only want to replace the root with another object that is contained in the root
		model.removeElement(model.rootObjects()![PatternApplications]);
		
		// call the transformation with the selected input object
		var retC := (new MyModel2Ecore(model))->transform();
	}
}


I wanted to use this calling transformation for debugging purposes. I want to debug the called transformation which is usually called by Java code with a selected set of objects as input model. When debugging the Java code of the plug-in, I cannot step into the executed QVT code for debugging. So, I decided to directly run the transformation and to use this calling transformation to select the input.

Regards,
Dietrich
Re: Acces QVT-O transformations from other folders or plug-ins [message #991536 is a reply to message #991527] Wed, 19 December 2012 17:15 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Sorry; no ideas other than to dive into the QVTo tooling code to find
out what is really happening at the root.

Regards

Ed Willink

On 19/12/2012 16:57, Dietrich Travkin wrote:
> Hi Ed,
>
> thank you, that was the right hint. Now, I have another problem:
>
> I'm trying to call a transformation within another transformation, but
> there seems to be no way to create an input model for the called
> transformation which is not empty, but contains a certain set of
> objects. My calling transformation looks something like the following:
>
>
> import MyModel2Ecore;
>
> modeltype Mapping uses ...
>
> transformation CallingTransformation(inout inputMapping:Mapping)
> access transformation MyModel2Ecore(inout inputMapping:Mapping)
> {
> main()
> {
> var inputObject:=
> inputMapping.rootObjects()![SomeRoot].applications->select(newInput:
> SomeType| newInput.name = 'Some Name')![SomeOtherType];
>
> // 1. idea: create an empty model and add the desired objects
> //var model : Mapping :=
> design2PatternMapping.createEmptyModel().oclAsType(Mapping);
> // inputObject cannot be added to the empty model or set to be
> the root of the model
>
> // 2. idea: copy the given model end remove all elements, but
> the desired ones
> var model : Mapping :=
> design2PatternMapping.copy().oclAsType(Mapping);
>
> // this seems to remove the root including all contained
> elements :-(
> // I only want to replace the root with another object that is
> contained in the root
> model.removeElement(model.rootObjects()![PatternApplications]);
>
> // call the transformation with the selected input object
> var retC := (new MyModel2Ecore(model))->transform();
> }
> }
>
>
> I wanted to use this calling transformation for debugging purposes. I
> want to debug the called transformation which is usually called by
> Java code with a selected set of objects as input model. When
> debugging the Java code of the plug-in, I cannot step into the
> executed QVT code for debugging. So, I decided to directly run the
> transformation and to use this calling transformation to select the
> input.
>
> Regards,
> Dietrich
Previous Topic:l'utilisation de qvt
Next Topic:For QVT-O EObject seems not to be supertype of EModelElement
Goto Forum:
  


Current Time: Fri Apr 19 21:06:11 GMT 2024

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

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

Back to the top