Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » [solved] getApplicableStereotypes() is empty(Unable to get the applicable stereotypes of an applie profile)
[solved] getApplicableStereotypes() is empty [message #1798464] Mon, 19 November 2018 14:37 Go to next message
Jan Vlug is currently offline Jan VlugFriend
Messages: 5
Registered: November 2018
Junior Member
I try to apply a UML profile programatically to a UML model.

I load the model and profile, apply the profile to the model.
Next I get all packages of the model and try to get the applicable stereotypes for the packages.
But the call:
pack.getApplicableStereotypes();
returns always an empty list.

Do you have any idea why I do not get the list of applicable stereotypes?

I attached my example code and the UML profile and UML model that I am using.

[Updated on: Thu, 22 November 2018 07:59]

Report message to a moderator

Re: getApplicableStereotypes() is empty [message #1798496 is a reply to message #1798464] Mon, 19 November 2018 21:22 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

The getApplicableStereotypes() operation computes, for any element, the stereotypes that are available in applied profiles that extend the element's metaclass, that are not yet applied to it.

So, in your case, do you (a) have in any applied profile any stereotypes that extend the Package metaclass (because you're asking a package for its applicable stereotypes) and (b) that package does not already have all stereotypes applied to it that can be applied? Note that a stereotype that is already applied to an element is not applicable, because stereotypes cannot be applied more than once.

HTH,

Christian
Re: getApplicableStereotypes() is empty [message #1798498 is a reply to message #1798496] Mon, 19 November 2018 21:57 Go to previous messageGo to next message
Jan Vlug is currently offline Jan VlugFriend
Messages: 5
Registered: November 2018
Junior Member
Christian W. Damus wrote on Mon, 19 November 2018 21:22

So, in your case, do you (a) have in any applied profile any stereotypes that extend the Package metaclass (because you're asking a package for its applicable stereotypes) and (b) that package does not already have all stereotypes applied to it that can be applied? Note that a stereotype that is already applied to an element is not applicable, because stereotypes cannot be applied more than once.


If I'm not mistaken, both conditions are met. There is an Papyrus plugin [1] that can be used to apply the profile via the GUI in Eclipse/Papyrus. Applying the profile leads to a stereotype on the package. My attached sample code however, does not work as a stand alone Java application.

[1] https://github.com/SOM-Research/OData
Re: getApplicableStereotypes() is empty [message #1798560 is a reply to message #1798498] Tue, 20 November 2018 12:59 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Looking into the profile attached to the original post, I see that the only stereotypes that extend any kind of package metaclass are ODService and ODAnnotations, which both extend the Model metaclass. So, it's no surprise that Packages that are not Models do not have any applicable stereotypes.

HTH,

Christian
Re: getApplicableStereotypes() is empty [message #1798657 is a reply to message #1798560] Thu, 22 November 2018 07:56 Go to previous message
Jan Vlug is currently offline Jan VlugFriend
Messages: 5
Registered: November 2018
Junior Member
Thanks for your suggestion, Christian. You were right. The issue has been solved now.
Previous Topic:XMI model versions
Next Topic:problem with IntroductionToUML2Profiles
Goto Forum:
  


Current Time: Thu Apr 25 15:51:38 GMT 2024

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

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

Back to the top