Prev Next

Constraints

If you need to define the conditions and rules under which an element operates and exists, you can do this by setting Constraints on the element, in conjunction with its responsibilities (internal requirements). Typical constraints are pre- and post-conditions, which indicate things that must be true before the element is created or accessed and things that must be true after the element is destroyed or its action is complete.

You can show the constraints for an element directly on the diagram, using the element 'Compartment Visibility' function; this also reveals any constraints inherited from parent elements.

Access

On a diagram or in the Project Browser, select an element and:

Ribbon

Start > Explore > Properties > Constraints     (Responsibilities window)

Start > Explore > Browse > Element Browser > Constraints > Double-click on a constraint  (Responsibilities window)

Design > Element > Responsibilities > Constraints

Design > Element > Properties > Properties Dialog > Responsibilities > Constraints  (Properties dialog)

Context Menu

Right-click on element | Properties | Responsibilities > Constraints

Keyboard Shortcuts

Ctrl+Shift+3 > Constraints  (Responsibilities window)

Alt+Enter > Constraints   ('Properties' dialog)

Shift+Alt+C   ('Properties' dialog)

Other

Double-click on element : Constraints  ('Properties' dialog)

Define constraints for an element

Constraint

Type the name or value of the constraint.

Type

Click on the drop-down arrow and select the appropriate type (Pre-condition, Post-condition, Process, OCL or Invariant).

Status

Click on the drop-down arrow and select the appropriate status.

Notes

Type in any additional details or comments on the constraint. You can format the notes text using the Notes toolbar at the top of the field.

New

(On the 'Properties' dialog) Click on this button to clear the fields ready to create a new constraint.

(On the Responsibilities window) Click on the button in the window toolbar.

Save

(On the 'Properties' dialog) Click on this button to save the constraint data.

(On the Responsibilities window) Click on the button in the window toolbar.

Defined Constraints

This field lists the constraints defined in the element, showing the constraint name, type and status.

To display the corresponding 'Constraints' panel in the Responsibilities window, click on the drop-down arrow at the end of the 'Constraint' field.

Delete

(On the 'Properties' dialog) Click on a constraint in the 'Defined Constraints' list and click on this button to immediately remove the constraint from the element.

(On the Responsibilities window) Click on the constraint in the 'Constraint' field, or on one of the constraints in the Constraints panel, and click on the icon in the window toolbar.

(If you have two or more constraints in the element.) Click on a constraint in the Defined Constraints list and click on one of these buttons to move the constraint one position up or down in the list.

In the Responsibilities window, these buttons can be found (and take action) in the 'Constraints' panel; click on the drop-down arrow at the end of the 'Constraint' field.

Learn more