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 Stnadrad Library may be found at model/OCL-2.4.oclstdlib in the org.eclipse.ocl.examples.library plugin.
The grammar used by the Xtext editors may be found at:
in the org.eclipse.ocl.examples.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
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.
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 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 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.examples.library.LibraryOperation interface. This class is used when evaluating the operation.
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.examples.library.LibraryIteration interface. This class is used when evaluating the iteration.
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.examples.library.LibraryProperty interface. This class is used when evaluating the iteration.
The content of a Property may comprise Annotations.