Constraints are only available in the NIAM view, and they are used for modeling limitations on the relations between entities. There are three types of constraints:
- Uniqueness constraint for indicating the key of an entity for uniquely identifying the entity. Is linked to attributes of an entity.
- Exclusion constraint for indicating that each of the entities excludes the other. Is linked to predicates of a fact.
- Completeness constraint for indicating that two entities together complete the collection. Is linked to predicates of a fact.
Uniquely identifying an entity with uniqueness constraints
Like keys in a Crows Foot logical view, uniqueness constraints can be used for uniquely identifying an entity by linking it to one or more attributes in the entity. A single entity can have multiple uniqueness constraints.
To model the key, add a Uniqueness constraint object to the view. After that connect the key to the attributes in the entity you want to make part of this key by using a Link relation.
Setting a sequence number for uniqueness constraints
If multiple uniqueness constraints are used, it is possible to assign them a sequence number. To assign a sequel number, follow these steps:
- In the view, select the uniqueness constraint, and then click
- In the Enter sequence number window, type the number and click OK.
The sequence number is now displayed in the constraint:
Displaying the name of a constraint relation
When a constraint is linked to an attribute in an entity or to a fact, only the constraint is shown with a relation to the other element. To explicitly show which element the constraint is linked to, you can display the name of the relation. To display the name, do as follows:
- In the view, select the constraint, and then click the name that appears below the constraint.
The name is now displayed below the constraint:
You can hide the name again by clicking it.