To validate elements that are not used in a diagram


  1. Create a Package and apply the «activeValidationSuite» stereotype.
  2. Under the created Package, create a Constraint and apply the «validationRule» stereotype.
  3. Specify the Severity, Error Message, and Abbreviation for the created validation rule.
  4. Specify the constrained element - metaclasses and stereotypes whose instances are validated if not used on the diagram.
  5. Click to specify the Specification property.
  6. From the Language drop-down list, select a StructuredExpression. 

  7. Click Expert at the bottom of the dialog. The dialog is switched to the Expert mode.
  8. In the Body area of the Specification dialog, click Create Operation.
  9. Click the Operation from Model operation type on the right side of the dialog.

  10. Select the Not opaque behavior from the model.

     The Apply Filter check box must be unselected!

  11. On the left side of the dialog, select the parameter of the Not operation and press Delete.
  12. On the right side of the dialog, click the Operation from Model operation type.
  13. Select the IsEmpty opaque behavior from the model.

     The Apply Filter check box must be unselected!

  14. On the right side of the dialog, click the Operation from Model operation type.
  15. Select the UsageInDiagrams opaque behavior from the model.

     The Apply Filter check box must be unselected!

  16. On the left side of the dialog, click the Element parameter of the UsageInDiagrams operation and press Delete.
  17. Select the Contextual Variable from the Other category.