Model Validation

model_validation

You use Model Validation to check UML models against known UML rules (which you identify in configuring validation) as well as any constraints defined within the model, using the Object Constraint Language (OCL).

You can run Model Validation against a single UML element, a diagram or an entire package. Validating a UML:

  • Element validates the element and its children, features (attributes and operations) and relationships (connectors)
  • Diagram validates the diagram itself (for correctness) as well as any elements and connectors within the diagram
  • Package validates the package and all subpackages, elements, connectors and diagrams within it.

To use Model Validation, follow the steps below:

  1. Select the package, diagram or element either from the Project Browser or within an open diagram.
  2. Select the Project | Model Validation | Validate Selected menu option, or press [Ctrl]+[Alt]+[V].

Enterprise Architect performs the validation, and displays the results in the Output window (if the Output window does not automatically display, select the View | System Output menu option).

While performing the validation, Enterprise Architect also displays a progress window containing the Cancel Validation button, which enables you to cancel the validation process at any time.

ModelValidationProgressDialog

Alternatively, select the Project | Model Validation | Cancel Validation menu option.

Example Model Violations

The following UML diagram contains several basic violations.

ModelValidationExample

If you run Model Validation on this diagram, Enterprise Architect lists the following violations in the Output window:

ModelValidationExampleOutput

The validation results show that the diagram:

  • Contains a UML ExpansionRegion (ExpansionRegion1) that is missing its child input ExpansionNode
  • Contains an invalid self-generalization on Class2 (UML elements cannot be self-generalized)
  • Contains an OCL violation for the anonymous Association (between Class2 and Object1)
  • Contains a UML ExceptionHandler (ExceptionHandler1) that is missing its child input ObjectNode.

Note:

If you double-click on an error in the Output window, you select the diagram element that the error message refers to.