Entity Modelling

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


Derived Attributes

We can now expand on something said earlier in the section regarding the goodness of an entity model and in particular regarding the core and the absence of redundancy. It is the first priority of an entity model to represent a core set of relationships and attributes; the rule is —it should not be possible to derive or infer the content of any one of the core attributes or relationships from the values of the others. For example the value of ‘weight(kgs)’ can be inferred from that of ‘weight(lbs)’ and so the two of them should not both be present in the core; one needs to be picked as the core and the other documented along with rule by which it is derived. When an attribute is not chosen for the core but instead has a rule defined for it by which its value can be calculated from the core then it is said to be a derived attribute.

Likewise choose date of birth as a core attribute, rather than age, choose attributes like adresss line 1,address line 2,... zip code as core attributes not simply address which can be derived from the others.

There are exceptions to the rule stated above in regard to information systems implementations which are either layered and/or distributed, and, of course, most are and those that are not probably should be. In such implementations one layer may be responsible for the derivation of the non-core attributes and relationships; to layers external to this the non-core attributes appear to be core i.e follow a model in which they are core despite the fact that there are prescribed rules by which they can be derived.

Example - Relative Atomic Mass as a Derived Attribute

Entity models may have greater or lesser amounts of detail, depending on the purpose at hand, and the model of chemical elements that we presented in the previous section isn't the whole story, either intellectually, so as to do justice to the physics, or practically for the purposes of scientists detecting and analysing samples using mass spectroscopy; for them the fact that each chemical element has a number of istopes comes into play — the relative abundancies of the isotopes becomes significant and also, to a mass spectroscopist, the mass of the most abundant isotope. Once we add the entity type isotope along with its relative isotopic mass attribute to the entity model then the relative atomic mass attribute of a chemical element can no longer be regarded as a core attribute. In the model in figure 5, instead of removing it from the diagram altogether I have shown it with a hollow marker and followed it with parentheses. This is a reminder that this attributes isn't core — it is an attribute which can be calculated from the core by following a rule. The diagram doesn't specify the rule so that will need to be documented separately.

  • an element has one or more isotopes, one or more allotropes and one or more valences
  • uniqueness — an isotope is uniquely identified by its parent element and its numberOfNeutrons,
  • uniqueness — an allotrope is uniquely identified by its name,
  • uniqueness — a valency is uniquely identified by its parent element and its number,
  • rule — the relative atomic mass of an element is equal to the sum of the relative isotopic masses of its isotopes weighted by their abundancy ratio.
Figure 5
Chemical element — the relative atomic mass is an example of a derived attribute1.

Summary

To summarise, we have introduced the following notation for attributes:

In addition we underline those attributes which are identifying.


1Because it is derived from children in the composition hierarchy some computer scientists would refer to it as a synthetic attribute.