From Eclipsepedia

< OCL(Redirected from MDT/OCL/Compliance)
Jump to: navigation, search


Major Facilities

Topic OMG OCL 2.3.1 Ecore binding UML binding Pivot binding
OCL Standard Library textual hard coded hard coded modeled as a prototype for OCL 2.5 in OCL-2.4.oclstdlib, code generated to OCLstdlib.java, extensible/replaceable
XMI interchange under-specified Proprietary Ecore-based Proprietary UML and Ecore-based Prototype for OCL 2.5
Editors n/a none none Essential OCL, Complete OCL, OCLinEcore, OCLstdlib
Evaluation n/a on Ecore models on Ecore models on Ecore models
Impact Analyzer n/a supported none none
Java Code Generator n/a none none integrated with GenModel


Topic OMG OCL 2.3 Ecore binding UML binding Pivot binding
'container' no operation eContainer() if EObject as Ecore oclContainer()
'contents' no operation eContents() if EObject as Ecore oclContents()
oclIsNew()  ? supported dummy operation
oclType() unclear identity at most as Ecore fully reflective
String::toLowerCase String::toLowerCase String::toLower or String::toLower as Ecore String::toLowerCase or String::toLower
String::toUpperCase String::toUpperCase String::toUpper or String::toUpper as Ecore String::toUpperCase or String::toUpper
Collection::selectByKind n/a Collection::selectByKind as Ecore Collection::selectByKind
Collection::selectByType n/a Collection::selectByType as Ecore Collection::selectByType

Detailed Functionality

Topic OMG OCL 2.3.1 Ecore binding UML binding Pivot binding
Integer unlimited range Indigo: Integer, Juno: Integer or Long as Ecore Indigo: BigInteger, Juno: Integer or Long or BigInteger
Real unlimited range Double as Ecore BigDecimal
null specified Java null as Ecore Juno: NullValue, Kepler: java null
invalid specified singleton/Java Exception as Ecore Juno: InvalidValue, Kepler: Java Exception
unlimited specified as Ecore fully supported
Nested Collections specified as Ecore fully supported
Collection Inheritance none none as Ecore Set is-a Bag, OrderedSet is-a Sequence
@pre not EssentialOCL n/a parsed and ? evaluated parsed only
pre-conditions not EssentialOCL parsed only parsed only parsed only
post-conditions not EssentialOCL parsed only parsed only parsed only
Associations not EssentialOCL n/a supported work in progress
Non-navigable opposites optional configurable supported supported
Package names name-only name-only as Ecore name or URI
Package import unspecified programmatic as Ecore import declarations/URI names
OclMessage not EssentialOCL n/a supported parsed
OclState not EssentialOCL n/a supported parsed
Numeric equality unclear 1 <> 1.0 asEcore 1 = 1.0
Implicit as set unclear null is Set{null} asEcore uses OclAny::oclAsSet()
Collection::any() non-result ambiguous Juno: null, Kepler: configurable asEcore Juno: null, Kepler: invalid
null.oclIsKindOf(X) ambiguous true asEcore Juno: true, Kepler: invalid

Prototype Functionality

Most of the additional Pivot support is implied by the specification.

Type Constructors

Re-uses the Tuple syntax

 MyType{ name = 'MyName'; age = 21; }

Unified Nested/Bounded Collections

UML/Ecore has only bounded collections such as String[0..5]. OCL, as specified, has only nested collections such as Set(Bag(String)). OCL also specifuies alignment with UML.

Therefore unified collections allow Set(Bag(String)[0..3])[*] with multiplicities always realized by additional collection properties.

The non collection multiplicities of [0..1] or [1..1] are realized by an isRequired TypedElement Property.

Therefore a declaration of String[?] or String[0..1] indicates a String that may be null, and a declaration of String or String[1..1] indicates a String that may not be both null and well-formed.

Template Types for (parameterized classes/functions)

CollectionTypes are generalized to UML Template Types. Thus in

 operation flatten(T2)() : Collection(T2)

the operation template type T2 defines the returned collection element tupe, which may be different to the type of the source collection.

OclSelf for stronger static type declarations

OclSelf is the statically known type of self. It is only used for library declaration. Thus in

 static operation allInstances() : Set(OclSelf)

the returned set preserves the static type of the invocation object.

Metaclass Types for reflective declarations

Metaclasses define the class describing its element type. Thus

 operation oclType() : Metaclass(OclSelf)

defines a return type that describes the statically known type of the source.

Lambda Types (for iterator bodies)

LambdaTypes are the types of iterator bodies. Currently only used for library declarations. Thus

 iteration forAll(i : T[?], j : T[?] | body : Lambda T() : Boolean) : Boolean

defines the two argument forAll iteration for Collection(T). The body is declared to be a parameterless LambdaType from T to Boolean.

Static Properties for UML stereotypes, Collection properties

The Pivot metamodel loader reifies awkward OCL and UML concepts in more conventional fashion.

The OCL libraries M2 properties such as Collection.elementType and OclAny.allInstances are relaized as static features at M1.

The Stereotype features base_xxx and extension_yyy specified by as M2 properties by UML are realised as static properties at M1.

Partially navigable Associations are represented by fully bidirectionally navigable properties, with a Property.isImplicit attribute to annotatye additional synthesized properties.