Creating an OCL Constraint

From RAD Studio
Jump to: navigation, search

Go Up to Object Constraint Language (OCL) Procedures Index

To create a constraint using the Tool Palette

  1. In the Diagram View, open a class diagram (or another diagram supporting constraint elements). On the Tool Palette, choose the Constraint button and click the diagram background. The constraint editor appears.
  2. Type the constraint expression.
  3. Close the editor.
  4. In the Tool Palette, click Constraint link and link the constraint node with the respective modeling element in the diagram.

To create a constraint using the Constraints command on the context menu

  1. In the Model View or in the Diagram View, right-click an element for which a constraint should be created.
  2. Choose Constraints on the context menu.
  3. In the Add/Remove Constraints dialog box, click Add.
  4. Enter the constraint:
    • In the Name field, enter the constraint name.
    • In the Language field, choose OCL or Text.
    • In the Constraint field, enter the constraint text.
  5. Add as many constrains as needed.
  6. Click OK when ready.
Created constraints will be linked with the selected modeling element.


See Also