Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] RSM UML2 how to get profile property values ?
[ATL] RSM UML2 how to get profile property values ? [message #6174] Tue, 09 January 2007 15:24 Go to next message
Delphin Lecucq is currently offline Delphin LecucqFriend
Messages: 4
Registered: July 2009
Junior Member
Hello,

Several month ago, Yann Monclair asked on atl_discussion "[atl_discussion]
accessing properties of a stereotype"
I'm now in charge of the project.
The subject is transformation from an UML2 model with a 3ADL profile
applied, to an AADL model.

We are experiencing problems and I'm wondering if it's due to the fact
that 3ADL profile and the UML2 model are defined with Rational Software
Modeler.

I'm using eclipse 3.1.1 with latest ADT (from sources) and ATL2006 compiler
UML2 plugin version is 1.1.0

We don't use getAppliedStereotype method since it does not work. (maybe
due to RSM stuff)
Instead we have a bunch of helpers:
helper context UML!Class def: appliedStereotypes :
Sequence(UML!Stereotype) =
self.eAnnotations->select(e |
e.source = 'appliedStereotypes'
)->collect(e |
e.contents
)->flatten()->collect(e |
e.oclType().eAnnotations->select(e | e.source =
'stereotype')->first().references
)->flatten();


We are able to fetch stereotypes applied by reading eAnnotations.


But we cannot obtain the value of a property.
See below, a piece of the UML2 model, property "Source_Data_Size = 32"

<ownedMember xmi:type="uml:Class" xmi:id="_4QaeMPkfEdmPQsyHE2ZQmg"
name="Float">
<eAnnotations xmi:id="_C_DyMPkgEdmPQsyHE2ZQmg"
source="appliedStereotypes">
<contents xmi:type="_3ADL_124:_3ADL__AADLdataComponent"
xmi:id="_oMd59eSyEdq0eIuiIjcmvA"/>
<contents
xmi:type=" _3ADL_Properties_18:_3ADL_Properties__AADLproperty_Source_Da ta_Size "
xmi:id="_6bgIsPFUEdqAX5AQ0fc0Pw">
<Source_Data_Size xmi:id="_-_H1IPFlEdqAX5AQ0fc0Pw" value="32"/>
</contents>
</eAnnotations>
</ownedMember>

In a rule that transform UML!Class,
I did a peace of code to find the property:
e.appliedStereotypes->select(g|g.name =
'AADLproperty_Source_Data_Size')->first().ownedAttribute->select(att |
att.name = 'Source_Data_Size')->first().name.debug('property');

That's right, i get "property: Source_Data_Size"

Now I print the type of this property in order find how to deal with it
e.appliedStereotypes->select(g|g.name =
'AADLproperty_Source_Data_Size')->first().ownedAttribute->select(att |
att.name = 'Source_Data_Size')->first().name.debug('property');

I get "property: MOF!Property"

How to get the value of Source_Data_Size that is of type Size if the
property is maintained in a MOF!Property ?

profile 3ADL, definition of stereotype AADLproperty_Source_Data_Size
http://downloads.tni-software.com/atl/profile.png

UML2 model, property value I want to get in ATL
http://downloads.tni-software.com/atl/sample.png

Thanks in advance
Re: [ATL] RSM UML2 how to get profile property values ? [message #6279 is a reply to message #6174] Thu, 11 January 2007 10:16 Go to previous messageGo to next message
Delphin Lecucq is currently offline Delphin LecucqFriend
Messages: 4
Registered: July 2009
Junior Member
Hello,

Actually, I did success to get those properties values.
It seems it was due to the fact that my collegue was going in the wrong
level of model (he was in the UML2 meta model I guess).
Moreover, properties values are stored in Ecore elements instead of UML2.

So I wrote an helper that goes in EAnnotations content and uses Ecore
methods and other stuff.

helper context OclAny def: getFeatureObj(feat: String) : OclAny =
self.eGet(self.oclType().getEStructuralFeature(feat));

helper context UML!Class def: getPropertyObj(stereo: String, feat: String)
: OclAny =
self.eAnnotations->select(f | f.source = 'appliedStereotypes')
->collect(g | g.contents)
->flatten()->select(h | h.oclType().name = ('_3ADL_Properties__' + stereo))
->flatten()->first().getFeatureObj(feat);


REM:
The point is that profile's stereotypes and data types are defined both in
UML2 and Ecore (Rational Software Modeler 's way),
The peace of profile in Ecore is placed under an EAnnotation named
ePackages.

See profile:
http://downloads.tni-software.com/atl/rsmstuff.png
http://downloads.tni-software.com/atl/rsmstuff2.png

Properties, types and everything in this peace of profile is prefixed by
'_3ADL_Properties__'

I'm not verified of the way data are stored.
I cannot use ATL type matching
eg : e.oclIsTypeOf(UML!_3ADL_Properties__Time) crashes)
The only thing I can do is e.oclType().name =
'_3ADL_Properties__Time'


May be some one can tell me how to handle a model that uses both UML2
instances and Ecore instances ?

For information, the module's header:
-- @atlcompiler atl2006
module UML3ADLtoAADL;
create OUT : AADL from IN : UML;
uses strings;


Thanks in advance,
Delphin Lecucq
TNI-Software

Delphin Lecucq wrote:

> Hello,

> Several month ago, Yann Monclair asked on atl_discussion "[atl_discussion]
> accessing properties of a stereotype"
> I'm now in charge of the project.
> The subject is transformation from an UML2 model with a 3ADL profile
> applied, to an AADL model.

> We are experiencing problems and I'm wondering if it's due to the fact
> that 3ADL profile and the UML2 model are defined with Rational Software
> Modeler.

> I'm using eclipse 3.1.1 with latest ADT (from sources) and ATL2006 compiler
> UML2 plugin version is 1.1.0

> We don't use getAppliedStereotype method since it does not work. (maybe
> due to RSM stuff)
> Instead we have a bunch of helpers:
> helper context UML!Class def: appliedStereotypes :
> Sequence(UML!Stereotype) =
> self.eAnnotations->select(e |
> e.source = 'appliedStereotypes'
> )->collect(e |
> e.contents
> )->flatten()->collect(e |
> e.oclType().eAnnotations->select(e | e.source =
> 'stereotype')->first().references
> )->flatten();


> We are able to fetch stereotypes applied by reading eAnnotations.


> But we cannot obtain the value of a property.
> See below, a piece of the UML2 model, property "Source_Data_Size = 32"

> <ownedMember xmi:type="uml:Class" xmi:id="_4QaeMPkfEdmPQsyHE2ZQmg"
> name="Float">
> <eAnnotations xmi:id="_C_DyMPkgEdmPQsyHE2ZQmg"
> source="appliedStereotypes">
> <contents xmi:type="_3ADL_124:_3ADL__AADLdataComponent"
> xmi:id="_oMd59eSyEdq0eIuiIjcmvA"/>
> <contents
>
xmi:type=" _3ADL_Properties_18:_3ADL_Properties__AADLproperty_Source_Da ta_Size "
> xmi:id="_6bgIsPFUEdqAX5AQ0fc0Pw">
> <Source_Data_Size xmi:id="_-_H1IPFlEdqAX5AQ0fc0Pw" value="32"/>
> </contents>
> </eAnnotations>
> </ownedMember>

> In a rule that transform UML!Class,
> I did a peace of code to find the property:
> e.appliedStereotypes->select(g|g.name =
> 'AADLproperty_Source_Data_Size')->first().ownedAttribute->select(att |
> att.name = 'Source_Data_Size')->first().name.debug('property');

> That's right, i get "property: Source_Data_Size"

> Now I print the type of this property in order find how to deal with it
> e.appliedStereotypes->select(g|g.name =
> 'AADLproperty_Source_Data_Size')->first().ownedAttribute->select(att |
> att.name = 'Source_Data_Size')->first().name.debug('property');

> I get "property: MOF!Property"

> How to get the value of Source_Data_Size that is of type Size if the
> property is maintained in a MOF!Property ?

> profile 3ADL, definition of stereotype AADLproperty_Source_Data_Size
> http://downloads.tni-software.com/atl/profile.png

> UML2 model, property value I want to get in ATL
> http://downloads.tni-software.com/atl/sample.png

> Thanks in advance
Re: [ATL] RSM UML2 how to get profile property values ? [message #6294 is a reply to message #6174] Thu, 11 January 2007 11:59 Go to previous message
D Kelsey is currently offline D KelseyFriend
Messages: 232
Registered: July 2009
Senior Member
For RSM 6.0, you cannot use the usual ATL way of accessing profile
information as you have found out. The reason being is that RSM 6.0 uses
a slightly different mechanism for applying profiles so you have to
use RSM specific APIs to load the model. ATL uses the standard EMF
apis so problems will be encountered.

Dave Kelsey

Delphin Lecucq wrote:
> Hello,
>
> Several month ago, Yann Monclair asked on atl_discussion
> "[atl_discussion] accessing properties of a stereotype"
> I'm now in charge of the project.
> The subject is transformation from an UML2 model with a 3ADL profile
> applied, to an AADL model.
>
> We are experiencing problems and I'm wondering if it's due to the fact
> that 3ADL profile and the UML2 model are defined with Rational Software
> Modeler.
>
> I'm using eclipse 3.1.1 with latest ADT (from sources) and ATL2006 compiler
> UML2 plugin version is 1.1.0
>
> We don't use getAppliedStereotype method since it does not work. (maybe
> due to RSM stuff)
> Instead we have a bunch of helpers:
> helper context UML!Class def: appliedStereotypes :
> Sequence(UML!Stereotype) =
> self.eAnnotations->select(e |
> e.source = 'appliedStereotypes'
> )->collect(e |
> e.contents
> )->flatten()->collect(e |
> e.oclType().eAnnotations->select(e | e.source =
> 'stereotype')->first().references
> )->flatten();
>
>
> We are able to fetch stereotypes applied by reading eAnnotations.
>
>
> But we cannot obtain the value of a property.
> See below, a piece of the UML2 model, property "Source_Data_Size = 32"
>
> <ownedMember xmi:type="uml:Class" xmi:id="_4QaeMPkfEdmPQsyHE2ZQmg"
> name="Float">
> <eAnnotations xmi:id="_C_DyMPkgEdmPQsyHE2ZQmg"
> source="appliedStereotypes">
> <contents xmi:type="_3ADL_124:_3ADL__AADLdataComponent"
> xmi:id="_oMd59eSyEdq0eIuiIjcmvA"/>
> <contents
> xmi:type=" _3ADL_Properties_18:_3ADL_Properties__AADLproperty_Source_Da ta_Size "
> xmi:id="_6bgIsPFUEdqAX5AQ0fc0Pw">
> <Source_Data_Size xmi:id="_-_H1IPFlEdqAX5AQ0fc0Pw" value="32"/>
> </contents>
> </eAnnotations>
> </ownedMember>
>
> In a rule that transform UML!Class,
> I did a peace of code to find the property:
> e.appliedStereotypes->select(g|g.name =
> 'AADLproperty_Source_Data_Size')->first().ownedAttribute->select(att |
> att.name = 'Source_Data_Size')->first().name.debug('property');
>
> That's right, i get "property: Source_Data_Size"
>
> Now I print the type of this property in order find how to deal with it
> e.appliedStereotypes->select(g|g.name =
> 'AADLproperty_Source_Data_Size')->first().ownedAttribute->select(att |
> att.name = 'Source_Data_Size')->first().name.debug('property');
>
> I get "property: MOF!Property"
>
> How to get the value of Source_Data_Size that is of type Size if the
> property is maintained in a MOF!Property ?
>
> profile 3ADL, definition of stereotype AADLproperty_Source_Data_Size
> http://downloads.tni-software.com/atl/profile.png
>
> UML2 model, property value I want to get in ATL
> http://downloads.tni-software.com/atl/sample.png
>
> Thanks in advance
>
Previous Topic:How to run ATL debug in Eclipse
Next Topic:[ATL] how to load standard elements of the target metamodel
Goto Forum:
  


Current Time: Tue Mar 19 06:34:31 GMT 2024

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

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

Back to the top