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 app ...
describing rules applying to
Unified Modeling Language The Unified Modeling Language (UML) is a general-purpose visual modeling language that is intended to provide a standard way to visualize the design of a system. UML provides a standard notation for many types of diagrams which can be roughly ...
(UML) models developed at
IBM International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
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 cre ...
(MOF)
Object Management Group The Object Management Group (OMG®) is a computer industry Standards Development Organization (SDO), or Voluntary Consensus Standards Body (VCSB). OMG develops enterprise integration and modeling standards for a range of technologies. Busin ...
(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 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 cre ...
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 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 (bo ...
,
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 ...
, 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 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 data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
. (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) in 1999, and can be used to compute values (e.g., strings, numbers, or ...
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 in most cases at least one is a metal, metallic element, although it is also sometimes used for mixtures of elements; herein only metallic alloys are described. Metallic alloys often have prop ...
. 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 running of a mathematical model on a computer, the model being designed to represent the behaviour of, or the outcome of, a real-world or physical system. The reliability of some mathematical models can be determin ...
*
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 which 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 ...
br>GMT Project
* Gello Expression Language * Glossary of Unified Modeling Language terms * List of UML tools *
Meta-modeling A metamodel 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 theories applica ...
* Meta-modeling technique *
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 cre ...
(MOF) *
Metadata Metadata (or metainformation) is "data that provides information about other data", but not the content of the data itself, such as the text of a message or the image itself. There are many distinct types of metadata, including: * 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 (MDA) * Model Driven Engineering (MDE) * Model Transformation Language (MTL) *
Modeling language A modeling language is any artificial language that can be used to express data, 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 ...
* Modeling perspectives * MOFM2T *
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 pro ...
(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 mean ...
* Transformation language (TL) * 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. Althoug ...
* XMI * XML transformation language (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) * (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