Multiplicity

In Unified Modeling Language (UML) visualization class diagrams, multiplicity specifies the number of allowable elements that a set of associated Enterprise JavaBeans (EJB) enterprise beans might assume.

A multiplicity specification is a subset of a set of non-negative integers. You can give multiplicity specifications for roles within association relationships.

A multiplicity appears as a text string comprising a comma-separated sequence of integer intervals, where an interval represents a (possibly infinite) range of integers, in the following format:

lower-bound .. upper-bound

In this format, lower-bound and upper-bound are literal integer values, which specifies the closed (inclusive) range of integers from the lower bound to the upper bound. An asterisk (*) is used for the upper bound, denoting an unlimited upper bound. In a parameterized context (such as a template), the bounds can be expressions but they must evaluate to literal integer values for any actual use. Unbound expressions that do not evaluate to literal integer values are not permitted.

A variety of multiplicities are possible. One enterprise bean can relate to another in a one-to-one, one-to-many, one-to-one or more, one-to-zero or one, one-to-a bounded interval (for example, one to five through 10). An asterisk (*) represents more and many. In one context or is represented by two dots (..), as in "1..*" (one or more). In another context, or is represented by a comma, as in "5, 10" (five or 10).

The style guidelines are that intervals should be increasing in an unvaried pattern. For example, "1..3, 7, 10" is preferable to "7, 10, 1..3". And two contiguous intervals should be combined into a single interval. For example, "0..1" is preferable to "0, 1".

Multiplicities are the number of objects from one EJB enterprise bean that relate with a single object in an associated enterprise bean. To represent these numbers in a UML class diagram, place multiplicities above the association relationship (connector) near the associated class.

The image shows an example of multiplicity between two associated classifiers.

 

Parent topic

About UML class diagrams

 

Related concepts

Class diagrams
Class shapes
Classifiers
Classes
Relationships
Attributes
Operations
Adornments for unresolved references
Visibility