Object Constraint Language
From Wikipedia, the free encyclopedia
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. OCL may now be used with any Meta-Object Facility (MOF) Object Management Group (OMG) meta-model, including UML. 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.
Contents |
[edit] 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:
- a context that defines the limited situation in which the statement is valid
- a property that represents some characteristics of the context (e.g., if the context is a class, a property might be an attribute)
- an operation (e.g., arithmetic, set-oriented) that manipulates or qualifies a property, and
- keywords (e.g., if, then, else, and, or, not, implies) that are used to specify conditional expressions.
[edit] 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.
[edit] OCL and MOF
OCL makes a Meta-Object Facility model more precise by associating assertions with its meta-elements.
[edit] OCL and QVT
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.
[edit] Alternatives
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.
[edit] See also
- Computer model
- Data mapping
- Domain Specific Language (DSL)
- Domain-specific modelling (DSM)
- Eclipse GMT Project
- Glossary of Unified Modeling Language terms
- Intentional Programming (IP)
- List of UML tools
- Meta-model
- Meta-modeling
- Meta-modeling technique
- Meta-Object Facility (MOF)
- Metadata
- Model-based testing (MBT)
- Model-driven architecture (MDA)
- Model Driven Engineering (MDE)
- Model Transformation Language (MTL)
- Modeling language
- Modeling perspectives
- Object-oriented analysis and design (OOAD)
- MOF Queries/Views/Transformations (QVT)
- Semantic translation
- Transformation language (TL)
- UML tool
- Vocabulary-based transformation
- XMI
- XML transformation language (XTL)
[edit] 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)
- MIT paper "Some Shortcomings of OCL"
- OCL page of Klasse Objekten (Octopus OCL checker & Java code generator, book on OCL)
- 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 cetus-links.org
This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.