OCL Expressions


Object Constraint Language (OCL) is a declarative language for describing rules that apply to Unified Modeling Language (UML) models developed at IBM and now part of the UML standard. Initially, OCL was only a formal specification language extension to UML.[1] OCL may now be used with any Meta-Object Facility(MOF), Object Management Group(OMG), meta-model, including UML.[2] The Object Constraint Language is a precise text language that provides constraint and object query expressions on any MOF model or meta-model that cannot otherwise be expressed by diagrammatic notation. OCL is a key component of the new OMG standard recommendation for transforming models, the Queries/Views/Transformations (QVT) specification.
Different ways MDriven relies on OCL:
  • As a constraint definition on a class
  • As a description of derivation rule on derived attributes
  • As a description of derivation of derived associations
  • As ViewModel columns and Nesting definitions
  • As definitions for Visible and Enable state for ViewModel columns
  • As an expression of style information on ViewModel columns
  • As an expression for object presentation on classes
  • Action Enable expression
  • State machine Guards

OCL expression must be without side effects. It is a query language and as such it is not expected to change data as the language is applied.

Learn more:

The MDriven Book - Next Chapter: Certain important constructs

This page was edited 41 days ago on 10/03/2024. What links here