Figure 8 Some predefined semantics underlying Date.
As a small extension to the current age rule shown earlier, a derivation rule may also be specified for
the derived fact type Person on Date had Age. Using this fact type, the function “age of … on …” may now be
specified over the parameter list (Person, Date). The textual constraint indicated by the subscript “1” in
Figure 7 may now be specified as follows.
Membership.person.[age of Person on Membership.startDate] >= Membership.startDate.year.minimumMemberAge
If a person’s birthdate is not recorded, the age function returns null, and the whole expression evaluates to
unknown. As in SQL, the constraint is violated if and only if it evaluates to false.
Figure 9 shows an ORM subschema for the main details about library loans. The circled “u” depicts an
external uniqueness constraint, indicating that a particular copy (physical instance) of a book can be
identified by combining the call number for the book with the copy number. As well as this composite
identification scheme, a book copy also has a simple identification scheme (its barcode). The circled “=”
depicts an equality constraint (a loan has a paid fine if and only if it had its fine paid on some date).