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.OCL may now be used with any Meta-Object Facility (MOF) Object Management Group (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.
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.