EntityLogic.org

www.entitylogic.org - entity modelling introduced from first principles


The Notation in a Nutshell

Reference relationships are a second class of relationships and are distinguished from composition relationships by being depicted connecting to the side edges of the boxes representing entity types rather than to the upper and lower edges. Without distinction, connection to the left or right hand side of the boxes can be made; the side can be chosen for the convenience for the drawing. A text label at one end of a relationship line serves to describe the relationship from the point of view of the subject entity at that end. For example, we can say a chicken lays an egg or that an egg is laid by a chicken. Though there is a single relationship between chicken and egg there are two ways of articulating it and accordingly the relationship is shown labelled at each end:

For convenience of the diagramming we can, without changing the meaning, turn this about so:

A chicken hatches from an egg too and we can add this to the diagram like so:

Of course, what we see here represented on the diagram are types of things not actual things - so the diagram does not express that a chicken lays the very same egg that it hatches from: rather that a chicken lays things of the type egg and that it is hatched from a thing of the same type.

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 1.

  • 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 1
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 2 illustrates this notation in use.

  • 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 2
Molecular Structure

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