Transformations chaining for inout model [message #1250785] |
Wed, 19 February 2014 10:53  |
Eclipse User |
|
|
|
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 12:41   |
Eclipse User |
|
|
|
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 12:47] by Moderator
|
|
|
Re: Transformations chaining for inout model [message #1250965 is a reply to message #1250878] |
Wed, 19 February 2014 14:40   |
Eclipse User |
|
|
|
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 04:05   |
Eclipse User |
|
|
|
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 #1258589 is a reply to message #1258557] |
Thu, 27 February 2014 09:45  |
Eclipse User |
|
|
|
Naif Mokhayesh wrote on Thu, 27 February 2014 09:02Hi 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.
|
|
|
Powered by
FUDForum. Page generated in 0.05831 seconds