Skip to main content



      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 09:37 Go to next message
Eclipse UserFriend
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 02:59] by Moderator

Re: getApplicableStereotypes() is empty [message #1798496 is a reply to message #1798464] Mon, 19 November 2018 16:22 Go to previous messageGo to next message
Eclipse UserFriend
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 16:57 Go to previous messageGo to next message
Eclipse UserFriend
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 07:59 Go to previous messageGo to next message
Eclipse UserFriend
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 02:56 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 01:47:11 EDT 2025

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

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

Back to the top