[QVTO] UML Primitive Types [message #100804] |
Thu, 26 February 2009 08:05  |
Eclipse User |
|
|
|
Originally posted by: loic.fejoz.realtimeatwork.com
Hi,
It seems that the few explanations on the forum is not enough for me.
I try a simple Uml2Uml transformation that add accessors. But I also add
an accessors that tell if an attribute has already been set (for 0..1
attributes).
What I have understand so far is that I need to add a pseudo input that
will reference the UMLPrimitiveTypes library. My code thus begin with:
transformation Model2JavaImpl(in uml : UML, in umlPrimitiveTypes : UML,
out UML);
modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';
Later I would like to create an operation whose return type is Boolean.
I get stuck on the return type.
On launch, uml is my input model, umlPrimitiveTypes is set to
pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml.
But it does not work. I do not find how to get the
UMLPrimitiveTypes::Boolean!
Any thoughts or links?
--
Regards,
Loïc Fejoz
|
|
|
Re: [QVTO] UML Primitive Types [message #100818 is a reply to message #100804] |
Thu, 26 February 2009 10:56   |
Eclipse User |
|
|
|
Hi Loïc,
The code snippet bellow shows an example how to resolve UML primitive
types.
Regards,
/Radek
transformation Test(in eModel : ECORE, out umlModel : UML, in
primitiveTypes : UML);
main() {
object UML::Model {
ownedType += object UML::Class {
ownedOperation += object Operation@umlModel {
ownedParameter += object UML::Parameter {
type := getPrimitiveType("Boolean");
}
}
}
}
}
query getPrimitiveType(typeName : String) : UML::PrimitiveType {
var primitives :=
primitiveTypes.rootObjects()[Model].ownedElement[UML::Primit iveType];
return primitives![name = typeName];
}
On Thu, 26 Feb 2009 14:05:32 +0100, Loïc Fejoz
<loic.fejoz@realtimeatwork.com> wrote:
> Hi,
>
> It seems that the few explanations on the forum is not enough for me.
> I try a simple Uml2Uml transformation that add accessors. But I also add
> an accessors that tell if an attribute has already been set (for 0..1
> attributes).
>
> What I have understand so far is that I need to add a pseudo input that
> will reference the UMLPrimitiveTypes library. My code thus begin with:
>
> transformation Model2JavaImpl(in uml : UML, in umlPrimitiveTypes : UML,
> out UML);
> modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';
>
> Later I would like to create an operation whose return type is Boolean.
> I get stuck on the return type.
>
> On launch, uml is my input model, umlPrimitiveTypes is set to
> pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml.
>
> But it does not work. I do not find how to get the
> UMLPrimitiveTypes::Boolean!
>
> Any thoughts or links?
>
|
|
|
Re: [QVTO] UML Primitive Types [message #100831 is a reply to message #100818] |
Fri, 27 February 2009 03:11  |
Eclipse User |
|
|
|
Originally posted by: loic.fejoz.realtimeatwork.com
Many thanks!
Much more simple than all the expressions I have tried and... working!
I really think, there should have a simple example on the wiki for
Uml2Uml transformation with clone, deepclone and PrimitiveTypes...
Indeed it seems trivial while reading but discovering it (and getting it
correct) is not!
--
Thanks again,
Loïc Fejoz
Radek Dvorak a écrit :
> Hi Loïc,
>
> The code snippet bellow shows an example how to resolve UML primitive
> types.
>
> Regards,
> /Radek
>
>
>
> transformation Test(in eModel : ECORE, out umlModel : UML, in
> primitiveTypes : UML);
>
> main() {
> object UML::Model {
> ownedType += object UML::Class {
> ownedOperation += object Operation@umlModel {
> ownedParameter += object UML::Parameter
> {
> type := getPrimitiveType("Boolean");
> }
> }
> }
> }
> }
>
> query getPrimitiveType(typeName : String) : UML::PrimitiveType {
> var primitives :=
> primitiveTypes.rootObjects()[Model].ownedElement[UML::Primit iveType];
> return primitives![name = typeName];
> }
>
>
>
>
>
> On Thu, 26 Feb 2009 14:05:32 +0100, Loïc Fejoz
> <loic.fejoz@realtimeatwork.com> wrote:
>
>> Hi,
>>
>> It seems that the few explanations on the forum is not enough for me.
>> I try a simple Uml2Uml transformation that add accessors. But I also
>> add an accessors that tell if an attribute has already been set (for
>> 0..1 attributes).
>>
>> What I have understand so far is that I need to add a pseudo input
>> that will reference the UMLPrimitiveTypes library. My code thus begin
>> with:
>>
>> transformation Model2JavaImpl(in uml : UML, in umlPrimitiveTypes :
>> UML, out UML);
>> modeltype UML uses 'http://www.eclipse.org/uml2/2.1.0/UML';
>>
>> Later I would like to create an operation whose return type is
>> Boolean. I get stuck on the return type.
>>
>> On launch, uml is my input model, umlPrimitiveTypes is set to
>> pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml.
>>
>> But it does not work. I do not find how to get the
>> UMLPrimitiveTypes::Boolean!
>>
>> Any thoughts or links?
>>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02723 seconds