Entity Modelling

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


The Scope Concept

The example in figure 3 models another aspect of play; it shows two composition relationships (which have been left unlabelled) and one reference relationship doubly labelled.

  • a play is composed of one or more spoken lines
  • a play is composed of one or more characters
  • a spoken line is assigned to exactly one character
  • each line of a play is assigned to a character of that same play
Figure 3
Composition and reference within the script of a play

In terms of our understanding of a domain of discourse it is significant that reference relationships may be limited in scope - the instances of the reference relationship shown in figure 3 are local to the context of individual plays: as part of the structure of a play, a line is never assigned to a character of a different play - we might summarise the situation by saying that assignment is intra-play not inter-play. We have chosen to express this fact of limited scope in bullet (iv) of figure 3 and it is significant that the diagram alone does not express this fact1. Most significantly, the Entity Relationship diagram notation is able to express the types and cardinalities of reference relationships and how they are articulated but not their scopes. Nonetheless every reference relationship has a scope, the scope is fundamentally important, it can be expressed in words, or, as we see later, in equations, or in a subordinate diagram called a scope diagram.

Contrast the situation of figure 3 with that of figure 4. Figure 4 is similar in shape but the difference is that the reference relationship shown is not limited in scope. Rather the point of the relationship translation is to cross languages - it establishes an inter-language relationship rather than intra-language relationship. This again shows that the scope of a relationship - the extent to which it is global or local - inter or intra - cannot be deduced from the entity relationship diagram. Other means of expression must be used. Gaining an understanding of scope and the means of its expression is an important part of learning entity modelling.

  • a language has one or more native books
  • a language has one or more translated books
  • a translated book is a translation of exactly one native book
  • a native book is translated as zero,one or more translated books
Figure 4
Translations of a book

A further example is given in figure 5 in which there is an example of a reference relationship between types at different levels in a composition hierarchy.

  • a recipe has one or more ingredients
  • a recipe has one or more steps
  • a step has one or more full or partial uses of zero, one or more ingredients
  • a thing used makes reference to zero or one ingredients
  • if a thing used in a step of a recipe makes reference to an ingredient then the ingredient is an ingredient within the very same recipe
Figure 5
Recipes and their ingredients. In this figure bullets (i) to (iv) restate what is said in the diagram. Bullet (v) adds to the diagram - it is a scope statement for relationship use of.

1Bullet (iv) of figure 3 adds to the information given in the diagram and is different in this respect to bullets (i),(ii),(iii) for these simply restate what is already asserted by the diagram