World Library  
Flag as Inappropriate
Email this Article

Object Constraint Language

Article Id: WHEBN0000409006
Reproduction Date:

Title: Object Constraint Language  
Author: World Heritage Encyclopedia
Language: English
Subject: ECO (Domain Driven Design), KeY, Meta-Object Facility, Unified Modeling Language, Query language
Collection: Formal Specification Languages, Iso Standards, Unified Modeling Language
Publisher: World Heritage Encyclopedia

Object Constraint Language

The 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.


  • Description 1
  • Relation 2
    • OCL and UML 2.1
    • OCL and MOF 2.2
    • OCL and QVT 2.3
  • Alternatives 3
  • See also 4
  • References 5
  • External links 6


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 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 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 makes a Meta-Object Facility model more precise by associating assertions with its meta-elements.


Of particular importance to Model Driven Engineering (MDE) 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.


As a rule-based validation language, Schematron may be considered as an alternative to OCL. However Schematron works for Extensible Markup Language (XML) trees while OCL makes it possible to navigate MOF-based models and meta-models (i.e. XML Metadata Interchange (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 meta-model with side-effect-free annotations, OCL could be replaced by languages like Alloy.

See also


  1. ^ Object Management Group (OMG); Object Constraint Language Specification, Chapter 7 of OMG Unified Modeling Language Specification, Version 1.3, March 2000 (first edition)
  2. ^ Object Management Group (OMG); Object Constraint Language OMG Available Specification Version 2.0, May 2006

External links

  • OMG OCL specification page
  • OCL Portal - The center for OCL related information
  • OCL page of Computer Science Dept. of CSUSB (brief OCL 2.0 syntax)
  • Octopus: OCL Tool for Precise Uml Specifications (OCL checker)
  • Dresden OCL Toolkit (OCL Toolkit, various OCL related publications)
  • HOL-OCL (An interactive theorem proof environment for OCL, various OCL related publications)
  • OCL for Java tutorial on ParlezUML
  • Article on using EMF's OCL in Java code
  • UML link page on
  • USE (UML-based Specification Environment) (OCL Tool for model validation, various OCL related publications)
  • OCL tutorial

This article is based on material taken from the Free On-line Dictionary of Computing prior to 1 November 2008 and incorporated under the "relicensing" terms of the GFDL, version 1.3 or later.

This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.