The OCL Standard Library Language is used to define the OCL Standard Library, for which *.oclstdlib is the default extension.
The standard library can be replaced or extended.
The source for the OCL Standard Library may be found at model/OCL-2.5.oclstdlib in the org.eclipse.ocl.pivot plugin.
The grammar used by the Xtext editors may be found at:
/src/org/eclipse/ocl/examples/xtext/oclstdlib/OCLstdlib.xtext
in the org.eclipse.ocl.xtext.oclstdlib plugin. The OCL Standard Library grammar extends the Essential OCL grammar.
The Library syntax defines an OCL Standard Library document, for which *.oclstdlib is the default extension.
Zero or more library documents may be imported for use within the composite library whose name must be specified.
A namespace prefix and namespace URI may optionally be specified.
The body of the document comprises
optional module declaration
optional specification of the OCL Standard libraries
optional import of referenced Ecore or UML or OCLinEcore resources
a hierarchy of Packages
a hierarchy of Classifiers
Annotations
Zero or more external libraries may be imported so that their definitions are merged to form a composite library of basic and extended evaluation capability.
The default library may be extended by specifying it as the first library import.
library 'http://www.eclipse.org/ocl/3.1.0/OCL.oclstdlib'
The namespace URI of the first library package defines the namespace URI of the composite library. The namespace URI of subsequent library imports may not conflict, but may be null.
The Precedence syntax defines the precedence and associativity of infix operators.
Each entry in a list of precedences names a precedence level taht can then be used by an infix operator. Each level can be either left or right associative.
Multiple lists of precedence levels can be merged from imported libraries provided the lists are interleaveable with conflict or ambiguity.
The Package syntax defines a nested hierarchy of packages and classifiers .
A Package has a name and optionally a namespace prefix and namespace URI.
The content of a Package may comprise Packages, Classifiers and Annotations.
The Class and Classifier syntax define a type within a Package.
A Class has a name and optionally template parameters. A class may also name the metatype such as
PrimitiveType
that the Class is an instance of.
A Class may extend one or more other Classes that may be specialized using the template parameters.
The content of a Class may comprise Operations, Properties, Invariants and Annotations.
The LibOperation syntax defines a conventional Operation.
An Operation may be static and has a name and optionally template parameters.
An Operation has zero of more Parameters.
An Operation has a return Type. An infix operation may specify a precedence level. An operation may specify the name of a Java class implementing the org.eclipse.ocl.pivot.library.LibraryOperation interface. This class is used when evaluating the operation.
The content of an Operation may comprise Preconditions, Postconditions and Annotations.
The
static
qualifier supports declaration of static library operations such as
allInstances()
that are invoked on types rather than objects.
The LibIteration syntax defines an Iteration.
An Iteration has a name and optionally template parameters.
An Iteration has one or more comma-separated Iterators.
Optionally following a semicolon, an Iteration has one or more comma-separated Accumulators.
Optionally following a bar, an Iteration has one or more comma-separated Parameters.
An Iteration has a return Type. An Iteration may specify the name of a Java class implementing the org.eclipse.ocl.pivot.library.LibraryIteration interface. This class is used when evaluating the iteration.
The content of an Iteration may comprise Preconditions, Postconditions and Annotations.
The LibProperty syntax defines an Property.
An Property may be static and has a name and a Type.
A Property may specify the name of a Java class implementing the org.eclipse.ocl.pivot.library.LibraryProperty interface. This class is used when evaluating the iteration.
The content of a Property may comprise Annotations.