A Constraint represents additional semantic information attached to the constrained elements. It is an assertion that indicates a restriction that must be satisfied by a correct design of the system. The constrained elements are those elements required to evaluate the constraint specification. In addition, the context of the Constraint can be accessed, and can be used as the namespace for interpreting names used in the specification.

A Constraint is represented as a linguistic, enclosed in braces ({}), statement in some formal (OCL, C++, and other), or a natural language. There are 14 standard constraints in UML such as association, global, and parameter. You can also define your own constraints.

You can create the following constraints:

  • Time Constraint. It specifies the combination of min and max timing interval values.
  • Duration Constraint. It defines a value specification that indicates the temporal distance between two time instants.
  • Constraint. It represents an additional semantic information attached to the constrained elements.
  • Constraint Link. It is a graphical representation of a constraint element.

Example of constraints


Constraints for validation

Constraints can also be used to define validation rules for your model.