Guide to Applying the UML

Chapter 11: The Object Constraint Language (OCL)

This chapter provides an introduction to using the Object Constraint Language (OCL) in composing UML models. Our goal in this chapter is to gain an introductory understanding of how to use the OCL.

11.1 What is the Object Constraint Language (OCL)?

Within the UML, expressions, linguistic formulas that yield values when evaluated, are depicted as strings in a particular language (pseudo-code or another language). The UML assumes that the name of a class or simple data type maps into a classifier reference, but the syntax and semantics of complicated language-dependent expressions are outside the scope of the UML. The UML metamodel unitizes the Object Constraint Language (OCL) to capture constraints specifying the semantic conditions that must be maintained as true for model elements, and the OCL may be used for user (object or data) models to define constraints.

The OCL is a formal or robust, easily readable and writeable, non-programming, implementation-independent language for expressing typed, pure and side-effect-free, precise, and unambiguous constraints, including expressions specifying invariants attached to model elements (classifiers, relationships, stereotypes, operations, attributes, and so forth), preconditions and postconditions attached to operations and methods, guard conditions, navigation between model elements, general rules in the form of conditions and restrictions attached to model elements, and any expression in a UML model.

Because the OCL is a pure and side-effect-free language, the evaluation of an OCL expression may not alter the state of the model or system to which it pertains, but when the expression is evaluated, it simply returns...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Integrated Development Environment (IDE)
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.