Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Generic type for applied stereotypes(Implementing generic OCL queries for extension instances)
Generic type for applied stereotypes [message #1478243] Tue, 18 November 2014 14:10 Go to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 73
Registered: July 2014
Member
Hello,

Except if I missed something, with the last version of OCL it is no more possible to use the result of getStereotypeApplications() as a set of generic EObject.

I can cast a stereotype application to the proper stereotype and then use it as an instance of this stereotype. However, I cannot find a means to deal with any stereotype application in a generic maner, for instance for a document generation purpose.

Is there a common ancestor to any specific stereotype application that could be use as a type in an OCL query in order to provide this genericity?

Thanks for your help,

Yves

Context:
Eclipse Luna SR1
OCL v5.0.2
Eclipse UML2 v5.0.0



Yves
Re: Generic type for applied stereotypes [message #1478266 is a reply to message #1478243] Tue, 18 November 2014 14:36 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1206
Registered: July 2009
Location: Canada
Senior Member

Hi, Yves,

If your stereotypes all define some common set of features, then do
they not inherit those features already from a common ancestor
stereotype or class? Or perhaps you can define such a common ancestor
in your profiles.

Cheers,

Christian


On 2014-11-18 14:10:54 +0000, Yves BERNARD said:

> Hello,
>
> Except if I missed something, with the last version of OCL it is no
> more possible to use the result of getStereotypeApplications() as a set
> of generic EObject.
>
> I can cast a stereotype application to the proper stereotype and then
> use it as an instance of this stereotype. However, I cannot find a
> means to deal with any stereotype application in a generic maner, for
> instance for a document generation purpose.
>
> Is there a common ancestor to any specific stereotype application that
> could be use as a type in an OCL query in order to provide this
> genericity?
>
> Thanks for your help,
>
> Yves
> Context: Eclipse Luna SR1
> OCL v5.0.2
> Eclipse UML2 v5.0.0
Re: Generic type for applied stereotypes [message #1478570 is a reply to message #1478243] Tue, 18 November 2014 20:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6762
Registered: July 2009
Senior Member
Hi

If you are working within Papyrus, you are probably using the new Pivot
OCL prototype for OCL 2.5. This has typesafe navigation of stereotypes
so you should never need to use getStereotypeApplications(), but you can.

Use base_xxx and extension_xxx.

You also have reflection via oclType() and oclContainer(),
oclContents(). But no oclGet().

Regards

Ed Willink

On 18/11/2014 14:10, Yves BERNARD wrote:
> Hello,
>
> Except if I missed something, with the last version of OCL it is no more
> possible to use the result of getStereotypeApplications() as a set of
> generic EObject.
>
> I can cast a stereotype application to the proper stereotype and then
> use it as an instance of this stereotype. However, I cannot find a means
> to deal with any stereotype application in a generic maner, for instance
> for a document generation purpose.
>
> Is there a common ancestor to any specific stereotype application that
> could be use as a type in an OCL query in order to provide this genericity?
>
> Thanks for your help,
>
> Yves
> Context: Eclipse Luna SR1
> OCL v5.0.2
> Eclipse UML2 v5.0.0
>
>
Re: Generic type for applied stereotypes [message #1479167 is a reply to message #1478570] Wed, 19 November 2014 07:55 Go to previous message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 73
Registered: July 2014
Member
Hi Christian,

You missed my point. The need is to be able to deal with any stereotype definition on a generic way. For instance, assume you want to generate a document for virtually any UML model listing, for each model element, what are the stereotypes applied and what are the values assigned to their "tag values", if any.

Hi Ed,

Yes, I think this is the version I used (formally: OCL v5.0.2). The point is that I cannot use base_xxx and extension_xxx since stereotype are not known a priori. I think I miss something like "oclGet()".

Do you see any workaround?

Thanks to both of you.

Yves


Yves
Previous Topic:Change order of comments
Next Topic:Basic use of SysML elements
Goto Forum:
  


Current Time: Mon Jul 06 12:08:44 GMT 2020

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

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

Back to the top