|
Re: [QVTo] - Relationships (ATL2QVTo) - The type {2} does not conform to the type {1} of the propert [message #719439 is a reply to message #719373] |
Sat, 27 August 2011 06:27 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Ed Willink![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=ed%40willink.me.uk) Messages: 7669 Registered: July 2009 |
Senior Member |
|
|
Hi
QVTo is primarily imperative (with a surprisingly declarative style).
[QVTr is declarative but lacking in good implementations.]
ATL is primarily declarative with optional imperative capabilities
so there is a fundamental difference in principle; declarative is often
more abstract/obscure; imperative is often more direct/explicit.
You haven't provided your meta-models, so I have to guess a bit
name := self.name;
is probably a String to String mapping, and so as a PrimitiveType, the
same value can be used untransformed for both input and output.
concept := self.owner; //This line has a error
is probably a Concept::Object to Uml::Object mapping and so needs to be
transformed. I've never found an ATL definition that enables me to
predict how the mapping occurs automatically, but I presume it does.
QVTo has a definition, but you need to be quite astute to read between
the inconsistencies and ambiguities. QVTo requires you to invoke a
mapping explicitly as you have already done for the child descent using
'map Attribute2PropertyC()'. If 'owner' is a parent you can avoid losing
the mapping by passing it as an argument to the nested mapping.
Otherwise you can use one of the 'resolve' helpers to recover the
mapping from the trace data.
Regards
Ed Willink
On 26/08/2011 21:48, n_uu_b wrote:
> Hi everybody,
>
> I'm a beginner in QVTo and I made a transformation in ATL (Concept to UML).
> But when I wrote this same transformation in QVTo I had an error in a relationship 'concept'.
>
> -> Code in ATL
>
> create OUT : Concept from IN : Uml;
> ..
> rule Attribute2Property {
> from attribute : Uml!Property
> to property : Concept!Property
> (
> name<- attribute.name,
> concept<- attribute.owner
> )
> }
>
>
> -> Code in QVTo
>
> modeltype UML uses uml(eclipse.org/uml2/3.0.0/UML');
> ..
> main() {
> Uml.objectsOfType(Property) -> map Attribute2PropertyC();
> }
> ..
> mapping Property::Attribute2PropertyC() : PropertyC {
> name := self.name;
> concept := self.owner; //This line has a error
> }
>
>
> The error is The type 'uml::Element' does not conform to the type 'pimconcept::Concept' of the property 'concept' and the one happens when I write transformation code for relationships.
>
> Please, How can I solve this problem? Does ATL work differently of QVTo in relationships? What's the correct sintax to write this transformation?
> I'll be really grateful if anyone can help me.
> Thanks.
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03612 seconds