Attribute constraints regard attributes associated with object or protocol classes.
Attribute cardinality constraints specifying the minimum and maximum number of values for attributes. If the attribute cardinality constraint is not specified, then it is by default [0,1] for single-valued attributes, and [0,] for set-valued or list-valued attributes, where an unspecified maximum represents an unlimited number of values.
<cardinality> ::= [ <min> , <max> ] |
| [ <min> , ] |
| <null>
;
<min> ::= /* a positive integer or zero */
;
<max> ;;= /* a positive integer */
;
Note that component attributes of a tuple attribute can have their own cardinality constraints (i.e., [0,1] or [1,1]) that are different from the cardinality constraints for the tuple attribute. A cardinality constraint for a component attribute specifies whether the value of this attribute can or cannot be null.
Referential integrity constraints are implied by an OPM schema and regard abstract attributes or attributes associated with controlled value classes; the values of such attributes must belong to their associated value classes.
Inversion constraints are explicitly specified in an
OPM schema and regard pairs of abstract non-derived attributes.
We use below the following notation:
if A denotes an attribute of object or protocol class
and x denotes an object instance of
,
then
denotes the set of A values for x.
Only single-valued or set-valued attributes can be associated
with inverse constraints,
list-valued attributes cannot have inverses.
Note that inverse constraints are not allowed in an OPM schema
that supports permission model.
A simple or component attribute A of object or protocol class
can be defined as the inverse of a simple attribute B
of object or protocol class
iff
; and
, includes
.
, whenever object y of
belongs to
, x belongs to
.
<inverse constraint> ::= inverse of <class name> . <simple attribute name>
| <null>
;
<component inverse constraints> ::= <comp inverse constraint> | <null>
;
<comp inverse constraint> ::= <comp attribute name> inverse of
<class name> . <simple attribute name>
| <comp inverse constraint> ,
<comp attribute name> inverse of
<class name> . <simple attribute name>
;
The following object class definitions contain examples of attribute constraints:
OBJECT CLASS CHROMOSOME
ID: chromosome_nr
ATTRIBUTE chromosome_nr: [1,1] INTEGER
DESCRIPTION: "chromosome number"
EXAMPLE: "19"
ATTRIBUTE has_map: set-of [0,] MAP
inverse of MAP.has_chromosome
OBJECT CLASS MAP
ID: map_name
ATTRIBUTE map_name: [1,1] VARCHAR (80)
DESCRIPTION: "map name"
ATTRIBUTE has_chromosome: set-of [0,] CHROMOSOME
inverse of CHROMOSOME.has_map