Object Constraint Language
   HOME

TheInfoList



OR:

The Object Constraint Language (OCL) is a
declarative language In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow. Many languages that a ...
describing rules applying to
Unified Modeling Language The Unified Modeling Language (UML) is a general-purpose, developmental modeling language in the field of software engineering that is intended to provide a standard way to visualize the design of a system. The creation of UML was originally m ...
(UML) models developed at IBM and is now part of the UML standard. Initially, OCL was merely a formal specification language extension for UML. OCL may now be used with any Meta-Object Facility (MOF)
Object Management Group The Object Management Group (OMG) is a computer industry standards consortium. OMG Task Forces develop enterprise integration standards for a range of technologies. Business activities The goal of the OMG was a common portable and interoperab ...
(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.


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


Relation


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 meta-elements.


OCL and QVT

Of particular importance to Model Driven Engineering (MDE) or
model-driven architecture Model Driven Architecture (MDA) is a software design approach for the development of software systems. It provides a set of guidelines for the structuring of specifications, which are expressed as models. Model Driven Architecture is a kind of doma ...
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 Great may refer to: Descriptions or measurements * Great, a relative measurement in physical space, see Size * Greatness, being divine, majestic, superior, majestic, or transcendent People * List of people known as "the Great" *Artel Great (born ...
, 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

Being a rule-based validation language,
Schematron Schematron is a rule-based validation language for making assertions about the presence or absence of patterns in XML trees. It is a structural schema language expressed in XML using a small number of elements and XPath. In many implementations ...
may be considered 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 relates to UML or MOF similarly to how Schematron relates to
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable. T ...
. (Note that Schematron uses
XPath XPath (XML Path Language) is an expression language designed to support the query or transformation of XML documents. It was defined by the World Wide Web Consortium (W3C) and can be used to compute values (e.g., strings, numbers, or Boolean v ...
to navigate inside the XML trees.)
Being 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 An alloy is a mixture of chemical elements of which at least one is a metal. Unlike chemical compounds with metallic bases, an alloy will retain all the properties of a metal in the resulting material, such as electrical conductivity, ductili ...
. Automated OCL generation is in principle possible from natural language.


Extensions

Eclipse OCL extends Standard OCL with additional operators and a type for Maps. AgileUML extends Standard OCL with Map and Function types. These extensions are consistent with the map and function types present in modern programming languages such as Python and Swift.


See also

*
Computer model Computer simulation is the process of mathematical modelling, performed on a computer, which is designed to predict the behaviour of, or the outcome of, a real-world or physical system. The reliability of some mathematical models can be deter ...
*
Data mapping In computing and data management, data mapping is the process of creating data element mappings between two distinct data models. Data mapping is used as a first step for a wide variety of data integration tasks, including: * Data transforma ...
*
Domain Specific Language A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging ...
(DSL) * Domain-specific modelling (DSM) *
Eclipse An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three c ...
br>GMT Project
* Gello Expression Language *
Glossary of Unified Modeling Language terms Glossary of Unified Modeling Language (UML) terms provides a compilation of ''terminology'' used in all versions of ''UML'', along with their ''definitions''. Any notable distinctions that may exist between versions are noted with the individual e ...
*
Intentional Programming In computer programming, Intentional Programming is a programming paradigm developed by Charles Simonyi that encodes in software source code the precise ''intention'' which programmers (or users) have in mind when conceiving their work. By using ...
(IP) * List of UML tools * Meta-modeling * Meta-modeling technique * Meta-Object Facility (MOF) *
Metadata Metadata is "data that provides information about other data", but not the content of the data, such as the text of a message or the image itself. There are many distinct types of metadata, including: * Descriptive metadata – the descriptive ...
*
Model-based testing Model-based testing is an application of model-based design for designing and optionally also executing artifacts to perform software testing or system testing. Models can be used to represent the desired behavior of a system under test (SUT), or ...
(MBT) *
Model-driven architecture Model Driven Architecture (MDA) is a software design approach for the development of software systems. It provides a set of guidelines for the structuring of specifications, which are expressed as models. Model Driven Architecture is a kind of doma ...
(MDA) * Model Driven Engineering (MDE) * Model Transformation Language (MTL) *
Modeling language A modeling language is any artificial language that can be used to express information or knowledge or systems in a structure that is defined by a consistent set of rules. The rules are used for interpretation of the meaning of components in th ...
*
Modeling perspectives A modeling perspective in information systems is a particular way to represent pre-selected aspects of a system. Any perspective has a different focus, conceptualization, dedication and visualization of what the model is representing. The tradit ...
* MOFM2T * Object-oriented analysis and design (OOAD) * MOF Queries/Views/Transformations (QVT) *
Semantic translation Semantic translation is the process of using semantic information to aid in the translation of data in one representation or data model to another representation or data model. Semantic translation takes advantage of semantics that associate meani ...
* Transformation language (TL) * UML tool * Vocabulary-based transformation * XMI *
XML transformation language An XML transformation language is a programming language designed specifically to transform an ''input'' XML document into an ''output'' document which satisfies some specific goal. There are two special cases of transformation: * XML to XML: ...
(XTL)


References


External links


OMG OCL specification

OCL Portal - The center for OCL related information


(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





USE (UML-based Specification Environment)
(OCL Tool for model validation, various OCL related publications)
OCL tutorial

NL2OCL
(OCL Tool for invariant generation from NL) {{ISO standards Unified Modeling Language Formal specification languages ISO standards