Entity Modelling

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


Goodness of an Entity Model

Though we often have alternate, sometime conflicting, ways of seeing and articulating ‘what is’ in the world, it is the purpose of an entity model to present a single, self-consistent set of concepts that is minimal for a particular domain and, in a well-defined way that is to be explained here, does not introduce relationships needlessly.

For example, for minimally expressing, ‘what is’ in kinship, the grandparent relationship is needless — it should be omitted in favour of the parent-child relationship from which, as parent's parent, it can be derived. So it is with brother as parent's male child, uncle as parent's brother i.e. parent's parent's male child, and likewise sister and aunt, grandfather, cousin— all these relationships can be constructed from the parent-child relationship and the male and female typing of individuals. These latter relationships form a core, as shown in figure 23, from which the others can be derived.

We use the terms derived and constructed interchangeably and we need to be clear what it means to say that the relationship grandparent can be derived or constructed from the parent-child relationship — what it means is that if one party communicates to another (i) a set of individuals and (ii) the parent-child relationships between them then nothing new is added to this by a further communication of (iii) the grandparent-grandchild relationships between the same set of individuals.

We say that the grandparent-grandchild relationship can be constructed from the parent-child relationship but note that what we actually mean by this is that in any given situation information about who is whose grand parent can be constructed from information about who is whose parent.

Figure 23
The core family relationships

The Golden Rule

Inferrable relationships such as grandparent-grandchild one are said to be constructed and need to be contrasted with the core relationships from which they can be constructed. The golden rule of entity modelling is that it should not be possible to construct any of the relationships within an entity model from combinations of the others.

The golden rule is a prerequisite for a goodness criteria within database design technically referred to as ‘normal form’. Rather than just accept this condition we must understand what is achieved by meeting the condition; to do so it is helpful to keep in mind that meeting the condition and coming up with a good entity model requires a skill and that this skill is, to all intents and purposes, the ancient Euclidean skill of good theorizing by which I mean the articulation of a minimum set of assumptions or givens and their separation from that which can be derived or inferred from them. For our present purpose good modelling is good theorising and to borrow from Occam's dictum it is not multiplying relationships needlessly.

Illustration 1

Atoms are related to protons (and neutrons too for that matter), for each atom contains one or more protons, but the relationship was not represented on the model of figure 24 nor should it have been for to do so would have broken the golden rule since this is a relationship which can be constructed or inferred from the ones already present. The construction can be summarised thus:

From

every atom contains exactly one nucleus (1)
and
every nucleus contains one or more protons (2)
derive
every atom contains one or more protons. (3)

This represents the inference of a new relationship from old and is a further example of a join construction:

Figure 24
Atomic Structure

What is illustrated here is a general rule that if ‘every A has parts of type B’ and ‘every B has parts of type C’ then ‘every A has parts of type C’. This is precisely the relationship join construction applied to a pair of many-valued composition relationships. The rub is that the relationship can appear in a core model — it is just that it cannot appear in the model of figure 24. Figure 25 illustrates this. This is a model which does contain the relationship but which does not does not break the golden rule. The model in figure 25 is appropriate in modelling situations where the localisation of protons and neutrons to the nucleus is irrelevant to the task at hand. There is nothing necessarily inherent, therefore, in the distinction between core and constructed — in one model a relationship may be core while in a different model it may be constructed.

Figure 25
Atomic Structure

Illustration 2

Consider the model of a four-finger flight formation in figure 26. All is well with this model until examination of the subject matter reveals that in all cases the flight leader is the leader of the lead element of the flight. This is to say that flight leader is a relationship that can be constructed from the others. With this knowledge, the model of figure 26 is seen to break the golden rule by representing the flight leader relationship unnecessarily.

Figure 26
The Four-Finger Flight Formation
Figure 27
The flightleader is the leader of the lead element of the formation.

Finally

The first priority of an entity model is the description of core relationships and it is misleading, and, for some purposes, wrong, to include constructed relationships in an entity model so as to confuse them with the core.