www.entitymodelling.org - entity modelling introduced from first principles - relational database design theory and practice - dependent type theory
In figure 7 we give an example logical ER model whose pattern of relationships1 follows a pattern of morphisms that is given in an exercise in category theory to students at Cambridge by Julia Goedecke2 and which can be used as a striking illustration of the inadequacy of taking a ‘one relationship at a time’ approach to achieve transformation of logical model into a physical model — an approach which Chen describes and which we provide an alternative for in our Relational Data Design section.
In this example ER model there are twelve relationships connecting eight entity types as the twelve edges of a cube connect its vertices. Each of the squares of relationships corresponding to the faces of the cube forms a commutative diagram; thus there are six in all corresponding to the six faces of a cube. In fact each such square is a pullback square and so with this example we also illustrate the occurrence of pullbacks in data modelling. Some of these commuting diagrams are scope diagrams and this gives us a form in which we can express them declaratively in an ER model. Other of the commuting diagrams can be expressed as key constraints. From the combined declarations of scope and of key constraint, a physical design which are redundancy free can be generated - in this way, using these insights from category theory, the normalisation stage is rendered unnecessary.
the 1st, 2nd, 3rd, 4th and 6th diagrams are pullback diagrams by defintion. The fifth diagram is a pullback by implication. The former are scope constraints. the latter a key constraint.