Introduction

Legend

Text written in the Courier New typeface as shown below is an OCL expression.

'This is an OCL expression'

The context keyword introduces the context for the expression. The keyword inv, pre and post denote the tereotypes, respectively «invariant», «precondition», and «postcondition», of the constraint. The actual OCL expression comes after the colon.

context TypeName inv:
'this is an OCL expression with stereotype <<invariant>> in the
context of TypeName' = 'another string'

In the examples the keywords of OCL are written in boldface in this document. The boldface has no formal meaning, but  is used to make the expressions more readable in this document. OCL expressions are written using ASCII characters only.

Words in Italics within the main text of the paragraphs refer to parts of OCL expressions.
 

Example Class Diagram

The diagram below is used in the examples in this chapter.