Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: Accessing property values of applied stereotypes through UML2 API
Re: Accessing property values of applied stereotypes through UML2 API [message #471627] Thu, 08 March 2007 19:26 Go to next message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Andy,

This is a question for the UML2 newsgroup (and I'm sure questions on this
topic have been asked before...). Comments below.

Kenn

"Andreas Maier" <maiera@de.ibm.com> wrote in message
news:espmpr$eji$1@utils.eclipse.org...
> Hi,
> we are in the process of learning how to use the UML2 API in order to
> access properties of stereotypes extending some UML metaclass, let's say
> the Class metaclass.
>
> More precisely, we are trying to test, access and manipulate the value of
> a property P1 of a stereotype S1 applied to a UML class C1 residing in a
> user model. Obviously, the stereotype and its property are defined in some
> profile which is applied to the user model.
>
> We want to use the eGet(), eSet(), eUnset() and eIsSet() methods of
> EObject, to test, access and manipulate the stereotype property P1 or
> better its value in the applied stereotype.
>
> These methods require an EStructuralFeature as an argument which is the
> feature within the EObject the methods are invoked on.
>
> -> Is it correct to assume that in the above case, the EObject these
> methods are invoked on, would be the "applied stereotype" and the
> EStructuralFeature argument of the method would be the stereotype property
> ?

No, the object you would invoke these methods on is the stereotype
application, which can be obtained via the
Element#getStereotypeApplication(Stereotype) method. The feature could be
obtained from that object's Ecore class, which can be obtained either via
the stereotype application object (EObject#eClass()) or via the profile
(Profile#getDefinition(NamedElement)).

>
> -> If so, what is an "applied stereotype" in EMF object terms ?
>

It is a dynamic object instantiated based on the Ecore representation
(definition) of the stereotype.

> -> It seems that the Property interface does not implement or subclass
> from the EStructuralFeature interface. So which object do we pass as the
> EStructuralFeature argument to these methods ?

The Ecore representation (definition) of a stereotype property can be
obtained as described above or via the Profile#getDefinition(NamedElement)
method (recommended).

>
> ... I assume we are having basic problems to understand how this works. So
> don't hesitate to point out that we are being stupid ;-)
>
> -> Is there an example for accessing property values of applied
> stereotypes through the UML2 API ?

Yes - have you read the "Introduction to UML2 Profiles" article on the UML2
documentation page?

>
> Andy
Re: Accessing property values of applied stereotypes through UML2 API [message #471628 is a reply to message #471627] Thu, 08 March 2007 21:12 Go to previous message
Andreas Maier is currently offline Andreas MaierFriend
Messages: 32
Registered: July 2009
Member
Kenn,
I realized after I posted this message that a lot of this is discussed
in the UML2 newsgroup. Sorry for that.

Thanks for your responses!

I have not read the "Introduction to UML2 Profiles" article yet. I am
just trying to collect the information for our student Christoph who
does the actual code development ... I think we should now have what we
need to at least get started.

Thanks much!
Andy

Kenn Hussey wrote:
> Andy,
>
> This is a question for the UML2 newsgroup (and I'm sure questions on this
> topic have been asked before...). Comments below.
>
> Kenn
>
> "Andreas Maier" <maiera@de.ibm.com> wrote in message
> news:espmpr$eji$1@utils.eclipse.org...
>> Hi,
>> we are in the process of learning how to use the UML2 API in order to
>> access properties of stereotypes extending some UML metaclass, let's say
>> the Class metaclass.
>>
>> More precisely, we are trying to test, access and manipulate the value of
>> a property P1 of a stereotype S1 applied to a UML class C1 residing in a
>> user model. Obviously, the stereotype and its property are defined in some
>> profile which is applied to the user model.
>>
>> We want to use the eGet(), eSet(), eUnset() and eIsSet() methods of
>> EObject, to test, access and manipulate the stereotype property P1 or
>> better its value in the applied stereotype.
>>
>> These methods require an EStructuralFeature as an argument which is the
>> feature within the EObject the methods are invoked on.
>>
>> -> Is it correct to assume that in the above case, the EObject these
>> methods are invoked on, would be the "applied stereotype" and the
>> EStructuralFeature argument of the method would be the stereotype property
>> ?
>
> No, the object you would invoke these methods on is the stereotype
> application, which can be obtained via the
> Element#getStereotypeApplication(Stereotype) method. The feature could be
> obtained from that object's Ecore class, which can be obtained either via
> the stereotype application object (EObject#eClass()) or via the profile
> (Profile#getDefinition(NamedElement)).
>
>> -> If so, what is an "applied stereotype" in EMF object terms ?
>>
>
> It is a dynamic object instantiated based on the Ecore representation
> (definition) of the stereotype.
>
>> -> It seems that the Property interface does not implement or subclass
>> from the EStructuralFeature interface. So which object do we pass as the
>> EStructuralFeature argument to these methods ?
>
> The Ecore representation (definition) of a stereotype property can be
> obtained as described above or via the Profile#getDefinition(NamedElement)
> method (recommended).
>
>> ... I assume we are having basic problems to understand how this works. So
>> don't hesitate to point out that we are being stupid ;-)
>>
>> -> Is there an example for accessing property values of applied
>> stereotypes through the UML2 API ?
>
> Yes - have you read the "Introduction to UML2 Profiles" article on the UML2
> documentation page?
>
>> Andy
>
>
Re: Accessing property values of applied stereotypes through UML2 API [message #598395 is a reply to message #471627] Thu, 08 March 2007 21:12 Go to previous message
Andreas Maier is currently offline Andreas MaierFriend
Messages: 32
Registered: July 2009
Member
Kenn,
I realized after I posted this message that a lot of this is discussed
in the UML2 newsgroup. Sorry for that.

Thanks for your responses!

I have not read the "Introduction to UML2 Profiles" article yet. I am
just trying to collect the information for our student Christoph who
does the actual code development ... I think we should now have what we
need to at least get started.

Thanks much!
Andy

Kenn Hussey wrote:
> Andy,
>
> This is a question for the UML2 newsgroup (and I'm sure questions on this
> topic have been asked before...). Comments below.
>
> Kenn
>
> "Andreas Maier" <maiera@de.ibm.com> wrote in message
> news:espmpr$eji$1@utils.eclipse.org...
>> Hi,
>> we are in the process of learning how to use the UML2 API in order to
>> access properties of stereotypes extending some UML metaclass, let's say
>> the Class metaclass.
>>
>> More precisely, we are trying to test, access and manipulate the value of
>> a property P1 of a stereotype S1 applied to a UML class C1 residing in a
>> user model. Obviously, the stereotype and its property are defined in some
>> profile which is applied to the user model.
>>
>> We want to use the eGet(), eSet(), eUnset() and eIsSet() methods of
>> EObject, to test, access and manipulate the stereotype property P1 or
>> better its value in the applied stereotype.
>>
>> These methods require an EStructuralFeature as an argument which is the
>> feature within the EObject the methods are invoked on.
>>
>> -> Is it correct to assume that in the above case, the EObject these
>> methods are invoked on, would be the "applied stereotype" and the
>> EStructuralFeature argument of the method would be the stereotype property
>> ?
>
> No, the object you would invoke these methods on is the stereotype
> application, which can be obtained via the
> Element#getStereotypeApplication(Stereotype) method. The feature could be
> obtained from that object's Ecore class, which can be obtained either via
> the stereotype application object (EObject#eClass()) or via the profile
> (Profile#getDefinition(NamedElement)).
>
>> -> If so, what is an "applied stereotype" in EMF object terms ?
>>
>
> It is a dynamic object instantiated based on the Ecore representation
> (definition) of the stereotype.
>
>> -> It seems that the Property interface does not implement or subclass
>> from the EStructuralFeature interface. So which object do we pass as the
>> EStructuralFeature argument to these methods ?
>
> The Ecore representation (definition) of a stereotype property can be
> obtained as described above or via the Profile#getDefinition(NamedElement)
> method (recommended).
>
>> ... I assume we are having basic problems to understand how this works. So
>> don't hesitate to point out that we are being stupid ;-)
>>
>> -> Is there an example for accessing property values of applied
>> stereotypes through the UML2 API ?
>
> Yes - have you read the "Introduction to UML2 Profiles" article on the UML2
> documentation page?
>
>> Andy
>
>
Previous Topic:Re: Accessing property values of applied stereotypes through UML2 API
Next Topic:[Announce] MDT UML2 2.1.0 is available
Goto Forum:
  


Current Time: Tue Apr 23 09:08:57 GMT 2024

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

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

Back to the top