Entity Modelling

www.entitymodelling.org - entity modelling introduced from first principles - relational database design theory and practice - dependent type theory


Recursive Reference

The notation introduced for composition relationships has been descriptive of properties of relationships including cardinality and optionality (the crows foot and dashing of lines), exclusion (the exclusion arc) and use of abstraction (nested boxes). These notations apply equally to the representation of reference relationships. A reference relationship can be looped around to relate instances of a single type and it is then said to be recursive. If it is many-one then a hierarchical1 system of entities is implied such as a command hierarchy:

A reference relationship can be looped around to enter the opposite edge with no difference in meaning so the following is equivalent:

Consider also a chain composed of links each connected to the next. Each link of a chain is followed by the next and each link follows at most one other which is to say there is a recursive relationship:

For a more complete model see figure 9.

  • every chain has many links
  • every chain has a start which is a link
  • every chain has an end which is a link
  • every link maybe followed by a link which is then said to follow that link
  • every link is either the start of a chain or follows a link
  • every link is either the end of a chain or is followed by a link
Figure 9
Chain of Links

Some recursive relationships cannot be given a different role at either end for they are symmetric. For example x1 is married to x2 precisely if x2 is married to x1. Marriage is a symmetric binary relationship. When this relationship is shown in an entity model then it must be given the same the name at either end as so:

As a shorthand we can compress this to a single line:

The example in figure 10 combines composition structure (molecule has atoms has bonds formed) and reference structure atoms reference elements of the periodic table and bonds formed reference each other.

  • every molecule consists of one or more atoms
  • every atom is an instance of a chemical element
  • every atom has zero,one or more bonds formed
  • every bond formed is with a bond formed (which is then with it)
Figure 10
Molecular Structure

1we use the term somewhat loosely for there is nothing in the notation which implies an absence of cycles