Using stereotypes and constraints to extend the meaning of
model elements
Stereotypes are applied to model elements to identify
their purpose and extend their meaning. Constraints are applied
to model elements to identify a condition that a model element must
satisfy or a restriction on a model element.
Applying constraints to model elements
In UML models, you can apply a constraint to model elements to indicate that the constraint imposes a condition or restriction on the model elements.
Specifying body language for the constraints of model elements
In UML models, you can specify the language that is used
to write the body of a constraint so that others who read the constraint
can more easily understand its condition or restriction. The body
can be written using a variety of languages, including natural languages
such as English, programming languages such as Java™,
a mathematical notation, or the Object Constraint Language (OCL).
For more information about OCL, read the Unified Modeling Language
2.0 Superstructure specification that is available on the Object
Management Group (OMG) Web site.
Specifying bodies for the constraints of model elements
In UML models, the body of a constraint is a statement that defines a condition or a restriction that the constraint imposes on the model element to which it is attached. The statement should be a Boolean expression and yield a true value when evaluated in order for the model to be well formed.
Validating OCL constraints
In UML models, you can validate the syntax of a constraint that has been defined by using Object Constraint Language (OCL). You can also express the body of a constraint using a natural language such as English, a programming language, or a mathematical notation. For more information about OCL, read the Unified Modeling Language specification that is available on the Object Management Group (OMG) Web site.