A constraint is a specification for conditions and propositions that must be maintained as true for the system to be valid. Constraints are expressed as text within braces ({ }) and may be written in a predefined language, such as Object Constraint Language (OCL) or in natural language.
Connect a constraint to one or more elements
Drag the control handle at the center of the Constraint shape and glue it to a connection point on another element.
Name a Constraint shape and add other property values
Double-click the shape. Following are the properties in the dialog box:
Property |
Description |
Name |
Type or edit a name for the constraint. |
Stereotype |
Choose the stereotype you want from the drop-down list. If a stereotype you want to use isn't listed, you can add a new stereotype or edit an existing one by clicking Stereotypes on the UML menu. |
Full Path |
The UML Model Diagram template automatically provides full information about the element's path in the system model hierarchy. You can't edit this information but if you move elements the path automatically updates. |
Body |
Using natural language or a predefined constraint language, write a Boolean expression that must be true when evaluated for a system, otherwise the system is invalid. |
Language |
Choose the language you want to write the constraint in. |
Documentation |
Type any documentation you want to add to the element as a tagged value. When you select the shape or icon representing the element, the documentation you type here also appears in the Documentation window. |
Hide the stereotype on a Constraint shape
Right-click the shape, click Shape Display Options, and then, under General Options, clear Stereotype.
Hide the Constraint shape
Right-click the shape, click Shape Display Options, and then, under General Options, clear Constraint Shape.