Object Constraint Language

Object Constraint Language

The Object Constraint Language is a declarative language for describing rules that apply to UML models developed at IBM and now part of the UML standard. Initially OCL was only a formal specification language extension to UML. OCL may now be used with any Meta-Object Facility OMG metamodel, including UML. The Object Constraint Language is a precise text language that provides constraint and object query expressions on any Meta-Object Facility model or metamodel that cannot otherwise be expressed by diagrammatic notation. OCL is a key component of the new OMG standard recommendation for transforming models, the QVT specification.

Description

OCL is a descendant of Syntropy, a second-generation object-oriented analysis and design method. The OCL 1.4 definition specified a constraint language. In OCL 2.0, the definition has been extended to include general object query language definitions.

OCL language statements are constructed in four parts:

  1. a context that defines the limited situation in which the statement is valid
  2. a property that represents some characteristics of the context (e.g., if the context is a class, a property might be an attribute)
  3. an operation (e.g., arithmetic, set-oriented) that manipulates or qualifies a property, and
  4. keywords (e.g., if, then, else, and, or, not, implies) that are used to specify conditional expressions.

OCL and UML

OCL supplements UML by providing expressions that have neither the ambiguities of natural language nor the inherent difficulty of using complex mathematics. OCL is also a navigation language for graph-based models.

OCL and MOF

OCL makes a Meta-Object Facility model more precise by associating assertions with its metaelements.

OCL and QVT

Of particular importance to Model Driven Engineering or model-driven architecture is the notion of Model transformation. The OMG has defined a specific standard for model transformation called MOF/QVT or in short QVT. Several model transformation languages like GReAT, VIATRA, or Tefkat are presently available, with different levels of compliance with the QVT standard. Many of these languages are built on top of OCL, which is the main part of the QVT-compliance.

Alternatives

As a rule-based validation language, Schematron may be considered as an alternative to OCL. However Schematron works for XML trees while OCL makes it possible to navigate MOF-based models and metamodels (i.e. XMI trees). In other words, OCL has a similar relation to UML or MOF as Schematron has to XML. (Note that Schematron uses XPath to navigate inside the XML trees.)
As a model specification language permitting designers to decorate a model or a metamodel with side-effect free annotations, OCL could be replaced by languages like Alloy.

See also

External links

Search another word or see object constraint languageon Dictionary | Thesaurus |Spanish
Copyright © 2014 Dictionary.com, LLC. All rights reserved.
  • Please Login or Sign Up to use the Recent Searches feature