Information Technology Reference
In-Depth Information
describetheinformation.Theobjectconstraintlanguage(OCL)
is a purely functional language (that is side effect-free) and
OOP style devoted to the description of UML elements and
navigation in diagrams. It was originally developed by IBM
in 1997 as a formal specification language for UML. Now, it
is a part of the UML standard and may be used with any
MOF metamodel, including all UML diagrams. The OCL 1.4
definitionspecifiedaconstraintlanguageandOCL2.0hasbeen
extended to include general object query language definitions.
OCLisbasedonfirst-orderpredicatelogicandusessyntaxclose
to programming languages and related to the syntax of UML.
It is more suitable for everyday modeling than pure first-order
predicate logic.
Figure 3.7. Class model with persistence's properties
ThereasonOCLisusedisthatsomecomputationscannotbe
expressed solely with diagrammatic notations. For instance, a
UML diagram, such as a class diagram, is typically not refined
enough to provide all the relevant aspects of a specification.
There is then a need to describe additional constraints about
the objects in the model. OCL is a formal language to
specify unambiguously constraints with no side effects, which
means that the states of objects in a model cannot change
during the evaluation of OCL sentences. For example, we can
represent collections of elements by using class diagrams, but
if we want to define sorted lists or lists without duplication
we should use some constraints. These constraints can be
Search WWH ::




Custom Search