## Package org.eclipse.ocl.uml

Implementation of an OCL binding for the `UML` metamodel.

See:
Description

Interface Summary
AnyType: A representation of the model object 'Any Type'
AssociationClassCallExp: A representation of the model object 'Association Class Call Exp'
BagType: A representation of the model object 'Bag Type'
BooleanLiteralExp: A representation of the model object 'Boolean Literal Exp'
CallExp: A representation of the model object 'Call Exp'
CollectionItem: A representation of the model object 'Collection Item'
CollectionLiteralExp: A representation of the model object 'Collection Literal Exp'
CollectionLiteralPart: A representation of the model object 'Collection Literal Part'
CollectionRange: A representation of the model object 'Collection Range'
CollectionType: A representation of the model object 'Collection Type'
ElementType: A representation of the model object 'Element Type'
EnumLiteralExp: A representation of the model object 'Enum Literal Exp'
ExpressionInOCL: A representation of the model object 'Expression In OCL'
FeatureCallExp: A representation of the model object 'Feature Call Exp'
IfExp: A representation of the model object 'If Exp'
IntegerLiteralExp: A representation of the model object 'Integer Literal Exp'
InvalidLiteralExp: A representation of the model object 'Invalid Literal Exp'
InvalidType: A representation of the model object 'Invalid Type'
IterateExp: A representation of the model object 'Iterate Exp'
IteratorExp: A representation of the model object 'Iterator Exp'
LetExp: A representation of the model object 'Let Exp'
LiteralExp: A representation of the model object 'Literal Exp'
LoopExp: A representation of the model object 'Loop Exp'
MessageExp: A representation of the model object 'Message Exp'
MessageType: A representation of the model object 'Message Type'
NavigationCallExp: A representation of the model object 'Navigation Call Exp'
NullLiteralExp: A representation of the model object 'Null Literal Exp'
NumericLiteralExp: A representation of the model object 'Numeric Literal Exp'
OCL.Helper: Convenient interface aliasing the type parameter substitutions for the UML environment, for ease of typing.
OCL.Query: Convenient interface aliasing the type parameter substitutions for the UML environment, for ease of typing.
OCLExpression: A representation of the model object 'OCL Expression'
OperationCallExp: A representation of the model object 'Operation Call Exp'
OrderedSetType: A representation of the model object 'Ordered Set Type'
PrimitiveLiteralExp: A representation of the model object 'Primitive Literal Exp'
PrimitiveType: A representation of the model object 'Primitive Type'
PropertyCallExp: A representation of the model object 'Property Call Exp'
RealLiteralExp: A representation of the model object 'Real Literal Exp'
SequenceType: A representation of the model object 'Sequence Type'
SetType: A representation of the model object 'Set Type'
StateExp: A representation of the model object 'State Exp'
StringLiteralExp: A representation of the model object 'String Literal Exp'
TupleLiteralExp: A representation of the model object 'Tuple Literal Exp'
TupleLiteralPart: A representation of the model object 'Tuple Literal Part'
TupleType: A representation of the model object 'Tuple Type'
TypeExp: A representation of the model object 'Type Exp'
TypeType: A representation of the model object 'Type Type'
UMLFactory: The Factory for the model.
UMLPackage: The Package for the model.
UMLPackage.Literals: Defines literals for the meta objects that represent each class, each feature of each class, each enum, and each data type
UnlimitedNaturalLiteralExp: A representation of the model object 'Unlimited Natural Literal Exp'
UnspecifiedValueExp: A representation of the model object 'Unspecified Value Exp'
Variable: A representation of the model object 'Variable'
VariableExp: A representation of the model object 'Variable Exp'
VoidType: A representation of the model object 'Void Type'

Class Summary
OCL: Convenient subclass of the `OCL` façade that binds the UML metamodel to the superclass's generic type parameters.
TypeResolverImpl: UML implementation of the `TypeResolver` interface.
UMLEnvironment: Implementation of the `Environment` for parsing OCL expressions on UML models.
UMLEnvironmentFactory: Implementation of the `EnvironmentFactory` for parsing OCL expressions on UML models.
UMLEvaluationEnvironment: Implementation of the `EvaluationEnvironment` for evaluation of OCL expressions on instances of UML models (i.e., on M0 models).
UMLOCLStandardLibrary: An extensible implementation of the `OCLStandardLibrary` which provides the OCL Standard Library predefined M1 types and the associated operations related to them.

## Package org.eclipse.ocl.uml Description

Implementation of an OCL binding for the `UML` metamodel.

## Package Specification

This package defines an OCL environment implementation for the `UML` metamodel. Clients can use an `UMLEnvironmentFactory` in conjunction with the `OCL` class to parse and evaluated OCL constraints on UML models.

Clients may extend the environment implementation to support custom requirements, such as overriding the `Environment.lookupOperation(C, java.lang.String, java.util.List<? extends org.eclipse.ocl.utilities.TypedElement<C>>)` and `EvaluationEnvironment.callOperation(O, int, java.lang.Object, java.lang.Object[])` methods to inject custom operations into existing metaclasses (to provide Java implementations, rather than defining additional operations using OCL).

### OCL Parsing on Various Modeling Levels

The parser environments created by the UML environment factory support OCL expressions at both the metamodel (M2) and user model (M1) levels. For user model constraints, use the classifier in the model as the context classifier in invocations of th `OCL` or an `OCLHelper` created by it. For metamodel OCL (used, for example, to query the user model, itself) use the metaclass of any kind of element in the user model as the context classifier. A convenient way to obtain this metaclass is via the `OCLUMLUtil.getMetaclass(org.eclipse.uml2.uml.Element)` method.

### Evaluation of OCL Expressions in the UML Environment

The `UMLEvaluationEnvironment` provides support for two implementations of M0 (run-time instance) models, depending on the kind of object provided as the evaluation context: `InstanceSpecification`s and `EObject`s. If the context object is an instance specification, then the extents of classes are considered to be the `InstanceSpecification`s in the model that reference them or their subclasses as classifiers. If the context object is an `EObject`, then the extents of classes are considered to be the `EObject`s in the resource set that reference `EClass`es corresponding to the UML model classes, as described below.

#### Evaluation on Instance Specifications

In the case of `InstanceSpecification`s, navigation of attributes, associations, and association classes is supported by interpretation of the values of slots and links (instance specifications of associations and association classes). The only operations that can be evaluated are those that are defined by the OCL Standard Library or via additional operation definition constraints, unless a client provides a subclass of the `UMLEvaluationEnvironment` with Java implementations of any required operations.

#### Evaluation on EObjects

In the case of `EObject`s, navigation of attributes and associations is supported by the `EObject` reflection API. Navigation of association classes is not available, as the UML2 code generation does not support them (EMF having no comparable concept). The operations that can be evaluated are those that are defined by the OCL Standard Library or via additional operation definition constraints, plus any that are generated (usually all) to the corresponding `EClass`es.

The evaluation of OCL on `EObject`s assumes that a corresponding Ecore representation of the UML model exists and can be found in EMF's package registry (either globally or at the `ResourceSet` level). This is the case for any UML model from which code was generated and for UML `Profile`s, which are associated with Ecore definitions. In the latter case, as well as the case of ad hoc UML-to-Ecore conversions using the `UMLUtil` API, the use of dynamic `EObject`s naturally restricts the availability of operations at evaluation time.

See Also:
  `OCL`, `UMLEnvironmentFactory`, `UMLEnvironment`, `UMLEvaluationEnvironment`, `OCLUMLUtil.getMetaclass(org.eclipse.uml2.uml.Element)`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.