OCL in UMLAUT

The Object Constraint Language (OCL) in Umlaut

Introduction

The UMLAUT tool supports Design-by-Contract when modeling a software system by allowing the designer to specify constraints on models with the Object Constraint Language (OCL).
Some tools such as checking that Ocl constraints are syntaxically correct, automatically generating Eiffel code from constraints, or evaluating constraints are provided in Umlaut.
After loading a model into Umlaut, the first time you call a function relying on the OCL, UMLAUT automatically search for a package named UML_OCL in your model. If one exists, it it used for all OCL operations. If there is no such package, UMLAUT automatically creates one.

Note

It is strongly recommended that you use the provided UML_OCL package and do not modify it in the current release, as UMLAUT supposes it is compliant with the current OCL standard. This limitation will soon be removed.

All the examples given here are based on the basic Bank Account example.


Listing Constraints

Any number of constraints may be attached to an element in a model.
A Constraint being itself a model-element, it may also have its own constraints.
Constraints are represented in browsers by an icon (this is the standard UML notation for Constraint), if no icon is available for the language in which the constraint is written. Otherwise, the icon specific to the language is used.
In the current release, the following icons are available:

Icons used for Constraints
Language used for the constraint bodyIcon used in browsers
eiffel
ocl
others

To edit the list of constraints attached to a model element, do the following:


Editing a Constraint

To edit a Constraint, just right-click on one of its view. It opens up an editor for the constraint.

A Constraint has two important fields :


Tools

Other tools using constraints and OCL are available in Umlaut.
You access these tools by right-clicking on a Constraint. This opens up a new menu with all OCL tools available.