OCL Conformance

The OCL conformance group validates an element, relationship or attribute against any defined constraints in the Object Constraint Language (OCL).

OCL is used to describe expressions on UML models, and to express side-effect free constraints. You can add OCL constraints to any element, relationship or attribute in Enterprise Architect.

Error ID

Description

Information

MVR040001

OCL violation: «violated OCL»

The element violates the OCL constraint specified.

MVR070001

OCL violation: «violated OCL»

The relationship violates the OCL constraint specified.

MVR0A0001

OCL violation: «violated OCL»

The attribute violates the OCL constraint specified.

Important:

To have a valid OCL constraint, the syntax must be correctly formed. If the expression is not correct, Enterprise Architect displays a message stating that the OCL constraint is not valid.

Define OCL Constraints for an Element

You can add OCL constraints to an element using the Properties dialog (Element | Properties). Select the Constraints tab, click on the Type drop-down arrow and select OCL.

OCLConstraintElement

To perform an OCL Validation, display the Model Validation Configuration dialog and select the Element: (OCL) Conformance checkbox. Any OCL violations are recorded in the Model Validation tab of the Output window.

Define OCL Constraints for a Relationship

You can add OCL constraints to a relationship using the Properties dialog (right-click and select the <type> Properties context menu option). Select the Constraints tab, click on the Type drop-down arrow and select OCL.

OCLConstraintRelationship

To perform an OCL Validation, display the Model Validation Configuration dialog and select the Relationship: (OCL) Conformance checkbox. Any OCL violations are recorded in the Model Validation tab of the Output window.

Define OCL Constraints for an Attribute

You can add OCL constraints to a feature using the Properties dialog (Element | Attributes). Select the Constraints tab, click on the Type drop-down arrow and select OCL.

OCLConstraintFeature

To perform an OCL Validation, display the Model Validation Configuration dialog and select the Feature: (OCL) Conformance checkbox. Any OCL violations are recorded in the Model Validation tab of the Output window.