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 The Meta-Object Facility (MOF) is an Object Management Group (OMG) standard for model-driven engineering. Its purpose is to provide a type system for entities in the CORBA architecture and a set of interfaces through which those types can be creat ...
(MOF)
Object Management Group The Object Management Group (OMG) is a computer industry standardization, standards consortium. OMG Task Forces develop enterprise integration standards for a range of technologies. Business activities The goal of the OMG was a common portabl ...
(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 QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group. Overview Model transformation is a key technique used in model-driven architecture. As the name QVT indicates, the ...
) 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 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 ...
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 The Meta-Object Facility (MOF) is an Object Management Group (OMG) standard for model-driven engineering. Its purpose is to provide a type system for entities in the CORBA architecture and a set of interfaces through which those types can be creat ...
model more precise by associating assertions with its meta-elements.


OCL and QVT

Of particular importance to
Model Driven Engineering Model-driven engineering (MDE) is a software development methodology that focuses on creating and exploiting domain models, which are conceptual models of all the topics related to a specific problem. Hence, it highlights and aims at abstract r ...
(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 A model transformation, in model-driven engineering, is an automated way of modifying and creating models. An example use of model transformation is ensuring that a family of Computer model, models is consistent, in a precise sense which the softw ...
. The OMG has defined a specific standard for model transformation called MOF/QVT or in short
QVT QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group. Overview Model transformation is a key technique used in model-driven architecture. As the name QVT indicates, the ...
. 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 VIATRA is an open-source model transformation framework based on the Eclipse Modeling Framework (EMF) and hosted by the Eclipse Foundation. VIATRA supports the development of model transformations with specific focus on event-driven, reactive t ...
, or
Tefkat Tefkat is a model transformation language and a model transformation engine. The language is based on F-logic and the theory of stratified logic programs. The engine is an Eclipse plug-in for the Eclipse Modeling Framework (EMF). History T ...
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 QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group. Overview Model transformation is a key technique used in model-driven architecture. As the name QVT indicates, the ...
-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 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 ...
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 ...
. (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, ductility, ...
. 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 transformatio ...
*
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 ce ...
br>GMT Project
*
Gello Expression Language The GELLO Expression Language was started in 2001 and introduced in 2002; in 2005, GELLO was adopted as an international standard by Health Level Seven International and ANSI for a decision support language. GELLO Release 2 was completed and approve ...
*
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 A ''list'' is any set of items in a row. List or lists may also refer to: People * List (surname) Organizations * List College, an undergraduate division of the Jewish Theological Seminary of America * SC Germania List, German rugby union ...
*
Meta-modeling A metamodel or surrogate model is a model of a model, and metamodeling is the process of generating such metamodels. Thus metamodeling or meta-modeling is the analysis, construction and development of the frames, rules, constraints, models and ...
*
Meta-modeling technique A metamodel or surrogate model is a model of a model, and metamodeling is the process of generating such metamodels. Thus metamodeling or meta-modeling is the analysis, construction and development of the frames, rules, constraints, models and ...
*
Meta-Object Facility The Meta-Object Facility (MOF) is an Object Management Group (OMG) standard for model-driven engineering. Its purpose is to provide a type system for entities in the CORBA architecture and a set of interfaces through which those types can be creat ...
(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 Model-driven engineering (MDE) is a software development methodology that focuses on creating and exploiting domain models, which are conceptual models of all the topics related to a specific problem. Hence, it highlights and aims at abstract r ...
(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 the st ...
*
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 traditi ...
*
MOFM2T MOF Model to Text Transformation Language (Mof2Text or MOFM2T) is an Object Management Group (OMG) specification for a model transformation language. Specifically, it can be used to express transformations which transform a model into text (M2T), ...
*
Object-oriented analysis and design Object-oriented analysis and design (OOAD) is a technical approach for analyzing and designing an application, system, or business by applying object-oriented programming, as well as using visual modeling throughout the software development proces ...
(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 A transformation language is a computer language designed to transform some input text in a certain formal language into a modified output text that meets some specific goal. Program transformation systems such as Stratego/XT, TXL, Tom, DMS, ...
(TL) *
UML tool A UML tool is a software application that supports some or all of the notation and semantics associated with the Unified Modeling Language (UML), which is the industry standard general-purpose modeling language for software engineering. ''UML tool ...
*
Vocabulary-based transformation In metadata, a vocabulary-based transformation (VBT) is a transformation aided by the use of a semantic equivalence statements within a controlled vocabulary. Many organizations today require communication between two or more computers. Although ...
* 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