Databases Reference
In-Depth Information
the predicate text to the role from which the association is read. Equality constraints shown
as a circled “=” may also be depicted by a dotted line with arrow-tips at both ends. The
fact types
Role has minimum- Multiplicity
and
Role has maximum- Multiplicity
use a
hyphen
to bind the adjective to the object type term for constraint verbalization. So the uniqueness
and mandatory constraints verbalize as:
each
Role has
exactly one
minimum Multiplicity
;
each
Role has
exactly one
maximum Multiplicity
.
In our metaschema, each association role must be annotated by one of the four frequency
patterns shown in Figure 1(b). The minimum frequency must be 0 or 1, and the maximum
frequency must be 1 or many (denoted here by “n”). These constraints are depicted here
as role value constraints {'0', '1'} and {'1', 'n'} beside the relevant roles. Alternatively,
this situation may be modeled with object value constraints by using the fact types:
Role
has
MinimumMultiplicity {'0', '1'}
;
Role has MaximumMultiplicity {'1','n'}
. But this alternative
makes it awkward to compare minimum and maximum multiplicities, since this must now
be done at the lexical level.
Each xor constraint is identifi ed by a constraint number. The “≥ 2” frequency constraint
on
XorConstraint
spans
OptionalRole
requires each xor constraint to span at least two roles.
The subtype OptionalRole is introduced to ensure that only optional roles may be spanned
by xor constraints. A role is optional if it is possible that some instances of its object type's
population do not play the role—this is the same as an optional role in ORM. A formal sub-
type defi nition is specifi ed textually in FORML (an ORM formal constraint language): this
refers to the actual minimum multiplicity (0), not the multiplicity displayed (1). If relevant,
further restrictions on the constrained roles (e.g., they must belong to associations with the
same predicate text) may be formally specifi ed in an ORM textual language such as FORML
or ConQuer (Bloesch & Halpin, 1997).
Subtyping is modeled by the meta-association
EntityType
is a subtype of
EntityType
. This
allows for multiple inheritance, as well as incomplete sets of subtypes. Single inheritance
may be enforced by strengthening the uniqueness constraint to apply to just the fi rst role
(so the association becomes n:1). If more than one subtype must be introduced, this can be
enforced by adding the frequency constraint “≥ 2” to the second role. The
O
ac,it
annotation
declares the subtyping association to be acyclic and intransitive, allowing only direct, proper
subtype connections.
The association
XorConstraint
is over
EntityType
is derived (as indicated in ORM by
an asterisk). By default, ORM predicates are read top-down or left-to-right. A “
<<
” symbol
reverses this reading direction. ORM allows derivation rules to be specifi ed graphically or
textually. Here, the derivation rule is expressed graphically by the equality constraint (circled
“=”) between the derived association and the indicated projection on the XorConstraint and
EntityType roles. The derivation rule verbalizes formally as:
XorConstraint is over EntityType
if
XorConstraint spans
if an
OptionalRole
thatis a
Role
that
is played by EntityType
. Normally
all constraints on a derived association should themselves be derivable. However, in this
case, the uniqueness constraint on the derived association is not derivable. This is shown
by displaying the constraint in bold (and red for colored displays).
The uniqueness constraint on the derived association asserts:
each
XorConstraint is
over
at most one
EntityType
(i.e., the roles governed by the constraint must be played by
the same entity type). Conceptually, extra constraints on derived associations are enforced
by fi rst materializing the association, and then applying the constraint as a base association.
Although this practice is unusual in most applications, it is quite common in metamodeling ap-
plications to encounter rules that are most conveniently expressed in derived associations.