This article needs to be updated.(April 2018) |
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. [3]
OCL statements are constructed in four parts:
OCL supplements UML by providing expressions that have neither the ambiguities of natural language nor the inherent difficulty of using complex mathematics. [3] 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 in principle possible from natural language. [4]
Constraint | OCL Equivalent |
---|---|
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 has 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) |
Eclipse OCL [5] extends Standard OCL with additional operators and a type for Maps. AgileUML extends Standard OCL with Map and Function types. [6] These extensions are consistent with the map and function types present in modern programming languages such as Python and Swift.
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.
The XML Metadata Interchange (XMI) is an Object Management Group (OMG) standard for exchanging metadata information via Extensible Markup Language (XML).
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 created and manipulated. MOF may be used for domain-driven software design and object-oriented modelling.
A platform-specific model is a model of a software or business system that is linked to a specific technological platform. Platform-specific models are indispensable for the actual implementation of a system.
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 domain engineering, and supports model-driven engineering of software systems. It was launched by the Object Management Group (OMG) in 2001.
Given that metadata is a set of descriptive, structural and administrative data about a group of computer data, Java Metadata Interface is a platform-neutral specification that defines the creation, storage, access, lookup and exchange of metadata in the Java programming language.
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".
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 applicable and useful for modeling a predefined class of problems. As its name implies, this concept applies the notions of meta- and modeling in software engineering and systems engineering. Metamodels are of many types and have diverse applications.
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.
VIATRA is an open-source model transformation framework based on the Eclipse Modeling Framework (EMF) and hosted by the Eclipse Foundation.
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 representations of the knowledge and activities that govern a particular application domain, rather than the computing concepts.
ATL is a model transformation language and toolkit developed and maintained by OBEO and AtlanMod. It was initiated by the AtlanMod team. In the field of Model-Driven Engineering (MDE), ATL provides ways to produce a set of target models from a set of source models.
QVT (Query/View/Transformation) is a standard set of languages for model transformation defined by the Object Management Group.
A model transformation language in systems and software engineering is a language intended specifically for model transformation.
KM3 or Kernel Meta Meta Model is a neutral computer language to write metamodels and to define Domain Specific Languages. KM3 has been defined at INRIA and is available under the Eclipse platform.
MagicDraw is a proprietary visual UML, SysML, BPMN, and UPDM modeling tool with team collaboration support.
Eclipse Modeling Framework (EMF) is an Eclipse-based modeling framework and code generation facility for building tools and other applications based on a structured data model.
The Semantics of Business Vocabulary and Business Rules (SBVR) is an adopted standard of the Object Management Group (OMG) intended to be the basis for formal and detailed natural language declarative description of a complex entity, such as a business. SBVR is intended to formalize complex compliance rules, such as operational rules for an enterprise, security policy, standard compliance, or regulatory compliance rules. Such formal vocabularies and rules can be interpreted and used by computer systems. SBVR is an integral part of the OMG's model-driven architecture (MDA).
UML-RSDS is a lightweight model-driven engineering (MDE) and model transformation tool supporting the UML 2.5 class diagram notation and OCL 2.4 Object Constraint Language. It supports code-generation in multiple 3GLs: Java, C#, C++, Python, Go, Swift and ANSI C.
{{cite journal}}
: Cite journal requires |journal=
(help)