Database Reference
In-Depth Information
Membership.person.[age of Person on Membership.startDate] >= Membership.startDate.year.mini-
mumMemberAge
If a person's birth date 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 8 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 topic can be identifi ed by combining the call number for the topic with the
copy number. As well as this composite identifi cation scheme, a topic copy also has a simple
identifi cation scheme (its barcode). The circled “=” depicts an equality constraint (a loan
has a paid fi ne if and only if it had its fi ne paid on some date).
Each loan is for exactly one topic copy. The subset constraint between the loan-return
and loan-end associations declares that each loan that was returned on a date also ended on
the same date. The superscripts “ 2 ” and “ 3 ” on fact types indicate that a textual constraint
applies to them. In this case, the textual constraints are listed below the diagram. For each
derived fact type (asterisked), a formal derivation rule declares how instances of the fact
type may be derived from other facts. This example includes four derivation rules displayed
below the diagram. ORM rules and queries (Bloesch & Halpin, 1997) may be formally speci-
fi ed in relational style and/or attribute-style (using role names and/or defi ned functions).
The fi rst derivation rule is expressed in relational style, the second rule in a combination of
relational and attribute styles, and the last two rules in attribute style. The derivation rule
for unpaid fi nes determines the fi ne currently accrued for an overdue loan—this amount
may vary over time. The derivation rule for paid fi nes enables the system to compute the
fi ne amount actually paid. The predefi ned nrUnits function converts a unit-based amount
(e.g., three days) into a pure number (e.g., 3). This function may apply to any expression
that returns a unit-based type, and enhances semantic stability by protecting rules against
changes to choice of units.
Figure 9: ORM subschemas for details about Topics and Shipments
Search WWH ::




Custom Search