An association relationship represents a structural relationship between two or more model elements in a UML class diagram or the participation of an actor in a use case in a UML use case diagram.
By default, an association is unspecified, just indicating a relationship. To further specify an association, you can define roles. Objects can play a role in the association with another object. A role is context-dependent. An example: in the relationship between person and company, the person can play the role of employee, and the company can play the role of employer. The roles of objects in an association can be specified by adding role names to both ends of an association.
Instead of defining roles, you can choose to name the association and indicate the reading direction of the association ends using the arrow on the line. You can specify only one direction.
On this page:
Defining object roles for an association
You can define object roles directly in the diagram, or via the properties pop-up window of the relation.
Defining objects roles directly in the diagram
- In the diagram, click the association.
- Select the text <role> on one of the two sides, and type the name of the role. Do the same for the other side.
Defining objects roles via the properties pop-up window
- In the diagram, click the association, and then click
- Click the From end tab, and in name, type the role name for the from end of the association.
- On the To end tab, type the name for the to end of the association.
- Close the properties window.
Naming an association and specifying its direction
You can name a UML association directly in the diagram, or via the properties pop-up window of the relation.
- In the diagram, click the association, and then type the name of the association.
Open the association's properties window, and on the Association tab, in name, type the name for the association.
Check if the arrow on the line is pointing in the right direction. If it is not, click it to change the direction:
According to the UML specification, the relation direction defines the order of the association ends ("from" role and "to" role). However, the relation direction has no semantic interpretation, it is for documentation purposes only (https://www.uml-diagrams.org/association.html). If you have also defined roles in the association relation, then please be aware that changing the relation direction will NOT change the order of the association ends, meaning that the roles will not be reverted.
Removing the name again will also remove the arrow on the line.