Object Constraint Language

The Object Constraint Language (OCL) is a declarative language describing rules applying to Unified Modeling Language (UML) models developed at IBM and is now part of the UML standard. Initially, OCL was merely a formal specification language extension for 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.


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.


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. (Note that Schematron uses XPath 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. Automated OCL generation is possible through Natural Language like NL2OCL.[3]


Constraint OCL Equivilent
The age of a person is not negative. context Person inv: self.age >=0
A person is younger than its parents. context Person inv: self.parents->forAll(p|p.age>self.age)
After a birthday, a person becomes one year older. context Person::hasBirthday() post: self.age=self.age@pre+1
A Person has 2 parents at max. context Person inv: self.parents->size()<=2
After somebody got a child, his/her child-set is not empty, and it is larger than before. context Person::getsChild() post: self.childs->notEmpty() and self.childs->size() > self.childs@pre->size()
Only an adult can be owner of a car. context Person inv: self.age<18 implies self.cars->isEmpty()
The first registration of a car can not be before it is built. context Auto inv: self.registration>=self.constructionYear
Every Person that has a car has at least one car which is younger than the Person. context Person inv: self.cars->notEmpty() implies self.cars->exists( c | Calendar.YEAR - c.constructionYear < self.age)
Nobody can be his/her own parent. context Person inv: self.parents->excludes(self)
There's at least one Person which owns a car. context Person inv: Person.allInstances()->exists(p | p.cars->size() > 0)

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
  3. ^ Imran Sarwar Bajwa (October 2010). "OCL Constraints Generation from Natural Language Specification, 2010". IEEE.

External links

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.

Alloy (specification language)

In computer science and software engineering, Alloy is a declarative specification language for expressing complex structural constraints and behavior in a software system. Alloy provides a simple structural modeling tool based on first-order logic. Alloy is targeted at the creation of micro-models that can then be automatically checked for correctness. Alloy specifications can be checked using the alloy analyzer.

Although Alloy is designed with automatic analysis in mind, Alloy differs from many specification languages designed for model-checking in that it permits the definition of infinite models. The Alloy Analyzer is designed to perform finite scope checks even on infinite models.

The Alloy language and analyzer are developed by a team led by Daniel Jackson at the Massachusetts Institute of Technology in the United States.

Bold for Delphi

Bold for Delphi was an advanced Object Relational Mapper (ORM) and application framework written in Delphi. It was designed to significantly increase developer's productivity providing them with the following facilities:

Object-relational mapping for persisting domain objects

UML modeling of domain classes

Object Constraint Language (OCL) as means of making queries (in-memory or to DB)

In-memory transactions and Undo/Redo functionality

A powerful mechanism to subscribe to calculated values by derived attributes.

Borland Together

Together is a product from Borland, formerly from TogetherSoft (acquired by Borland in 2003), that currently integrates a Java IDE, which originally had its roots in JBuilder, with a UML modeling tool.

The product line was previously sold in three levels of functionality: Together Developer, Together Designer, and Together Architect; however, since 2007, Together has been unified into a single product. Earlier versions of the Together products were completely proprietary self-contained applications, whereas since the 2006 version Together has been based on Eclipse. The installation allows installing Together using an existing Eclipse installation.

Together is implemented as a set of Eclipse plugins. Together Developer provides Unified Modeling Language (UML) 1.4 modeling, multilanguage support, physical data modeling, design patterns, source code design pattern recognition, code template design and reuse, documentation generation, and code audits and metrics. Together adds language-neutral UML 2.0 diagramming, business process modeling, and logical data model, and logical to physical data model transformation and custom pattern support.

Together currently uses the Eclipse 4.3.1 platform.BPMN diagrams can be created by import from and used to generate output to business process execution language with Web Services definitions (BPEL4WS).

Audits and metrics are provided at both the model and code level, defined in Object Constraint Language (OCL) 2.0.

Together supports Design Patterns, Java 6, C++, CORBA, and Query/View/Transformation model transformations.

Common warehouse metamodel

The common warehouse metamodel (CWM) defines a specification for modeling metadata for relational, non-relational, multi-dimensional, and most other objects found in a data warehousing environment. The specification is released and owned by the Object Management Group, which also claims a trademark in the use of "CWM".

ECO (software framework)

ECO (Enterprise Core Objects), is a software framework suited for Domain-Driven-Design (DDD) from Capable Objects AB, designed to increase productivity by utilizing facilities such as Object-relational mapping (ORM) for persisting domain objects, UML models for domain classes and executable State Machines for behavior control defined in UML notation. The ECO framework is intended to be an all-in-one solution for enterprise development and includes in-memory transactions and Undo/Redo functionality as well as easy binding with UI layer. ECO unites ORM framework and UML modeling tools with instant code generation and an OCL expression evaluator for simplified in-memory and DB queries, business rules and other useful facilities.

ECO5 is targeted to .NET Framework and is only available for development environment Visual Studio. Users of RAD Studio can still download ECO4.

Eclipse (software)

Eclipse is an integrated development environment (IDE) used in computer programming, and is the most widely used Java IDE. It contains a base workspace and an extensible plug-in system for customizing the environment. Eclipse is written mostly in Java and its primary use is for developing Java applications, but it may also be used to develop applications in other programming languages via plug-ins, including Ada, ABAP, C, C++, C#, Clojure, COBOL, D, Erlang, Fortran, Groovy, Haskell, JavaScript, Julia, Lasso, Lua, NATURAL, Perl, PHP, Prolog, Python, R, Ruby (including Ruby on Rails framework), Rust, Scala, and Scheme. It can also be used to develop documents with LaTeX (via a TeXlipse plug-in) and packages for the software Mathematica. Development environments include the Eclipse Java development tools (JDT) for Java and Scala, Eclipse CDT for C/C++, and Eclipse PDT for PHP, among others.

The initial codebase originated from IBM VisualAge. The Eclipse software development kit (SDK), which includes the Java development tools, is meant for Java developers. Users can extend its abilities by installing plug-ins written for the Eclipse Platform, such as development toolkits for other programming languages, and can write and contribute their own plug-in modules. Since the introduction of the OSGi implementation (Equinox) in version 3 of Eclipse, plug-ins can be plugged-stopped dynamically and are termed (OSGI) bundlesEclipse software development kit (SDK) is free and open-source software, released under the terms of the Eclipse Public License, although it is incompatible with the GNU General Public License. It was one of the first IDEs to run under GNU Classpath and it runs without problems under IcedTea.

Executable UML

Executable UML (xtUML or xUML) is both a software development method and a highly abstract software language. It was described for the first time in 2002 in the book "Executable UML: A Foundation for Model-Driven Architecture". The language "combines a subset of the UML (Unified Modeling Language) graphical notation with executable semantics and timing rules." The Executable UML method is the successor to the Shlaer–Mellor method.Executable UML models "can be run, tested, debugged, and measured for performance.", and can be compiled into a less abstract programming language to target a specific implementation. Executable UML supports model-driven architecture (MDA) through specification of platform-independent models, and the compilation of the platform-independent models into platform-specific models.

Formal methods

In computer science, specifically software engineering and hardware engineering, formal methods are a particular kind of mathematically based technique for the specification, development and verification of software and hardware systems. The use of formal methods for software and hardware design is motivated by the expectation that, as in other engineering disciplines, performing appropriate mathematical analysis can contribute to the reliability and robustness of a design.Formal methods are best described as the application of a fairly broad variety of theoretical computer science fundamentals, in particular logic calculi, formal languages, automata theory, discrete event dynamic system and program semantics, but also type systems and algebraic data types to problems in software and hardware specification and verification.

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 approved by ANSI in June 2010.

The GELLO specifications have been developed in coordination with the HL7 Clinical Decision Support TC (CDSTC)GELLO is a class-based object-oriented programming language and a relative of the Object Constraint Language (OCL). OCL is a well-developed constraint language that makes it attractive for use as an expression language. The intention was for GELLO to evolve as a standard query and expression language for decision support.GELLO creates the potential for many decision support options, as the full array of atomic patient data is greatly accessible to complement better, safer clinical decision making by health professionals. Furthermore, this enables specialist clinicians to customize their current systems and create flexible purpose built decision support systems.Standardization of GELLO it has made this language compatible with the HL7 version 3.0 Reference Information Model (RIM). GELLO uses an abstract "virtual medical record" (vMR) so that the same GELLO code can run on multiple systems accessing data stored in different formats. The vMR is a simplified view of the HL7 RIM.

Glossary of Unified Modeling Language terms

This glossary of Unified Modeling Language terms covers all versions of UML. Individual entries will point out any distinctions that exist between versions.

Metadata registry

A metadata registry is a central location in an organization where metadata definitions are stored and maintained in a controlled method.

A metadata repository is the database where metadata is stored. The registry also adds relationships with related metadata types.


The initialism OCL can have several meanings, depending on context:

OCl−, the hypochlorite ion, in chemistry

Object Constraint Language

IBM Open Class Library

Operational Control Language of IBM mid-range computers

Osama Com Laude, Pakistani-American rapper

Overseas Containers Limited, former shipping company

Object-role modeling

Object-role modeling (ORM) is used to model the semantics of a universe of discourse. ORM is often used for data modeling and software engineering.

An object-role model uses graphical symbols that are based on first order predicate logic and set theory to enable the modeler to create an unambiguous definition of an arbitrary universe of discourse. Attribute free, the predicates of an ORM Model lend themselves to the analysis and design of graph database models in as much as ORM was originally conceived to benefit relational database design.

The term "object-role model" was coined in the 1970s and ORM based tools have been used for more than 30 years – principally for data modeling. More recently ORM has been used to model business rules, XML-Schemas,

data warehouses, requirements engineering and web forms.

Platform-specific model

A platform-specific model is a model of a software or business system that is linked to a specific technological platform (e.g. a specific programming language, operating system, document file format or database). Platform-specific models are indispensable for the actual implementation of a system.

For example, a need to implement an online shop. The system will need to store information regarding users, goods, credit cards, etc. The designer might decide to use for this purpose an Oracle database. For this to work, the designer will need to express concepts (e.g. the concept of a user) in a relational model using the Oracle's SQL dialect. This Oracle's specific relational model is an example of a Platform-specific model.

The term platform-specific model is most frequently used in the context of the MDA approach. This MDA approach corresponds the OMG vision of Model Driven Engineering. The main idea is that it should be possible to use a MTL to transform a Platform-independent model into a Platform-specific model. In order to achieve this transformation, one can use a language compliant to the newly defined QVT standard. Examples of such languages are AndroMDA, VIATRA or ATL.


QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group.

Query language

Query languages or data query languages (DQLs) are computer languages used to make queries in databases and information systems.

Syntropy (software)

Syntropy is a second-generation object-oriented analysis and software design method developed at Object Designers Limited in the UK during the early 1990s. The goal in developing Syntropy was to provide a set of modelling techniques that would allow precise specification and would keep separate different areas of concern. The approach was to take established techniques, as found in methods such as the Object-modeling technique and Booch method, and reposition and refine them. In recognition that graphical notations were much favoured by the market but lacked rigour, Syntropy adopted ideas from formal specification languages, specifically Z notation, to provide tools for both precise definition of the graphical notations and for the construction of richer models than are possible with pictures alone.

Although development on the Syntropy method stopped some years ago, many of its ideas were subsequently incorporated in the Unified Modeling Language, in the Catalysis software design method, and in other development processes. In particular, Syntropy is a direct ancestor of the Object Constraint Language that forms an integral part of the UML.

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 motivated by the desire to standardize the disparate notational systems and approaches to software design. It was developed by Grady Booch, Ivar Jacobson and James Rumbaugh at Rational Software in 1994–1995, with further development led by them through 1996.In 1997 UML was adopted as a standard by the Object Management Group (OMG), and has been managed by this organization ever since. In 2005 UML was also published by the International Organization for Standardization (ISO) as an approved ISO standard. Since then the standard has been periodically revised to cover the latest revision of UML.

Z notation

The Z notation is a formal specification language used for describing and modelling computing systems. It is targeted at the clear specification of computer programs and computer-based systems in general.

In current use
ISO standards by standard number

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.