Associating stereotypes with UML metaclasses in custom UML profiles
About this task
Unlike metaclass extensions that are included in the profile, you cannot apply the stereotype to an element that has the same metaclass as the association. Associating stereotypes with UML metaclasses in profiles is helpful because, when you apply custom profiles, you can change which UML relationships are valid in a specific domain.
For example, in a UML model, a directed association from an actor to an interface is not a valid relationship. However, you could create a custom profile that allows this type of relationship by creating a stereotype such as <<employee>> that extends the metaclass Actor, and by creating an association relationship from that stereotype to the metaclass Interface. When you apply the custom profile to a model, the relationship from actors stereotyped as <<employee>> to interfaces is valid because the custom profile overrides the default UML notation with this domain-specific construct.
Procedure
- In the Project Explorer view, expand a project that contains a custom UML profile that contains one or more stereotypes.
- Expand the Profiles folder, expand the profile, right-click a stereotype; then click Add UML > Metaclass Association.
- In the Select Element window, select a metaclass for the association and click OK.