4 Supplier-and-Parts Database
The following example appears in Chris Date's book An introduction to Database Systems. There are three relvars in the schema, used to represent suppliers, parts and shipments. It is a conventional normalised relational database schema.
Schema in Tutorial D versus Predica
Chris Date and Hugh Darwen defined a language named Tutorial D which is faithful to the Relational Model.
Here is a side by side comparison of the schema for the Supplier-and-parts database expressed in Tutorial D and Predica:
| Tutorial D | Predica |
|---|---|
|
|
The two schemas organise the same subject matter in different ways. The following table compares their database variables, nominal types, attributes, predicates, and constraints.
| Aspect | Tutorial D | Predica |
|---|---|---|
| Database variables | Three relvars named S, P, and SP. |
One database variable of type ShipmentsSystem. |
| Nominal types | No nominal types representing suppliers, parts, or shipments. | ShipmentsSystem, Supplier, Part, and Shipment. |
| Composition | No corresponding composition of S, P, and SP into a database type. |
The types Supplier, Part, and Shipment are composed to define ShipmentsSystem. |
| Attributes | 12 attributes across the relation types of S, P, and SP. |
17 attributes across the nominal entity types Supplier, Part, Shipment, and
ShipmentsSystem. |
| Predicates | Three n-ary predicates, represented by the relvars S, P, and SP. |
17 unary predicates, one for each attribute. |
| Constraints |
|
|
Example queries
The following examples express the same queries in Tutorial D and Predica, and show the logical frame denoted by each Predica path expression. These frames are obtained by the formally specified, compositional mapping defined in Part XIV: Semantics, and in particular in 150 Denotation of Tuples, Filtering, and Composition.
Suppliers located in London
| Description | Return the names of suppliers located in London. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Parts supplied by supplier S1
| Description | Return the names of parts supplied by the supplier whose identifier is S1. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Shipments with a quantity greater than 300
| Description | Return the supplier identifier, part identifier, and quantity for shipments whose quantity is greater than 300. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Suppliers of part P2
| Description | Return the names of suppliers that supply the part whose identifier is P2. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Suppliers who supply all red parts
| Description | Return the suppliers that supply every red part. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Suppliers for which all shipped parts are red
| Description | Return the suppliers for which every part they ship is red. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Supplier city, part city, and shipment quantity
| Description | Return the supplier city, part city, and quantity for every shipment. |
|---|---|
| Tutorial D | |
| Predica | |
| Logical denotation | |
Queries with unary predicates
The mapping into logic is independent of attribute cardinality constraints.
Each predicate in the formula of this denotation is unary, and yet the conjunction expresses exactly the same result as the relational algebra expression using n-ary predicates.
A conjunction of unary predicates over shared existential variables behaves as a relation with arbitrary:
- arity
- join structure
- constraints
- projections
- renamings
- navigation paths
- multiplicities
- optionalities
- cardinality patterns
The “n-ary-ness” is not in the predicates. It is in the pattern of shared variables. Unary predicates are local and simple. But when you conjoin them, you recover the full expressive power of n-ary predicates in a way that is:
- compositional
- navigational
- readable
- type-safe
- aligned with domain decomposition
- aligned with first-order logic semantics
This is one of the key conceptual advantages of Predica: it exposes the underlying logical structure directly, without requiring n-ary predicates to express n-ary relationships.
Decomposing a domain into unary predicates removes the rigid arity-coupling that binds attributes together in n-ary tuple structures. Each attribute becomes an independent predicate whose optionality, multiplicity, and evolution can be expressed without reshaping the surrounding domain. This aligns with Predica’s broader principle that domains decompose recursively into subdomains, producing models that are modular, deeply structured, and easier to extend.
Relationship to graph queries
The logical denotations above are reminiscent of graph-database pattern matching. Graph query languages (Cypher, SPARQL, Gremlin, GQL) are all, at their core, syntactic sugar over first-order logic with existential quantification and conjunction.
Each existential variable corresponds to a node, each attribute corresponds to an edge or property, and the conjunction of unary predicates forms a graph pattern. Predica achieves this expressiveness without requiring graph-database storage structures or pointer semantics.
Graph databases internally bind nodes, follow edges, constrain properties and return a projection. Predica expresses the same logical structure using unary predicates and attribute navigation.