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 the 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 the 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 a character within the context of the play being performed.

Figure 11
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 an incoming 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 11 is the scope constraint diagram for relationship plays part of.

The diagram in figure 12 can be interpreted as the scope constraints for relationship assigned to within the context of the entity models of figure 3. 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 13.

  • 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 12
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 4. The scope of this relationship, the fact that it is unconstrained, is expressed by the relationship scope diagram in figure 14. 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 13
The identity relationship is same as used to express the scope triangle of figure 12 as a square.
Figure 14
An example of a scope diagram for a relationship which is unconstrained in scope - the scope diagram is rooted at absolute.