Entity Modelling

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

Diagrams Expressing Scopes

To summarise, the plays part of relationship is limited in scope. In the specific context of a cast member, the part they play is in the same play as the performance is a performance of.

The relationship plays part of has a type constraint : in its proper usage it has to relate cast members with characters but it also has a scope constraint: that the character is, necessarily, a character within the context of the play being performed.

Figure 38
A scope constraint diagram for relationship plays part of. In such a diagram it is the lower horizontal relationship which is the subject of the constraint. By saying that this is a scope constraint diagram we mean that the two navigation paths from the lower left entity type cast member to the upper right entity type play are equivalent. This can be said in words:
  • Whenever a cast member plays the part of a character then the performance the cast member is part of is a performance of the play the character is a part of.

or as the equation:

↷/‥ = ‥/of
where represents navigation in the many-one direction of the subject relationship and represents navigation up the diagram along the dependency to a parent entity.

In category theory terminology this is a diagram that commutes, see section questions of commutativity

In mathematical notation it is possible to include the scope constraint as a more general kind of type constraint than can be expressed in an entity model, namely a dependent type constraint. In entity modelling this is not possible and every relationship defined in a model should have a scope constraint specified for it. There is no standard way of doing this but an accompanying diagram, one per associative relationship is a satisfactory way of doing this. Figure 38 is the scope constraint diagram for relationship plays part of.

The diagram in figure 39 can be interpreted as the scope constraint for the relationship assigned to within the context of the entity models of figure 33. The text on the right of the figure explains the constraint expressed by the scope diagram - it seems obvious but this is so only if we know this model and this relationship i.e. providing we understand its proper usage. In this example there is a single entity type at the top of the diagram - therefore we call the diagram a scope triangle rather than a scope square.

If we allow of the use of identity relationship in a scope square and allow it to be drawn horizontally then any scope triangle can be re-expressed as a scope square as illustrated by figure 40.

  • Whenever a line of a play is assigned to a character then the play the character is part of is the same play as the line is part of.
Figure 39
A scope constraint diagram for relationship assigned to. This is a scope triangle because rooted at a single entity type. Equivalently we can annotate the subject relationship with the equation

Some relationships may be unconstrained in their scope in the sense that they are global in their reach. We have given an example of such a relationship, translation of, in figure 34. The scope of this relationship, the fact that it is unconstrained, is expressed by the relationship scope diagram in figure 41. By way of explanation - what this diagram says is :

The absolute of the language of a translated book is the absolute of the language of the native book it is a translation of.

In other words it says that the relationship translation of is such that two absolutes are equal - which is to say nothing at all about the relationship because a priori all absolutes are equal as absolute is unique of its type.

Figure 40
The identity relationship is same as used to express the scope triangle of figure 39 as a square.
Figure 41
An example of a scope diagram for a relationship which is unconstrained in scope - the scope diagram is rooted at absolute.

Further example

Ryle's second example is of a child witnessing the march-past of a division of soldiers. After having had battalions, batteries, squadrons, etc. pointed out, the child asks when is the division going to appear. ‘The march-past was not a parade of battalions, batteries, squadrons and a division; it was a parade of the battalions, batteries and squadrons of a division.’.

The child might have asked further in discussion of a battalion and its sergeant major, to what battalion does the sergeant major belong? This would have been to fail to understand the scope of the sergeant major or leader relationship (see figure 42). Contrast this to asking in a discussion of a university examination of what institution an external examiner belongs.

It is part of our understanding of the sergeant major relationship that a sergeant major is a soldier within the company, battalion or squadron of which he is the leader.

Figure 42
Based on Ryle's second example of category mistakes.

Scope Squares - A Warning

Not all relationship squares are scope squares. In the model of figure 43 the obvious square is not a scope square1. Instead the relationship stays in is global in scope i.e unconstrained. As such its scope square is as shown is figure 44.

Figure 43
The relationship stays-in is not constrained : a cast member stays in a hotel but this does not have to be in the same town that the performance is at.
Figure 44
The scope square for the unconstrained relationship stays in.

1Mathematicians would say that the diagram does not commute.