Object Constraint Language

From Wikipedia, the free encyclopedia

The Object Constraint Language is a declarative language for describing rules that apply to UML models developed at IBM and now part of the UML standard. Initially OCL was only a formal specification language extension to UML. OCL may now be used with any Meta-Object Facility OMG metamodel, including UML. The Object Constraint Language is a precise text language that provides constraint and object query expressions on any Meta-Object Facility model or metamodel that cannot otherwise be expressed by diagrammatic notation. OCL is a key component of the new OMG standard recommendation for transforming models, the QVT specification. Many other model transformation languages like ATL is also built on top of OCL.

Contents

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 language 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 allows to make any Meta-Object Facility model more precise by associating to its metaelements a number of assertions.

Of particular importance to Model Driven Engineering 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 the ATL are presently available, with different level 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.

As a navigation language, XPath may be considered as an alternative to OCL. However XPath works for XML trees while OCL allows to navigate MOF-based models and metamodels (i.e. XMI trees). In other words OCL has a similar relation to UML or MOF than XPath has to XML. As a model specification language allowing to decorate a model or a metamodel with side-effect free annotations, OCL could be advantageously replaced by languages like Alloy.

This article was originally based on material from the Free On-line Dictionary of Computing, which is licensed under the GFDL.

Advanced Search
Included Web Search Engines


Safe Search

close

Top Matching Results

Occasionally Search.com will highlight specialized results that are based on the context of your query. Examples of specialized results include specific links to news, images, or video.

Top Matching Results may highlight information from other Search.com pages, content from the CNET Network of sites, or third party content. The listings are based purely on relevance. Search.com does not receive payment for listings in this section but our partners that provide this data may get paid for listing these products.

Sponsored Links

This section contains paid listings which have been purchased by companies that want to have their sites appear for specific search terms and related content. These listings are administered, sorted and maintained by a third party and are not endorsed by Search.com.

Search Results

Search.com sends your search query to several search engines at one time and integrates the results into one list which has been sorted by relevance using Search.com's proprietary algorithm. You can customize the list of search engines included in your metasearch from the preferences.

The search engines that are used in your metasearch may allow companies to pay to have their Web sites included within the results. To view the Paid Inclusion policy for a specific search engine, please visit their Web site. Search.com does not accept payment or share revenue with any search engine partner for listings in this section.