7 Identity
Example where the RM needs artificial surrogate keys
Predica’s structural identity eliminates the need for surrogate keys in situations where the RM is forced to introduce them.
Consider a box of objects that are uniquely identified by their shape and colors. There are no other identifying attributes. The following Predica schema represents the required information and models the constraints:
variant Shape
{
{ Real radius } sphere;
{ Real side } cube;
{ Real radius, Real height } cone;
}
enum Color
{
red, green, blue
}
entity Object
{
Shape shape;
Color color+;
}
entity Box
{
Object object*;
}
This can be mapped to Tutorial D as follows:
| Predica | Tutorial D |
|---|---|
|
|
|
|
|
|
|
|
1NF forbids representing the multivalued color+ attribute as a value, so the RM must split it into a
separate relvar. That split destroys the natural identity of an object, forcing the introduction of a
surrogate key to maintain identity across relvars.