Using m..m in multiplicity in UML ER diagram?

201 Views Asked by At

According to different resources in UML notation multiplicities have different forms. Below are some of the forms which can be used in a use-case diagram.

  • 1..1

    0..*

    1..*

    m..m

    m..n

In T. Connelly and C. Begg's database systems book, they have provided 5..10 (using cardinality and participation in numbers) in the alternative ways of representing multiplicities. When you draw an entity relationship diagram using UML notation can you use the same multiplicities? Especially I want to know if using m..m is correct in ER diagrams when using UML notation.

2

There are 2 best solutions below

0
On

UML is not a notation for ERD, but a language of its own with its own semantics. Of course, you can model in UML similar things as in ERD but also lot more.

This being said, n..m is a valid UML notation, when m and n both correspond to values (literals and constants). Note that in UML it is called multiplicity, as it is not to be confused with the number of items in a specific set.

I take the opportunity to warn other readers of this question that this is not to be confused with an N:M relationship in ERD, which in UML would be 0..* 0..* relationship (or with any suitable lower bound, as participation is not indicated in N:M).

2
On

Let me start with making sure you are aware what is the "ultimate source of truth". For UML it is the UML specification, available on the OMG page.

Now, even though I don't have the specification at hand at the moment and as a result I won't give you precise quotes, thus is the part of the specification you just learn by heart. So let me guide you through it.

In the UML specification, the multiplicity indicator is in the form m..n, where m is any non negative integer (in the mathematical sense, so theoretically there is no upper bound for the value) and n is an extended positiveinteger, i.e. it can either be any integer greater than 0 or an infinity denoted as * (an asterisk). In addition m and n has to satisfy the inequality m<=n with the assumption that * is larger than any integer.

Each association end can have a multiplicity defined, meaning for a simple association you have two multiplicities, one for each connected entity (usually a class).

Now, the multiplicity indicates how many objects of a specific class type has to be involved in a given association. Each end of the association defined multiplicity for the given class connected at this end.

The UML specification allows certain shorthand notations: m..m can be shortened to m (in other words of m and n are equal you only need to write the number once). 0..* can be shortened to * Since you can't have the .. notation (lower bound has to be an actual integer), there is no ambiguity. If the notation is just one number, it means both lower and upper bound are equal (to that number), and if the notation is just an asterisk, it means the multiplicity is 0..* (so essentially any amount of objects is allowed).

There are certain typical (frequent) notation, such as: 0..1 (meaning at most 1 object can be involved in this association 1 (meaning there has to be exactly one object) and of course * (i.e. any number of objects is allowed).

A notation m..n is a generalization when explaining, in the actual diagram both numbers n and m have to resolve to actual numbers.