Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "OCL/Compliance"

< OCL
m (MDT/OCL/Compliance moved to OCL/Compliance: Infrastructure change)
 
(13 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
 
! Topic
 
! Topic
! OMG OCL 2.3
+
! OMG OCL 2.3.1
 
! Ecore binding
 
! Ecore binding
 
! UML binding
 
! UML binding
Line 11: Line 11:
 
| hard coded
 
| hard coded
 
| hard coded
 
| hard coded
| modeled as a prototype for OCL 2.4
+
| modeled as a prototype for OCL 2.5 in OCL-2.4.oclstdlib, code generated to OCLstdlib.java, extensible/replaceable
 
|-  
 
|-  
 
| XMI interchange
 
| XMI interchange
Line 17: Line 17:
 
| Proprietary Ecore-based
 
| Proprietary Ecore-based
 
| Proprietary UML and Ecore-based
 
| Proprietary UML and Ecore-based
| Prototype for OCL 2.4
+
| Prototype for OCL 2.5
 
|-  
 
|-  
 
| Editors
 
| Editors
Line 36: Line 36:
 
| none
 
| none
 
| none
 
| none
 +
|-
 +
| Java Code Generator
 +
| n/a
 +
| none
 +
| none
 +
| integrated with GenModel
 
|}
 
|}
  
Line 73: Line 79:
 
| String::toLowerCase
 
| String::toLowerCase
 
| String::toLowerCase
 
| String::toLowerCase
| String::toLower
+
| String::toLower or String::toLower
 
| as Ecore
 
| as Ecore
| String::toLowerCaseor String::toLower
+
| String::toLowerCase or String::toLower
 
|-  
 
|-  
 
| String::toUpperCase
 
| String::toUpperCase
 
| String::toUpperCase
 
| String::toUpperCase
| String::toUpper
+
| String::toUpper or String::toUpper
 
| as Ecore
 
| as Ecore
 
| String::toUpperCase or String::toUpper
 
| 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
 
|}
 
|}
  
Line 88: Line 106:
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
 
{| border="1" cellspacing="0" cellpadding="5" align="center"
 
! Topic
 
! Topic
! OMG OCL 2.3
+
! OMG OCL 2.3.1
 
! Ecore binding
 
! Ecore binding
 
! UML binding
 
! UML binding
Line 95: Line 113:
 
| Integer
 
| Integer
 
| unlimited range
 
| unlimited range
| Integer on Indigo, Integer or Long on Juno
+
| Indigo: Integer, Juno: Integer or Long  
 
| as Ecore
 
| as Ecore
| BigInteger on Indigo, Integer or Long or BigInteger on Juno
+
| Indigo: BigInteger, Juno: Integer or Long or BigInteger  
 
|-  
 
|-  
 
| Real
 
| Real
Line 104: Line 122:
 
| as Ecore
 
| as Ecore
 
| BigDecimal
 
| BigDecimal
|-
 
| Nested Collections
 
|
 
|
 
| as Ecore
 
| fully supported
 
 
|-  
 
|-  
 
| null
 
| null
|  
+
| specified
|  
+
| Java null
 
| as Ecore
 
| as Ecore
| fully supported
+
| Juno: NullValue, Kepler: java null
 
|-  
 
|-  
 
| invalid
 
| invalid
|  
+
| specified
 +
| singleton/Java Exception
 +
| as Ecore
 +
| Juno: InvalidValue, Kepler: Java Exception
 +
|-
 +
| unlimited
 +
| specified
 
|  
 
|  
 
| as Ecore
 
| as Ecore
 
| fully supported
 
| fully supported
 
|-  
 
|-  
| unlimited
+
| Nested Collections
|  
+
| specified
 
|  
 
|  
 
| as Ecore
 
| as Ecore
 
| fully supported
 
| fully supported
 +
|-
 +
| Collection Inheritance
 +
| none
 +
| none
 +
| as Ecore
 +
| Set is-a Bag, OrderedSet is-a Sequence
 
|-  
 
|-  
 
| @pre
 
| @pre
Line 158: Line 182:
 
| supported
 
| supported
 
| supported
 
| supported
 +
|-
 +
| Package names
 +
| name-only
 +
| name-only
 +
| as Ecore
 +
| name or URI
 +
|-
 +
| Package import
 +
| unspecified
 +
| programmatic
 +
| as Ecore
 +
| import declarations/URI names
 
|-  
 
|-  
 
| OclMessage
 
| OclMessage
Line 170: Line 206:
 
| supported
 
| supported
 
| parsed
 
| 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.

Latest revision as of 14:37, 31 May 2013

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

Library

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.

Back to the top