|
Re: [QVTO] How to call different mappings based on some predicate? [message #490844 is a reply to message #490594] |
Sun, 11 October 2009 19:30 |
Eclipse User |
|
|
|
Originally posted by: dvorak.radek.gmail.com
Hi Tassilo,
See inlined comments.
Regards,
/Radek
>
> But I cannot figure out how to define the member2Person() mapping so
> that it dispatches to the right mapping. Reading the QVT spec, it looks
> to me that the disjuncts keyword is the thing I'm looking for. But
>
> --8<---------------cut here---------------start------------->8---
> mapping Member::member2Person() : Person
> disjuncts member2Female, member2Male() {}
> --8<---------------cut here---------------end--------------->8---
>
> shows errors becauso of "Unresolved mapping operation references" for
> member2Female and member2Male.
>
> What am I doing wrong?
Use qualified reference to mapping operations, like
disjuncts Member::member2Male, Member::member2Female {}
>
> And another minor question: In the QVT spec there seem to be a lot of
> syntactical constructs that won't work. For example, there often things
> like
>
> if (<predicate>) return 'Foo';
>
> are used, but it seems that in reality I need to write
>
> if (<predicate>) then return 'Foo' else return null elseif;
>
> so I cannot omit the then and else. Why is that difference?
You can do the following:
if (<predicate>) then
return 'Foo'
endif;
>
> Bye,
> Tassilo
|
|
|
|
Powered by
FUDForum. Page generated in 0.03111 seconds