Constraints on extended stereotype in UML profile

I would suppose that’Car’ return false if the applied stereotype is Mercedes.

Yes you are right.

Mercedes inherits the constraint as it is, so'Car' is false for a class stereotyped Mercedes rather than Car because ‘Mercedes’ and ‘Car’ are two different strings.

If you want to have the first implies active for the metaclasses specializing Car directly or indirectly you can get all the generalizations of the stereotype more itself to search for one named ‘Car’, also checking the name of the profile of the stereotype and may be its URI. So for instance replace'Car' by : = 'Cars' and
-- self.stereotype.profile.URI= '...' and
      ->select(name = 'Car')

or with an alone profile named Cars and an alone stereotype in it named Car :

                              ->any(name = 'Cars') -- may be check also URI
                                 .ownedStereotype->any(name = 'Car'))

Additional notes :

  • in your proposal you suppose only your stereotype is named Car among all the stereotypes of all the profiles, of course that can be false. You can also check the name of the profile and may be its URI like:'Car'
    -- and self.stereotype.profile.URI= '...'
  • in your diagram the arrow head is wrong because it must be a filled triangle rather than < (probably you use PlantUML) :

enter image description here

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top