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.

The syntax and the expression of a constraint are validated if the constraint has the «metaConstraint» stereotype applied to it or is defined in a profile. Only the syntax of a constraint is validated if it does not have the «metaConstraint» stereotype applied to it and it is not defined in a profile.

To validate an OCL constraint, in the Model Explorer view or in the diagram editor, right-click a constraint; then click Run Validation.
The results of the validation are displayed in the Console view.

Parent topic: Using stereotypes and constraints to extend the meaning of model elements

Related concepts
Constraints

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.