Object Constraint Language Avatar
  1. OMG Specification

Object Constraint Language — Open Issues

  • Acronym: OCL
  • Issues Count: 26
  • Description: Issues not resolved
Open Closed All
Issues not resolved

Issues Summary

Key Issue Reported Fixed Disposition Status
OCL25-213 Multi-dimensional sortedBy OCL 2.4 open
OCL25-113 Invalid algorithm in definitions of sortedBy OCL 2.4 open
OCL25-211 OrderedSet::insertAt unclear for insert of existing element OCL 2.4 open
OCL25-210 Clarify indeterminate/unknown order for asSequence/asOrderedSet/any OCL 2.4 open
OCL25-209 Are failures invalid? OCL 2.4 open
OCL25-208 Add % operator OCL 2.4 open
OCL25-207 Generalize body/precondition/postcondition as named capabilities OCL 2.4 open
OCL25-206 How is OCL used with a UML InstanceSpecification? OCL 2.4 open
OCL25-205 Support MyStereotype.allInstances() OCL 2.4 open
OCL25-204 Wrong color for abstract syntax presentation OCL 2.4 open
OCL25-203 How indeterminate are asOrderedSet/asSequence? OCL 2.4 open
OCL25-202 Provide a Map of qualified associations OCL 2.4 open
OCL25-201 Make null-free collections the default OCL 2.4 open
OCL25-152 Append/prepend on OrderedSet does not necessarily increase the collection size OCL 2.4 open
OCL25-153 Missing Real::= overload OCL 2.4 open
OCL25-116 Example of collect in terms of iterate is not flattened OCL 2.4 open
OCL25-117 Conflicting String::indexOf postConditions OCL 2.4 open
OCL25-112 i/r typo OCL 2.4 open
OCL25-114 Add isInteger/isReal OCL 2.4 open
OCL25-115 indentified OCL 2.4 open
OCL25-73 Missing/Poor definition of iterate() OCL 2.4 open
OCL25-74 Reverse CollectionRange should be empty rather than invalid OCL 2.4 open
OCL25-75 OclVoid::oclIsKindOf/oclIsTypeOf should return true/false rather than invalid OCL 2.4 open
OCL25-71 Obsolete implicit cast to Bag OCL 2.4 open
OCL25-45 Coolection operations do not allow invalid inputs OCL 2.4 open
OCL25-4 Missing mode precondition OCL 2.4 open

Issues Descriptions

Multi-dimensional sortedBy

  • Key: OCL25-213
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The sortedBy iteration provides an elegant solution to a sort problem in which the sort metric is a projection of the sorted object. Thus sortedBy(p|p.name) or just sortedBy(name) is short and avoids the opportunities for typos from a more conventional exposition involving comparison of two objects. The natural solution may well be an efficient one for large collections with non-trivial metrics.

    However the sortedBy solution is unfamiliar and so confusing for newcomers and unsuitable for multi-key sorting for which an artificial compound single key may need to be constructed.

    One solution might be to provide a more conventional iterator such as sort(p1, p2 | comparison-expression) allowing a two key sort:

    sort(p1, p2 | let diff1 = p1.key1.compareTo(p2.key1) in
    if diff1 <> 0 the diff 1 else p1.key2.compareTo(p2.key2) endif)

    However this has poor readability and ample opportunities for typos.

    Alternatively sortedBy with a Tuple-valued metric might support multiple keys as:

    sortedBy(Tuple

    {first=key1,second=key2}

    )

    (The alphabetical order of the Tuple part names determines the priority.)

    (Since sortedBy is declaratively clear and compact, inefficient small/trivial implementations can be optimized to their sort() equivalents.)

  • Reported: OCL 2.4 — Sat, 20 Jan 2018 09:53 GMT
  • Updated: Sat, 20 Jan 2018 09:53 GMT

Invalid algorithm in definitions of sortedBy

  • Key: OCL25-113
  • Legacy Issue Number: 19510
  • Status: open  
  • Source: seznam.cz ( Vlastimil Dort)
  • Summary:

    The following problems are common to all definitions of sortedBy in 11.9:

    Invalid algorithm:

    • When the current element is not the first one, but is the
      greatest one so far, for example 2 in
      Sequence {1,2}

      ->sortedBy(x|x),
      then
      result->select (item | body (item) > body (iterator))
      is empty and calling ->first on it would result in invalid.

    Inconsistent use of < and >:

    • The text descriptions mention using < operation on the elements,
      but the algorithm uses > operator.

    Typos:

    • The accumulator initialization incorrectly uses : instead of =.
    • The source for the iterate expression is missing.
    • The closing parenthesis for the iterate expression is missing.
    • The operations append and insertAt are called by . operator.

    SOLUTION:

    • Introduce a new local variable upperBounds, containing elements from the
      accumulator that are greater than the current element.
    • Swap body (iterator) and body (item).
    • Fix typos.

    Corrected algorithm for Set (11.9.2) and OrderedSet (11.9.5):

    ****************************************
    source->sortedBy(iterator | body) =
    source->iterate( iterator ; result : OrderedSet(T) = OrderedSet {} |
    let upperBounds : OrderedSet(T) =
    result->select (item | body (iterator) < body (item) )
    in
    if upperBounds->isEmpty() then
    result->append(iterator)
    else
    let position : Integer = result->indexOf ( upperBounds->first() )
    in
    result->insertAt(position, iterator)
    endif
    )
    ****************************************

    Corrected algorithm for Sequence (11.9.4) and Bag (11.9.3):

    ****************************************
    source->sortedBy(iterator | body) =
    source->iterate( iterator ; result : Sequence(T) = Sequence {} |
    let upperBounds : Sequence(T) =
    result->select (item | body (iterator) < body (item) )
    in
    if upperBounds->isEmpty() then
    result->append(iterator)
    else
    let position : Integer = result->indexOf ( upperBounds->first() )
    in
    result->insertAt(position, iterator)
    endif
    )
    ****************************************

    FURTHER SUGGESTIONS:

    • The presented algorithm works only under assumption that indexOf(obj:T)
      on Sequence(T) returns the first occurence. This is not mentioned in the
      definition of indexOf. If indexOf can return any index, for example:
      Sequence {2, 2}

      ->indexOf(2) = 2,
      then the above algorithm could insert the element at the wrong place,
      for example:
      Sequence

      {2, 2, 1}

      ->sortedBy(x|x) = Sequence

      {2, 1, 2}
    • The algorithm is stable for Sequence and OrderedSet, this fact could be
      mentioned in the description, to make it clear that successive
      sortedBy iterations can be used to sort by multiple criteria.
  • Reported: OCL 2.4 — Fri, 4 Jul 2014 04:00 GMT
  • Updated: Sat, 20 Jan 2018 09:25 GMT

OrderedSet::insertAt unclear for insert of existing element

  • Key: OCL25-211
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The pseudocode for OrderedSet::insertAt assumes that the inserted element is not already contained.

    Presumably insertion of an existing element does not increase the OrderedSet size.

    Design choice. Is the old element retained or is the old element removed and the new element inserted? The latter might preserve the postcondition that the element at the index is the inserted object, but what if the removed element was earlier so that everything moved along first?

    Surely the only predictable behavior is that the old element is retained?

  • Reported: OCL 2.4 — Fri, 7 Jul 2017 08:29 GMT
  • Updated: Fri, 7 Jul 2017 09:38 GMT

Clarify indeterminate/unknown order for asSequence/asOrderedSet/any

  • Key: OCL25-210
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    "asSequence" and "asOrderedSet" are specified as returning an unknown ordering. How deterministic is this? repeatable with the same tool version, the same tool, the same CPU, the same number of CPUs, any OCL tool?

    "any" is specified as indeterminate.

    Non-determinism is a very bad language characteristic.

    Surely "any" should be the earliest element in asSequence()?

    If a tool avoids anarchic sets, perhaps keeping a list and set for each 'set', the resulting behavior can be deterministic. But is specifying deterministic set evaluation algorithms appropriate for the OCL specification?

    Suggest the specification should just require that a re-execution with:

    • the same tool version
    • the same Operating System etc
    • the same single CPU
    • the same command line options
      shall give the same result (unknown but deterministic).
  • Reported: OCL 2.4 — Tue, 27 Dec 2016 17:36 GMT
  • Updated: Sat, 31 Dec 2016 08:54 GMT

Are failures invalid?

  • Key: OCL25-209
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    OCL is an executable specification language that uses "invalid" as its exception handling mechanism for untoward execution, which clearly includes deterministic internal program control faults:

    • divide by zero
    • null-navigation
    • ordered collection index out of bounds
      Does this behavior also include non-deterministic external problems:
    • network/disk access failure
    • stack overflow
    • tooling malfunction

    Without an answer to this question, it i impossible to know whether e.g. "aSequence->includes->last()" can be optimized to "x" or not. Is it necessary to fully evaluate aSequence, perhaps run out of memory, in order to incur an external issue that influences an evaluation?

  • Reported: OCL 2.4 — Mon, 26 Dec 2016 09:45 GMT
  • Updated: Wed, 28 Dec 2016 15:46 GMT

Add % operator

  • Key: OCL25-208
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The % (modulo/remainder) operator is realtively standard operator in many langages. It is missing from the OCL Standard Library. There is only Integer::mod().

    QVTo 1,3 8.4.4 4 implies that there is a % modulo operator even though there isn't. See QVT14-44.

    Suggest add Real::%

  • Reported: OCL 2.4 — Mon, 19 Dec 2016 10:09 GMT
  • Updated: Mon, 19 Dec 2016 10:09 GMT

Generalize body/precondition/postcondition as named capabilities

  • Key: OCL25-207
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    UML/OCL hardwire three capabilities of an Operation.

    "body" is very useful
    "precondition", "postcondition" are sometimes useful
    anything else is unsupported.

    Some users want frame conditions.

    Code generation/analysis wants other forms of meta-evaluation.

    Rather than expand the hardwired options, allow an Operation to have an extensible set of named capabilities.Some names such as "body", "precondition", "postcondition" can be standardized. Others could be reserved in anticipation.

  • Reported: OCL 2.4 — Wed, 14 Dec 2016 15:38 GMT
  • Updated: Wed, 14 Dec 2016 15:38 GMT

How is OCL used with a UML InstanceSpecification?

  • Key: OCL25-206
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    A UML InstanceSpecification introduces classification within the M1 level. OCL is normally applicable to inter level typing. M0/M1 or M1/M2.

    Does anInstanceSpecification.oclIsKindOf(XXX) use a same-level or meta XXX?

    Does anInstanceSpecification.YYY use the YYY feature of the InstanceSpecification metaclass or any one of the anInstanceSpecification.classifier?

    Is a new navigation operator needed to distinguish the two cases?

  • Reported: OCL 2.4 — Sun, 14 Feb 2016 21:43 GMT
  • Updated: Thu, 18 Feb 2016 13:49 GMT

Support MyStereotype.allInstances()

  • Key: OCL25-205
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Practical evaluation of stereotypes requires OCL to reify the Stereotype instances. These instances should be accessible by Stereotype.allInstances().

    e.g. if an ElementExtension is the Stereotype instance and Element.extensions are the applied stereotypes.

    Stereotype.allInstances() is equivalent to

    Element.allInstances().extensions->selectByKind(MyStereotype)

  • Reported: OCL 2.4 — Mon, 4 Jan 2016 09:55 GMT
  • Updated: Mon, 4 Jan 2016 09:55 GMT

Wrong color for abstract syntax presentation

  • Key: OCL25-204
  • Legacy Issue Number: 19865
  • Status: open  
  • Source: neusoft.com ( Jingang Zhou)
  • Summary:

    The last sentence of the first paragraph on page 37 says "All metaclasses defined as part of the OCL abstract syntax are shown with a light gray background.", but subsequent abstract syntaxs show OLC defined metaclasses in yellow

  • Reported: OCL 2.4 — Thu, 3 Dec 2015 05:00 GMT
  • Updated: Fri, 4 Dec 2015 17:03 GMT

How indeterminate are asOrderedSet/asSequence?

  • Key: OCL25-203
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    asOrderedSet() : OrderedSet(T)
    Redefines the Collection operation. An OrderedSet that contains all the elements from self, in undefined order.

    If asOrderedSet() is invoked more than once on the same Set, then presumably the subsequent calls have a defined order; the order previously used.

    When used by QVTo the lack of determinism of Set ordering is a significant debugging nuisance. Suggest that there is a repeatable but unspecified underlying order determined perhaps by object creation order.

  • Reported: OCL 2.4 — Wed, 11 Nov 2015 06:52 GMT
  • Updated: Wed, 11 Nov 2015 06:52 GMT

Provide a Map of qualified associations

  • Key: OCL25-202
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    object.assoc[qualifier] returns a particular element from a qualified association.

    With Map already suggested/prototyped for OCL, let object.assoc[] return a Map<qualifier,element> that avoids the loss of information from object.assoc that returns Collection<element>

  • Reported: OCL 2.4 — Mon, 19 Oct 2015 06:14 GMT
  • Updated: Mon, 19 Oct 2015 08:01 GMT

Make null-free collections the default

  • Key: OCL25-201
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    null-in-Collections was added by the OCL 2.0 FTF in Issue 5972 in the unanalyzed hope that it would be useful.

    https://ocl2015.lri.fr/OCL_2015_paper_0921_1400.pdf examines the null safety of OCL nad concludes that an ability to declare null-free collections is essential.

    Since almost all collections in practical OCL are null-free, suggest that the OCL default should be for null-free collections, with an option to have null-full collections when really needed.

  • Reported: OCL 2.4 — Thu, 8 Oct 2015 15:11 GMT
  • Updated: Thu, 8 Oct 2015 15:11 GMT

Append/prepend on OrderedSet does not necessarily increase the collection size

  • Key: OCL25-152
  • Legacy Issue Number: 19210
  • Status: open  
  • Source: Heinz Nixdorf Institute, University of Paderborn ( Christopher Gerking)
  • Summary:

    The spec defines the following postcondition for the append/prepend operations on OrderedSet:

    result->size() = self->size() + 1

    However, if self does already contain the added element, the size does not increase by one since the elements are unique.

  • Reported: OCL 2.4 — Tue, 11 Feb 2014 05:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Missing Real::= overload

  • Key: OCL25-153
  • Legacy Issue Number: 18911
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Issue 14918 went most of the way to clarifying '=' behaviour.

    But the Real::'=' and Real::'<>' overloads were omitted.

    Consequently the fix to ensure that 1.0 = 1
    evaluates to true when (1.0 <= 1) and (1.0 >= 1) will evaluate true is missing.

  • Reported: OCL 2.4 — Sun, 15 Sep 2013 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Example of collect in terms of iterate is not flattened

  • Key: OCL25-116
  • Legacy Issue Number: 19434
  • Status: open  
  • Source: rjgodoy.com.ar ( Javier Godoy)
  • Summary:

    The example of collect in terms of iterate given in section section 7.6.6 is not flattened. Actually it is a copy of the definition of collectNested in section 11.9.2.

  • Reported: OCL 2.4 — Mon, 26 May 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Conflicting String::indexOf postConditions

  • Key: OCL25-117
  • Legacy Issue Number: 18880
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The Issue 17220 clarification that the empty string is a substring at index 1 failed to revise the postcondition that the index of of any string in the empty string is at index 0.

    Replace:

    post: self.size() = 0 implies result = 0

    by

    post: self.size() = 0 and s.size() > 0 implies result = 0

    and move it to the second postcondition

  • Reported: OCL 2.4 — Sat, 24 Aug 2013 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

i/r typo

  • Key: OCL25-112
  • Legacy Issue Number: 19535
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    In Integer::/ change "r is equal" to "i is equal"

  • Reported: OCL 2.4 — Tue, 22 Jul 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Add isInteger/isReal

  • Key: OCL25-114
  • Legacy Issue Number: 19533
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Add isInteger/isReal predicates to avoid need to test invlaid on toInteger/toReal

    Add isBoolean/toBoolean/toString

  • Reported: OCL 2.4 — Tue, 22 Jul 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

indentified

  • Key: OCL25-115
  • Legacy Issue Number: 19532
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Change to identified

  • Reported: OCL 2.4 — Tue, 22 Jul 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Missing/Poor definition of iterate()

  • Key: OCL25-73
  • Legacy Issue Number: 19192
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The non-normative text defines iterate() and suggests that all iterators may be defined in terms of iterate() and notes that the use of iterate() on Bag/Set is indeterminate.

    The normative text omits iterate() and states that all iterators are defined in terms of iterate().

    Suggest: Add iterate() to Section 11.

    Suggest: explicitly asSequence() all unordered iterate() inputs.

    Suggest: retract availability of iterate() on Bag/Set forcing an explicit asSequence().

  • Reported: OCL 2.4 — Sat, 18 Jan 2014 05:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Reverse CollectionRange should be empty rather than invalid

  • Key: OCL25-74
  • Legacy Issue Number: 18985
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The clarification of Issue 15836 is too strong.

    For an empty collection it is im,portant that

    let s = Sequence{} in Sequence

    {1..s->size()}

    is Sequence{}, i.e. the valid indexes of an empty Sequence are empty not invalid.

  • Reported: OCL 2.4 — Thu, 3 Oct 2013 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

OclVoid::oclIsKindOf/oclIsTypeOf should return true/false rather than invalid

  • Key: OCL25-75
  • Legacy Issue Number: 18980
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    The Isabelle evolution for Annex A highlight two errors in the OCL 2.4 clarifications.

    OclVoid::oclIsKindOf/oclIsTypeOf should return true/false rather than invalid.

    ? oclIsKindof true for all types except OclIsInvalid.

  • Reported: OCL 2.4 — Mon, 30 Sep 2013 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Obsolete implicit cast to Bag

  • Key: OCL25-71
  • Legacy Issue Number: 19537
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Descriptions of Collection::InEmpty(), notEmpty() refer to the implicit cast to Bag rather than use of oclAsSet().

  • Reported: OCL 2.4 — Tue, 22 Jul 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:12 GMT

Coolection operations do not allow invalid inputs

  • Key: OCL25-45
  • Legacy Issue Number: 19534
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    Add not oclIsInvalid() precondition on all non-Collection inputs.

    e.g including(object : T)

    pre: not object.oclIsInvalid()

  • Reported: OCL 2.4 — Tue, 22 Jul 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:11 GMT

Missing mode precondition

  • Key: OCL25-4
  • Legacy Issue Number: 19536
  • Status: open  
  • Source: Model Driven Solutions ( Ed Willink)
  • Summary:

    To Integer::mod all

    pre: i <> 0

  • Reported: OCL 2.4 — Tue, 22 Jul 2014 04:00 GMT
  • Updated: Thu, 8 Oct 2015 14:11 GMT