You can write an Object Constraint Language (OCL) statement
to query the characteristics of UML model elements.
Before you begin
To write an OCL statement, you must have a model or profile
open, and have an OCL resource in your workspace.
About this task
To write an OCL statement in the
Modeling perspective:
Procedure
- In the Project Explorer view, double-click
an OCL resource.
- At the top of the editor, from the Target Model list,
select a target model. This selection determines the available
context elements.
- In the Context Element field, specify
a context element.
- In the editor, type your OCL statement.
- When you type a period ("."), an arrow ("->"), a caret ("^"),
or a double colon ("::"), the content assist window displays a list
of entries from which you can select to continue your statement.
- The self keyword substitutes for the context
element in OCL statements.
- For information about OCL syntax, refer to the UML 2.0 OCL
Specification document.
- To save the OCL resource, click .