Multiplicity can be set for attributes, operations, and associations in a UML class diagram, and for associations in a use case diagram. The multiplicity is an indication of how many objects may participate in the given relationship or the allowable number of instances of the element.
In a use case diagram, multiplicity indicates how many actors can take part in how many occurrences of a use case. Multiplicity on a use case could mean that an actor interacts with multiple use cases, multiplicity on an actor could mean that one or more actors interact with a particular use case.
The table below shows the interval values that can be used.
Exactly one object. This is the default multiplicity of an association according to UML.
No object or at least one.
At least one object.
Exactly m objects.
Example: 0..0 is no object, 3..3 is exactly three objects.
In the diagram, an exact number of objects is displayed as a single number.
Example: the interval 2..2 is displayed as 2 in the diagram.
At least m objects but no more than n objects.
Example: 3..8 is at least three and at the most 8 objects. 0..1 is no object or one object.
The multiplicity of an association can be set directly in the diagram, or via the properties pop-up window of the association. For attributes and operations, the multiplicity can only be set via their properties pop-up window.
When drawing an association, its multiplicity is automatically set to 0..1, which is not the UML default multiplicity. These values are always shown initially. New attributes and operations have a default multiplicity of 1.
Setting the multiplicity directly in the diagram
- In the diagram, click the association.
- Click the multiplicity on one side of the association, and type the desired value(s). Do the same for the other side, if needed.
If you add two values, make sure you leave the two dots in between.
Entering a single value implies the lower and upper value are the same (except for entering a single *).
Removing the values will reset the multiplicity to the default of 1.
- Press Enter to save the new values.
Setting the multiplicity via the properties pop-up window
- In the diagram, click the element, and then click
- In multiplicity, type the desired value(s) for the multiplicity. If you set the multiplicity for an association, set it on the From end and To end tabs of the properties window.
- Close the properties window.