Use the Tagged Value Connector
A common situation when creating a profile is where instances of one stereotype need to reference elements with another stereotype applied. For example, an element that defines a Collection might have a Tagged Value called rootNode to identify the Root of that Collection, which will be a Class with the stereotype <<Node>>. In the Tagged Values window, the user would click on the selection button () against the rootNode Tagged Value; when the 'Select <Item>' dialog displays, the user can locate all Nodes in the current model, and select one of these elements as the value of the tag.
To achieve this, you use the Tagged Value connector from the 'Profile' pages of the Toolbox. A Tagged Value connector defines a reference-type (that is, RefGUID) Tagged Value owned by the source stereotype; the Tagged Value name is the name of the target role of this connector, and the Tagged Value is limited to referencing elements with the stereotype of the target element.
This diagram demonstrates how you might use the connector to represent the example. A Profile defines two stereotypes: «Collection» and «Node» (both of which extend the Metaclass Class). The «Collection» stereotype owns a Tagged Value connector with the target role rootNode, pointing to the «Node» stereotype. You enter the target role name on the 'Role(s)' page of the connector 'Properties' dialog.
- The Tagged Value connector can also link directly with a metaclass element to identify base UML element type; for example: if the target is a metaclass Actor, when you select to identify a specific target element the 'Select <item>' dialog will list all elements based on Actor
- Further, the connector can link to a metaclass for groups of element type, namely Classifiers and Properties; if the connector target is the metaclass:
- Classifier, when you select to identify a specific target element the 'Select <item>' dialog will list all Enterprise Architect-defined Classifier types such as Class and Component
- Property, when you select to identify a specific target element the 'Select <item>' dialog will list Port, Part and Attribute elements