Go to start of banner

# Setting the multiplicity for a UML attribute, operation or association

Go to start of metadata

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.

Example

The relationship between a player and the play game use case. A game may be played by many (two or more) players, but a player may not always participate in the game.

To show this relationship, the following multiplicity is set: on the side of the actor 2.., on the side of the use case *0..1. This is shown in the diagram as follows:

For a complete registration of a person's details, the person must at least have one address but can have two addresses. Also, the person must have at least one telephone number but may have many.

To show this, the following multiplicity is set: for the address attribute the multiplicity is 1..2, for the phone number attribute the multiplicity is set to 1..{*}. This is shown in the diagram as follows:

The table below shows the interval values that can be used.

Possible values

Meaning

1..1

Exactly one object. This is the default multiplicity of an association according to UML.

0..*

No object or at least one.

1..*

At least one object.

m..m

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.

m..n

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

1. In the diagram, click the association.

2. 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.

3. Press Enter to save the new values.

# Setting the multiplicity via the properties pop-up window

1. In the diagram, click the element, and then click to open the properties window. For an attribute or operation, the window is opened directly after clicking the element.

2. 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.

3. Close the properties window.

Introductory eLearning course

Check out the free Enterprise Studio introductory eLearning course to learn about UML modeling in Enterprise Studio.