General Constraints

General constraints specify information about what is and is not valid. They differ from other constraints in having no restrictions on means or form of expression. General constraints can be informal, human-language statements, or they can be fully formalized as algebraic statements or first-order logic. General constraints can apply to ORM's, OBM's, state nets, OIM's, or any combination of them.

General Constraints in Object-Relationship Models

The Botswana Youth Zoo keeps both rhesus monkeys and baboons in the same enclosure. Suppose that there must be at least twice as many rhesus monkeys as baboons, otherwise the baboons may kill the monkeys. We can easily show that baboons and the monkeys are both kept in the Monkey House, as in Figure 1, but we need a general constraint to express the relation between the number of baboons and monkeys at the BY Zoo.

Figure 1. General constraint on number of baboons and monkeys

We could have stated the constraint more formally by using variables in the participation constraints and giving an algebraic relation, as in Figure 2.

Figure 2. Using an algebraic formula as a general constraint.

General Constraints in Object-Behavior Models

General constraints may be used to specify behaviors which are non-deterministic or unconstrained. For example, a transition with more than one subsequent state conjunction selects one completely non-deterministically. However there may be constraints on the choice.

Suppose a docent may show either parrots or hawks at the 2:00 PM bird show. On any particular day the docent may get either one depending on the mood of the docent and the birds. But on the average the docent should choose them equally often so none of the birds are overworked.

Figure 3 shows the part of a state net when the docent gets the birds and begins the show. This does not match the requirement since there is no constraint on the state following the transition. For instance, the docent could choose parrots every time.

Figure 3. Wrong model: unconstrained choice of subsequent state.

A general constraint can specify the result we want. Figure 4 shows when the docent gets the birds and begins the show, like Figure 3, but the general constraint "Parrots and hawks must be chosen equally often in the long run." indicates the docent must even out the choices on average.

Figure 4. General constraint on choice of subsequent state.

General Constraints in Object-Interaction Models

In an OIM general constraints may refine specified interactions. For example, they may clarify how transactions in one part of an interaction are related to transactions in another part.

Use of General Constraints

Use specific constraints, such as co-occurrence, participation, object class cardinality, or real-time constraints, etc. instead of general constraints whenever possible.

Here is a short quiz so you can test your understanding of general constraints.
Go to the ORM Tutorial

Go to Specialization Constraints High-Level Relationship Sets

 OSM Home Page CS Dept Home Page  BYU Home Page
Created Tue Sep 20 14:15:49 1994 ...
Updated Wed Nov 23 14:23:06 1994
by Paul E. Black (