Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Transformations chaining for inout model(passing the updated model (inout) in calling another transformation )
Transformations chaining for inout model [message #1250785] Wed, 19 February 2014 15:53 Go to next message
Naif Mokhayesh is currently offline Naif Mokhayesh
Messages: 31
Registered: November 2011
Member
Hi,

In transformations chaining example I have mainModel as inout model that get modified in two phases. When I ran chainTransformation it first call transformation1 by passing original version of mainModel (inout) for refactoring and then in the next step transformation2 get called and we pass modified version of mainModel in the previous transformation (transformation1) and model2.

what I notice is that in both calling of transformation1 and transformation2 the chainTransformation will pass the original copy of the (inout) mainModel. In other word, when we call transformation2 and pass mainModel it should pass the updated model from transformation1 not the original one ! but in fact it ignores the results for transformation1 on (inout) mainModel

I do not know if I'm using transformations chaining correctly for in-place transformation or not.

Please advice

sample code ...

import transformation1;
import transformation2;

modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';

transformation chainTransformation( inout mainModel : UML, in model1 : UML, in model2 : UML)
	access transformation transformation1
	access transformation transformation2;

main() {

	 new transformation1(mainModel, model1).transform();
	
         -- do something .....

         new transformation2(mainModel , model2).transform();   // the passed mainModel here should be the updated one from transformation1.... but in the execution it passes the original loaded one !!
}

Re: Transformations chaining for inout model [message #1250851 is a reply to message #1250785] Wed, 19 February 2014 17:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

How it works will certainly depend on the model parameter directions of
transformation1 and transformation2 that you have not supplied.

I wasn't aware that this was possible and my own experiences with
in-place were disappointing.

However QVTo is now being actively maintained so you might want to try
the latest Luna build; if still a problem attach a sample example
project to a Bugzilla.

Regards

Ed Willink


On 19/02/2014 15:53, Naif Mokhayesh wrote:
> Hi,
>
> In transformations chaining example I have mainModel as inout model
> that get modified in two phases. When I ran chainTransformation it
> first call transformation1 by passing original version of mainModel
> (inout) for refactoring and then in the next step transformation2 get
> called and we pass modified version of mainModel in the previous
> transformation (transformation1) and model2.
>
> what I notice is that in both calling of transformation1 and
> transformation2 the chainTransformation will pass the original copy of
> the (inout) mainModel. In other word, when we call transformation2 and
> pass mainModel it should pass the updated model from transformation1
> not the original one ! but in fact it ignores the results for
> transformation1 on (inout) mainModel
>
> I do not know if I'm using transformations chaining correctly for
> in-place transformation or not.
> Please advice
>
> sample code ...
>
>
> import transformation1;
> import transformation2;
>
> modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';
>
> transformation chainTransformation( inout mainModel : UML, in model1 :
> UML, in model2 : UML)
> access transformation transformation1
> access transformation transformation2;
>
> main() {
>
> new transformation1(mainModel, model1).transform();
>
> -- do something .....
>
> new transformation2(mainModel , model2).transform(); // the
> passed mainModel here should be the updated one from
> transformation1.... but in the execution it passes the original loaded
> one !!
> }
>
>
Re: Transformations chaining for inout model [message #1250878 is a reply to message #1250851] Wed, 19 February 2014 17:41 Go to previous messageGo to next message
Naif Mokhayesh is currently offline Naif Mokhayesh
Messages: 31
Registered: November 2011
Member
thanks Ed for your reply and cooperation

regarding to the transformation1 and transformation2 model parameters direction are as follow , sorry for not copy in the original message.

Im using latest version of qvto 3.4.0M5 (2014/01/29)

I doubt it is bug, maybe I'm doing something wrong that is not following the execution flow of transformation chaining ! correct me please if I'm wrong

please advice

import transformation1;
import transformation2;

modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';

transformation chainTransformation( inout mainModel : UML, in model1 : UML, in model2 : UML)
	access transformation transformation1
	access transformation transformation2;

main() {

	 new transformation1(mainModel, model1).transform();
	
         -- do something .....

         new transformation2(mainModel , model2).transform();   // the passed mainModel here should be the updated one from transformation1.... but in the execution it passes the original loaded one !!
}





// In-Place transformation
transformation transformation1(inout mainModel : UML, in model1  : UML);



the result of transformation1 modified the passed inout model. Now chainTransformation will call transformation2 and pass the resulted inout model from transformation1


// updatedModel here is the result of transformation1
transformation transformation2( inout updatedModel : UML, in model2  : UML);



[Updated on: Wed, 19 February 2014 17:47]

Report message to a moderator

Re: Transformations chaining for inout model [message #1250965 is a reply to message #1250878] Wed, 19 February 2014 19:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4046
Registered: July 2009
Senior Member
Hi

It looks sensible to me; raise a Bugzilla.

Regards

Ed Willink

On 19/02/2014 17:41, Naif Mokhayesh wrote:
> thanks Ed for your reply and cooperation
> regarding to the transformation1 and transformation2 model parameters
> direction are as follow , sorry for not copy in the original message.
> I doubt it is bug, maybe I'm doing something wrong that is not
> following the execution flow of transformation chaining !
>
> please advice
>
> import transformation1;
> import transformation2;
>
> modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';
>
> transformation chainTransformation( inout mainModel : UML, in model1 :
> UML, in model2 : UML)
> access transformation transformation1
> access transformation transformation2;
>
> main() {
>
> new transformation1(mainModel, model1).transform();
>
> -- do something .....
>
> new transformation2(mainModel , model2).transform(); // the
> passed mainModel here should be the updated one from
> transformation1.... but in the execution it passes the original loaded
> one !!
> }
>
>
>
>
>
>
> // In-Place transformation
> transformation transformation1(inout mainModel : UML, in model1 : UML);
>
>
>
> the result of transformation1 modified the passed inout model. Now
> chainTransformation will call transformation2 and pass the resulted
> inout model from transformation1
>
>
>
> // updatedModel here is the result of transformation1
> transformation transformation2( inout updatedModel : UML, in model2 :
> UML);
>
>
Re: Transformations chaining for inout model [message #1257296 is a reply to message #1250878] Wed, 26 February 2014 09:05 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey Boyko
Messages: 162
Registered: July 2009
Senior Member
Naif Mokhayesh wrote on Wed, 19 February 2014 12:41


Im using latest version of qvto 3.4.0M5 (2014/01/29)

I doubt it is bug, maybe I'm doing something wrong that is not following the execution flow of transformation chaining ! correct me please if I'm wrong



Hi Naif,

I've checked that transformation parameters are correctly updated inside and transferred between transformations chaining. There must be something wrong in the logic which is used to update 'mainModel' parameter inside transformation1().

Scripts I used:

import NewTransformation1;
import NewTransformation2;

modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';

transformation NewTransformation( inout mainModel : UML, in model1 : UML, in model2 : UML)
	access transformation NewTransformation1
	access transformation NewTransformation2;

main() {
	new NewTransformation1(mainModel, model1).transform();
	new NewTransformation2(mainModel , model2).transform();
}


modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';

transformation NewTransformation1(inout mainModel : UML, in model1  : UML);

main() {
	object Class@mainModel {name := "foo"};
}


modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';

transformation NewTransformation2(inout mainModel : UML, in model1  : UML);

main() {
	var c = mainModel.objects()[Class]->any(name = "foo");
	assert fatal (c <> null);
}



Regards,
Sergey.
Re: Transformations chaining for inout model [message #1258557 is a reply to message #1257296] Thu, 27 February 2014 14:02 Go to previous messageGo to next message
Naif Mokhayesh is currently offline Naif Mokhayesh
Messages: 31
Registered: November 2011
Member
Hi Sergey,

Yes you are absolutely right. I have try it last week without having any logic and works well and that is why i do not open Bugzilla request. However, In my case I'm still getting the wrong results because after calling and executing transformation1 I pass the mainModel URI (inout model) to black box code (java) that reads the URI and load the model in java and return results based on the transformation1 output. Now when I call transformation2 I notice the results of java code was not correct since it use the original mainModel not the output of transformation1.

I think (correct me if I'm wrong) the result of transformation1 applied on memory not on the physical uml file and it will be applied after finishing the transformation and all chains calls. Therefore, I have to pass mainModel instance to blackbox java code not the URI of the mainModel.

please advice

thanks a lot for cooperation Smile
Re: Transformations chaining for inout model [message #1258589 is a reply to message #1258557] Thu, 27 February 2014 14:45 Go to previous message
Sergey Boyko is currently offline Sergey Boyko
Messages: 162
Registered: July 2009
Senior Member
Naif Mokhayesh wrote on Thu, 27 February 2014 09:02
Hi Sergey,

Yes you are absolutely right. I have try it last week without having any logic and works well and that is why i do not open Bugzilla request. However, In my case I'm still getting the wrong results because after calling and executing transformation1 I pass the mainModel URI (inout model) to black box code (java) that reads the URI and load the model in java and return results based on the transformation1 output. Now when I call transformation2 I notice the results of java code was not correct since it use the original mainModel not the output of transformation1.

I think (correct me if I'm wrong) the result of transformation1 applied on memory not on the physical uml file and it will be applied after finishing the transformation and all chains calls. Therefore, I have to pass mainModel instance to blackbox java code not the URI of the mainModel.



Hi Naif,

You're absolutely right. All changes are made in memory and updating of physical file is performed only after the whole transformation (that is 'chainTransformation' in your case) finishes.

And you have to use 'mainModel' instance as the parameter for the black box function in order to operate on changed model.

Regards,
Sergey.
Previous Topic:QVTo code samples for project
Next Topic:Invalid transformation Problem
Goto Forum:
  


Current Time: Tue Sep 23 12:27:13 GMT 2014

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

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