Skip to main content



      Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] UML Primitive Types
[QVTO] UML Primitive Types [message #100804] Thu, 26 February 2009 08:05 Go to next message
Eclipse UserFriend
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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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?
>>
>
Previous Topic:[ATL] Where can we find the ATL 3.0 metamodel?
Next Topic:[ATL] assignment does not work
Goto Forum:
  


Current Time: Sat May 31 14:02:09 EDT 2025

Powered by FUDForum. Page generated in 0.02723 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top