[QVTo] when condition in abstract mapping [message #794563] |
Thu, 09 February 2012 07:52  |
Eclipse User |
|
|
|
Being new to QVTo, I was creating a MTM transformation using the following concept:
abstract mapping InModel::InType::Transformation() : OutModel::OutType
when { Condition } {
DoSomethingUsefull
}
mapping InModel::InInheritedType1::Transformation1() : OutModel::OutInheritedType1
inherits InModel::InType::Transformation() {
DoSomeExtraThings1
}
mapping InModel::InInheritedType2::Transformation2() : OutModel::OutInheritedType2
inherits InModel::InType::Transformation() {
DoSomeExtraThings2
}
My expectation was that objects of OutModel::OutInheritedType1
and OutModel::OutInheritedType2 would not be created in case the Condition for the respective input objects does not hold. Instead, the objects are created but none of the DoSome... pieces are executed. Is this what I should be expecting?
To resolve the situation into what I wanted, I had to move© the Condition to the non-abstract mappings as follows:
abstract mapping InModel::InType::Transformation() : OutModel::OutType {
DoSomethingUsefull
}
mapping InModel::InInheritedType1::Transformation1() : OutModel::OutInheritedType1
inherits InModel::InType::Transformation()
when { Condition } {
DoSomeExtraThings1
}
mapping InModel::InInheritedType2::Transformation2() : OutModel::OutInheritedType2
inherits InModel::InType::Transformation()
when { Condition } {
DoSomeExtraThings2
}
I am actually looking for a good reference that explains the syntax and semantics of all QVTo primitives. Any suggestions?
|
|
|
|
|
Re: [QVTo] when condition in abstract mapping [message #795370 is a reply to message #795302] |
Fri, 10 February 2012 06:42  |
Eclipse User |
|
|
|
Hi Bart
With QVT, you are rather at the cutting edge and so you always need to
consider
is the programmer's expectation wrong
is the programmer's exposition wrong
is the QVTo tool wrong
is the QVTo specification wrong
I've certainly found areas that I find suspect in the tool and vague at
best in the specification. I therefore use a subset of the capabilities
that I'm comfortable with.
Where you think that the specification is inadequate you can submit an
issue to issues@omg.org, prefixing the messages with e.g. QVT 1.1 8.2
..... to identify that clause 8.2 is the target of your comment.
I hope that some progress will be made in the next few years so that
QVTo and r and c all start to improve. Perhaps you would like to join
the effort...
Regards
Ed Willink
On 10/02/2012 10:00, Bart Theelen wrote:
> Thanks for the pointer to the specification, but unfortunately it does
> not seem to explain the sketched case. I did find something about
> using xmap instead of map when calling the mapping functions, but that
> makes no difference.
>
> I would however like to understand why my intuition is wrong. I think
> that I basically expected that the following piece of code:
>
>
> abstract mapping InModel::InType::Transformation() : OutModel::OutType
> when { Condition 1 } {
> DoSomethingUsefull
> }
>
> mapping InModel::InInheritedType::TransformationX() :
> OutModel::OutInheritedType
> inherits InModel::InType::Transformation()
> when { Condition 2 } {
> DoSomeExtraThings
> }
>
>
> is semantically equivalent to this piece of code:
>
>
> mapping InModel::InInheritedType::TransformationY() :
> OutModel::OutInheritedType
> when { Condition1 and Condition2 } {
> DoSomethingUsefull;
> DoSomeExtraThings
> }
>
>
> But apparently I am wrong or I used the wrong constructs? Any ideas?
|
|
|
Powered by
FUDForum. Page generated in 0.03713 seconds