Database Reference
In-Depth Information
Figure 5: An ORM model including an ORM schema and sample fact populations
example, all fact types are unary or binary. We could add
Movie was released in Country
in Year
as a ternary fact type.
ORM classifi es business rules into constraints and derivation rules. The ORM model in
Figure 5 includes constraints but no derivations. The
value constraint
{'M', 'F'} indicates
value constraint
the possible sex codes. Arrow-tipped lines across one or more roles denote
uniqueness con-
straints
, indicating that instantiations of that role sequence must be unique. For example, the
uniqueness constraint on the fi rst role of
Person is of Sex
indicates that entries in the fact
column for that role must be unique. The English version of ORM's formal textual language
verbalizes this constraint as:
each
Person is of
at most one
Sex
.
A solid dot (possibly circled) connected to a set of one or more roles denotes a
man-
datory constraint
over that role set. For example, the mandatory dot connected to the fi rst
datory constraint
role of
Person is of Sex
indicates that
each Person is of
some
Sex
. The mandatory dot
connected to the other two roles played by Person depicts an
inclusive-or constraint
:
each
Person directed
some
Movie
or
reviewed
some
Movie
(possibly both).
The
O
ir symbol connected to the roles of the fact type
Movie is based on Movie
denotes the irrefl exive
ring constraint
:
no
Movie is based on
itself
. The circled subset
symbol “⊆” connected by an arrow from the fi rst role of
Movie was reviewed by Person
to the fi rst role of
Movie was directed by Person
denotes a
subset constraint
, indicating
that the population of the fi rst role must always be a subset of the population of the second
role. In English:
each Movie
that
was reviewed by
some
Persons
also
was directed
by
some
Person
.
A subset constraint is one kind of set-comparison constraint. In general a set-comparison
constraint applies across sequences of compatible role sequences (of one or more roles).
Other varieties of set-comparison constraints are exclusion and equality constraints. For
example, the circled “X” in Figure 5 denotes an
eXclusion constraint
between the role-pairs
eXclusion constraint
that comprise the direction and review predicates. In English:
no
Movie was directed by
and
reviewed by
the same
Person
.