User:Ottomachin/relationships, roles and cardinalities

Relationships, roles and cardinalities
In Chen's original paper he gives an example of a relationship and its roles. He describes a relationship "marriage" and its two roles "husband" and "wife".

A person plays the role of husband in a marriage (relationship) and another person plays the role of wife in the (same) marriage. These words are nouns. That is no surprise, naming things requires a noun.

However as is quite usual with new ideas, many eagerly appropriated the new terminology but then applied it to their own old ideas. Thus the lines, arrows and crows-feet of their diagrams owed more to the earlier Bachman diagrams than to Chen's relationship diamonds. And they similarly misunderstood other important concepts.

In particular, it became fashionable (now almost to the point of exclusivity) to "name" relationships and roles as verbs or phrases.

Relationship naming
Thus a song has a relationship "performs" to singer. Oops! said this the wrong way round thus highlighting the first problem with verbs - they are directional. "I'm married to you - NO! I'm married to YOU" etc.

And if I was to say "the song and the performer are related by a performs (relationship)" or that "the husband and wife are related by an is-married-to (relationship)" then I am obviously speaking gibberish. Correct English would be "the song and the performer are related by a performance" and "the husband and wife are related by a marriage" and this now makes grammatical sense.

Relationship names are nouns: ownership, friendship, partnership, relationship!, marriage, carriage, shipment, treatment, assignment are all relationships and their endings give some insight into the naming of relationships in English (gerunds are also quite common).

Role naming
It has also become prevalent to name roles with phrases eg. is-the-owner-of and is-owned-by etc. Correct nouns in this case are "owner" and "possession". Thus "person plays the role of owner" and "car plays the role of possession" rather than "person plays the role of is-the-owner-of" etc.

The use of nouns has direct benefit when generating physical implementations from semantic models. When a person has two relationships with car then it is possible to very simply generate names such as "owner_person" and "driver_person" which are immediately meaningful.

Cardinalities
Chen's insight was perspicacious but the many have almost managed to bury his genius.

However some modifications to the original specification are beneficial. Chen described look-across cardinalities. UML perpetuates this. (As an aside, the Barker-Ellis notation used in Oracle Designer, uses same-side for minimum cardinality (analogous to optionality) and role but look-across for maximum cardinality (the crows foot)).

Other authors (Merise, El Masri & Navathe amongst others) prefer same-side for roles and both minimum and maximum cardinalities. Recent researchers (Genova etc.) have shown that this is more coherent when applied to n-ary relationships of order >2.