Chapter 7. Basic OCL Elements

This chapter describes the basic elements with which you can write constraints. These basic elements can be used without any reference to the elements in the UML model.

Expressions, Types, and Values

In OCL, each value, whether it is an object, a component instance, or a datavalue, has a certain type, which defines the operations that can be applied to the object. Types in OCL are divided into the following groups:

  • Predefined types, as defined in the standard library, including the following:

    • Basic types

    • Collection types

  • User-defined types

The predefined basic types are Integer, Real, String, and Boolean, which are described in this chapter in some detail. Their definitions are similar to those in many known languages.

Get Object Constraint Language, The: Getting Your Models Ready for MDA, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.