5 Nesting the Relational Model

This chapter explains the shift from the unnested n-ary relations of the conventional Relational Model to Predica's nested domains with unary predicate extensions.

The conventional RM is unnested

When Codd introduced the RM he described First Normal Form (1NF), where there are no repeating groups, attribute types are "atomic" or simple, there are no nested relations and no hierarchical structure inside tuples.

The conventional RM is unnested in exactly this sense: hierarchical structure is not permitted inside tuples. This absence of nesting is core to the use of the RM as envisaged by Codd.

A conventional relational database has relation variables (relvars) which record n-ary relations which are the extensions of n-ary predicates about the world.

For example, for the relvar for suppliers:

S1,Smith,20,London S2,Jones,10,Paris S3,Blake,30,Paris S4,Clark,20,London S5,Adams,30,Athens

Predica : nesting the RM

There is an important change in thinking required to understand Predica for those familiar with the RM.

Predica does not reject hierarchical structure; it embraces it. This decomposes the n-ary predicates/relations into unary predicates/relations. Predicates are simpler, but there are more of them, allowing for recording the same information as the unnested RM.

The restriction to unary predicates and relations sounds severely limiting. One might surely think this is fatal for representing the kind of information that can be recorded in the RM. Although each Predica predicate is unary, their composition preserves the information represented by n-ary relations while allowing that information to be organised through nested domain structure.

The following ideas explain how Predica recovers the expressive power of the RM while adopting a radically different structure:

  • A domain may be recursively split into smaller domains ("subdomains"). This decomposition is mirrored by nested types. Predica does not require every attribute type to be simple, but it does keep multiplicity in attribute extensions rather than in collection-valued attribute values.
  • The decomposition from domains to subdomains and smaller subdomains and so on is mirrored in the use of nested types.
  • The unnested RM makes a distinction between relvars (which hold relations), and tuple attributes (which hold atomic values). There is no such distinction in Predica. There are just attributes, and an attribute records its extension.
  • The information recorded about a domain is represented by the extensions of its attributes.
  • Every attribute of a domain is a unary predicate on that domain.
  • The restriction to unary predicates forces decomposition.

Predica decomposition of Supplier

The decomposition is easiest to see in stages. Start with a single supplier domain and one of its attributes. For that supplier, the attribute S# is a unary predicate whose extension contains one value:

S#
S1

Now add the other attributes for the same supplier. This gives four unary predicate extensions:

Supplier S1

S1   Smith   20   London

At first glance, restricting all predicates to be unary seems to lose the correlations that ordinary n-ary relations record. If all we kept were separate global projections for S#, SNAME, STATUS, and CITY, the original supplier relation would not be recoverable. The nesting is doing important work here: these are not four independent global projections. They are correlated because they belong to the same supplier element.

Now regard each supplier itself as an entity in the extension of the outer unary predicate Supplier:

Supplier

Supplier S1

Supplier S2

Supplier S3

Supplier S4

Supplier S5

Expanding each supplier gives a picture that deliberately resembles the ordinary supplier relation. But structurally it has been turned into nesting: the outer unary predicate Supplier has five elements, and inside each element the former columns appear as extensions of unary predicates:

Supplier
S1   Smith   20   London
S2   Jones   10   Paris
S3   Blake   30   Paris
S4   Clark   20   London
S5   Adams   30   Athens

In this decomposition, each attribute of Supplier records its extension. This is exactly the same information as the corresponding column in the unnested 4-ary relation. Nothing is lost: the supplier number, name, status, and city are all represented as facts of unary predicates. What changes is the structural organisation of those facts. Instead of being bundled together into a single n-ary tuple, they are distributed across simpler predicates that can be composed through the domain structure.

This illustrates the central idea of Predica's approach to nesting: the expressive power of the relational model does not come from n-ary tuples, but from the logical relationships among predicates. By decomposing domains into subdomains and representing attributes as unary predicates, Predica preserves the same information while allowing domains and their types to be recursively composed—structure that the unnested RM deliberately excludes. The absence of nesting in the conventional RM is not a logical necessity but a design choice; Predica shows how to recover the same semantics in a compositional form.