Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

database - 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 differences between these two terms or are they synonymous?

question from:https://stackoverflow.com/questions/17877582/multiplicity-vs-cardinality

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...