Annotating a constraint
Stereotypes on a constraint
The stereotypes
used to annotate constraints are presented in the following table:
|
The ... stereotype |
is used to... |
SQL |
|
<<notNull>> |
indicate that the column must have a value. |
NOT NULL |
|
<<null>> |
indicate the column may not have a value. |
NULL |
|
<<unique>> |
Indicate that the values taken by the attribute must be unique for the
entire table. |
UNIQUE |
|
<<check>> |
associate a "check" type constraint to an attribute. |
CHECK |
|
<<rule>> |
associate a "rule" type constraint to an attribute (Sybase). |
CREATE RULE |
|
<<doNotGenerate>> |
indicate that an attribute or a column will not be handled by the
generation operation. |
N/A |
The <<notNull>>
stereotype
The
<<notNull>> stereotype is used for constraints on attributes. It
indicates that the attribute must be valued.
The
<<null>> stereotype
The
<<null>> stereotype is used for constraints on attributes. It
indicates that the column cannot be valued. This stereotype imposes the
generation of a "NULL" constraint in the column corresponding to the
attribute. It allows the use of an "undetermined" when inserting a
tuple for which data has not been entered in the column.
The
<<unique>> stereotype
The
<<unique>> stereotype is used for constraints on attributes. It
indicates that the values taken by the attribute must be unique for the entire
table.
The
<<check>> stereotype
The
<<check>> stereotype is used for constraints on attributes, and is
used to associate a <<check>> type constraint to an attribute.
The <<check>> constraint allows the specification of a Boolean
expression that will have to be checked, in order for a tuple to be inserted
into the table.
This constraint has as its body the logical condition, used as is, for building
the clause's SQL. We recommend that you place this body between inverted commas
for the syntactical analyzer. For example:
{check} ("(att1 + att2) between 1 and 12")
Note: Remember in this case that if you wish to incorporate the " character into the text, you must enter the ~ character before it.
The
<<rule>> stereotype
The
<<rule>> stereotype is used to associate a "rule" type
constraint to an attribute (Sybase only).
The
<<doNotGenerate>> stereotype
The <<doNotGenerate>>
stereotype indicates that an attribute will not be taken into account during
the transformation of the object model into a physical model, and that a column
will not be taken into account during the generation of SQL code from the
physical model.