Database Reference
In-Depth Information
age approval, but not both . Here the unary fact type caters for the case where a person
does not supply his/her birth date, (e.g., he/she may not wish to divulge it, or might not
know it) but can have the minimum age requirement approved by authorized library staff
(e.g., visual inspection of a person who is obviously old).
Notice the use of hyphens in the fact types Year has minimum-member Age and Year
has normal-loan Period . This causes the hyphenated and any subsequent words before
the following term for the object type to be bound to that term for verbalization purposes.
For example, the uniqueness constraint on the fi rst of these fact types verbalizes as, “ each
Year has at most one minimum member Age ” instead of, “ each Yeas has minimum
member at most one Age ”.
As discussed later, role names displayed in square brackets are used to provide func-
tion names for derivation rules that make use of attribute-style notation. The second role of
predicates with the reading “has” is assumed to have the name of the second object type,
with the fi rst letter in lower-case, unless an explicit role name overrides this. For example,
the second role of Person has PersonName is named “personName”. For binary predi-
cates with a reading comprised of “has” followed by a hyphenated phrase, the second role
has a default name obtained by prepending the hyphenated phrase to the right-hand object
type term. For example, the second role of the fact type Year has normal-loan Period is
“normalLoanPeriod”.
The superscript “ 1 ” on the fact type Membership was issued to Person indicates the
existence of a textual constraint on this fact type. The asterisk “*” on the fact type Person
has Age indicates that this fact type is derived . In a complete ORM model, all constraints
derived
that cannot be expressed in graphical notation as well as all derivation rules (to indicate
how derived fact types are derived from other fact types) should be specifi ed in a formal,
textual language. For example, the derivation rule for Person has Age may be specifi ed
in attribute-style as shown below. Here, dayOfYearNr denotes the sequential position of the
day in its year (e.g., 2003 September 14 has dayOfYearNr 257).
Person.age = today.year - Person.birthdate.year if today.dayOfYearNr >= Person.birthdate.dayOf-
if
YearNr else = today.year - Person.birthdate.year + 1
if today.dayOfYearNr >= Person.birthdate.dayOf-
This formulation makes use of various operations (e.g., date subtraction) and functions
(e.g., year) that are predefi ned for Date. Figure 8 summarizes some of the main underly-
ing semantics from an ORM perspective. Each circled “u” depicts an external uniqueness
constraint , indicating that each Year, DayOfYearNr combination and each Year, MonthNr,
DayNr combination refers to only one Date. While the mdy (month-day-year) format for
dates is used for communication purposes, internally dates may be implemented otherwise
(e.g., as Julian dates). Fundamentally, ORM uses relational-style, over which an attribute-
style may be defi ned. The nullary function “today” is defi ned as the result of the query ! Date
is today (using “!” to prepend each desired projection). The role names “dayOfYearNr”,
“year”, “monthNr”, “dayNr” on the right-hand roles of the derived predicates may be used
as function names in attribute-style rules.
As a small extension to the current age rule shown earlier, a derivation rule may also
be specifi ed for the derived fact type Person on Date had Age . Using this fact type, the
function “age of … on …” may now be specifi ed over the parameter list (Person, Date).
The textual constraint indicated by the subscript “1” in Figure 7 may now be specifi ed as
follows:
Search WWH ::




Custom Search