Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.

OCL Conformance

OCL Conformance rules are applied to validate 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 constraints free of side-effects. You can add OCL constraints to any element, relationship or attribute in Enterprise Architect.

Reported violations

Error ID

Description

Information

MVR040001

OCL violation: «violated OCL»

The element violates the specified OCL constraint.

 

MVR070001

OCL violation: «violated OCL»

The relationship violates the specified OCL constraint.

 

MVR0A0001

OCL violation: «violated OCL»

The attribute violates the specified OCL constraint .

 

Define OCL Constraints

You can add an OCL constraint to a model object by setting OCL as the Constraint type in the object Properties dialog.

For

Detail

See also

An Element

Select Element | Properties > Constraints; in the Type field click on the drop-down arrow and select OCL.

To perform an OCL Validation:

1.Select Package | Model Validation | Configure Validation Rules and select the Element: (OCL) Conformance checkbox
2.Click on the element and select Package | Model Validation | Validate Current Package
 

Any OCL violations are recorded in the Model Validation tab of the System Output window.

 

 

 

 
Model Validation Configuration

Model Validation

A Relationship

On a diagram, right-click on the connector and select the <type> Properties context menu option; select the Constraints page, and in the Type field click on the drop-down arrow and select OCL.

To perform an OCL Validation:

1.Select Package | Model Validation | Configure Validation Rules and select the Relationship: (OCL) Conformance checkbox
2.Click on the connector and select Package | Model Validation | Validate Current Package
 

Any OCL violations are recorded in the Model Validation tab of the System Output window.

 

 

An Attribute

Select Element | Attributes > Constraints; in the Type field click on the drop-down arrow and select OCL.

To perform an OCL Validation:

1.Select Package | Model Validation | Configure Validation Rules and select the Feature: (OCL) Conformance checkbox
2.Click on the element and select Package | Model Validation | Validate Current Package
 

Any OCL violations are recorded in the Model Validation tab of the System Output window.

 

 

Notes

·To have a valid OCL constraint, the syntax must be correctly formed; if the expression is not correct, a message displays stating that the OCL constraint is not valid
 

Learn more