Sam Shiles
Sam Shiles

Reputation: 11259

Multiplicity vs Cardinality

When talking about data models and databases, the term Cardinality is often used to describe the number of allowed elements in a given set.

UML often refers to the same property as Multiplicity.

Is there any difference between these two terms or are they synonymous?

Upvotes: 49

Views: 66782

Answers (7)

qwerty_so
qwerty_so

Reputation: 36313

To add the (now) recent UML 2.5 definition on p. 33:

The cardinality of a collection is the number of values contained in that collection. The multiplicity of a MultiplicityElement specifies valid cardinalities of the collection it represents. The multiplicity is a constraint on the cardinality, which shall not be less than the lower bound and not greater than the upper bound specified for the multiplicity (unless the multiplicity is unlimited, in which case there is no constraint on the upper bound).

Upvotes: 2

TinTin
TinTin

Reputation: 201

A multiplicity of an event = Participation of an element + cardinality of an element. Participation means the least number of the occurrence of the entity in a specific relationship whereas Cardinality means the maximum (upper bound)and the minimum (lower bound) number of occurrence of the specific entity in a relationship.

FYI: https://www.uml-diagrams.org/multiplicity.html

Upvotes: 0

JATIN AHUJA
JATIN AHUJA

Reputation: 11

The Multiplicity is the constraint on the collection of the association objects whereas the Cardinality is the count of the objects that are in collection.

The multiplicity is actually the constraint on cardinality.

Upvotes: 1

Suleka_28
Suleka_28

Reputation: 2919

The simplest explanation would be to say:

Multiplicity = Cardinality + Participation

Cardinality: Denotes the maximum number of possible relationship occurrences in which a certain entity can participate in (in simple terms: at most).

Participation: Denotes if all or only some entity occurrences participate in a relationship (in simple terms: at least).

Ex: enter image description here

Upvotes: 42

Andrew
Andrew

Reputation: 8048

Thank you for the question and answers above.

Really got confused with those terms this morning (coffee did not help).

Given the example below:

0-1 ---------- 1-*

Multiplicities:

First multiplicity, for the left entity: 0-1

Second multiplicity, for the right entity: 1-*

Cardinalities for the first multiplicity:

Lower cardinality: 0

Upper cardinality: 1

Cardinalities for the second multiplicity:

Lower cardinality: 1

Upper cardinality: *

Upvotes: 8

Jim L.
Jim L.

Reputation: 6529

Simply put: a multiplicity is made up of a lower and an upper cardinality. A cardinality is how many elements are in a set. Thus, a multiplicity tells you the minimum and maximum allowed members of the set. They are not synonymous.

Upvotes: 26

LMeyer
LMeyer

Reputation: 2631

Martin Fowler has talked about this subject on his website. Quoting :

When data modeling methods talk about relationships, they use the term cardinality to indicate how many entities may be linked together. So you might have a relationship between order and customer and say that the cardinality of the relationship is one-to-many. Or you might hear that the cardinality of customers for an order is 0-to-many.

UML avoids the term cardinality preferring to use multiplicity. Often people with a data modeling background are surprised at this since cardinality has been so widely used in data modeling circles.

The reason for the change is that the dictionary definition of cardinality is "the number of elements in a particular set or other grouping" (OED). According to this the data modeling usage is actually wrong. In the excellent UML Reference Manual, Rumbaugh defines multiplicity as "A specification of the range of allowable cardinality values - the size - that a set may assume". The UML uses multiplicity in various places, for a property (association or attribute) and also to show the multiplicity of parts in a composite structure. It's formally defined as a lower and upper bound. An association (the UML equivalent to a relationship in data modeling circles) has a multiplicity for each direction.

Source

Upvotes: 31

Related Questions