Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » how can i access the stereotype of an element
how can i access the stereotype of an element [message #736902] Fri, 14 October 2011 08:57 Go to next message
st oehm is currently offline st oehm
Messages: 79
Registered: October 2009
Member
hello
i want to access the name of the stereotype an element refers to. i thougth that is very easy but i could not figure it out.
if anybody knows help please post an ocl-expression or the metattributs which can help

best regards
stoehm
Re: how can i access the stereotype of an element [message #736918 is a reply to message #736902] Fri, 14 October 2011 09:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4036
Registered: July 2009
Senior Member
Hi

The following works for me in QVTo:

mapping UML::DataType::convertDataType(in2out : Dict(UML::Element,
Ecore::EModelElement), context : Dict(String, OclAny)) : Ecore::EDataType
inherits Type::convertType {
instanceClassName :=
self.getValue(self.getAppliedStereotype('Ecore::EDataType'),
'instanceClassName').oclAsType(String);
eAnnotations := self.convertComments(in2out, context);
}

This manually traverses the stereotype using UML helper functions.
Unfortunately this requires an oclAsType to restore the 'known' type and
this is a problem in the traditional Ecore OCL implementation when that
type is a Collection.

My current thinking is that the OCL meta-model loader should treat
profiles in the same way as Complete OCL so that OCL expressions are
evaluated on the merged meta-model thereby allowing a type safe

instanceClassName := self.instanceClassName;

For now, I think getAppliedStereotype or custom Java may be your only
option.

Regards

Ed Willink

On 14/10/2011 13:57, stoehm wrote:
> hello
> i want to access the name of the stereotype an element refers to. i
> thougth that is very easy but i could not figure it out. if anybody
> knows help please post an ocl-expression or the metattributs which can
> help
>
> best regards
> stoehm
Re: how can i access the stereotype of an element [message #737136 is a reply to message #736918] Fri, 14 October 2011 13:48 Go to previous message
st oehm is currently offline st oehm
Messages: 79
Registered: October 2009
Member
hi ed
thanks for your help! i will test this
Previous Topic:Tutorial for creating UML programmatically
Next Topic:loading a uml-profile
Goto Forum:
  


Current Time: Tue Sep 02 00:26:25 EDT 2014

Powered by FUDForum. Page generated in 0.01560 seconds