If you applied the «validationRule» stereotype to the Constraint element, you must specify the following validation rule properties in its Specification window: AbbreviationError Message, and Severity.


To specify the validation rule properties


  1. Open the Constraint Specification window. How to open the Specification window >>
  2. On the right side of the window, find the Validation Rule group.
  3. Specify the following properties:

    • Abbreviation. Select the Abbreviation property value box, click Edit and type a short word, phase, acronym of the validation rule. It allows you to distinguish the validation rules among other rules when sorting or filtering.

    • Error Message. Select the Error Message property value box, click Edit and type the description of the invalid situation when this validation rule fails.

      If you need to define the variable error message, you can embed expressions directly in the Error Message value box by using curly brackets - {}. Everything between them is treated as an expression and evaluated for each validation result. Expressions are treated as OCL2.0 expressions by default, but you can also use binary expressions: {bin: <binary expression>}. For example, in the following error message the budget is calculated according to variables. The result of the expression is provided as number in the Validation Results panel, e.g. Budget not  balanced - overbudget by $500.

      Budget not  balanced - overbudget by {
      ResearchProject::allInstances().budget->sum() - 
      Sponsor::allInstances().contribution->sum()}$

      You can insert a hyperlink. Learn more about defining hyperlinks >>

    • Severity. Select the Severity property value and from the drop-down list select one of the following severity levels:
      • debug - for missing information of a constrained element that is dedicated for the developer.
      • info - for missing information of a constrained element that is dedicated mostly for the end-user.
      • warning - for incorrect situations that can cause errors. It is used for less severe situations than the error.
      • error - for incorrect situations that must be solved.
      • fatal - for critical errors such as model corruption or model is invalid according to the UML metamodel. This severity level is mostly reserved for future use.

        The icons on invalid elements in the model depend on the selected severity level described above. Learn more about invalid elements representation >> 

        You can customize severity levels. How to customize severity levels >>

  4. Click Close.
    The validation rule properties are specified.