UML 1.4 NO IDEA Avatar
  1. OMG Issue

UML14 — OCL Error

  • Key: UML14-961
  • Legacy Issue Number: 3098
  • Status: closed  
  • Source: Anonymous
  • Summary:

    sUnique for Collections is defined as follows:
    >>
    >>collection->isUnique(expr : OclExpression) : Boolean
    >> post: result = collection->collect(expr)->forAll(e1,e2 | e1<>e2)
    >>
    >>Unfortunately, if the collection is not empty, this expression
    >>always evaluates to false. This is due to the fact that in a
    >>forAll over two iterators, both iterate over the full collection.
    >>Therefor, for each element in the collectionen , there is a
    >>step where both itereters point to this element, but at this
    >>point, e1 <> e2 evaluates to false.
    >>
    >>My suggestion for the definition of isUnique would be as follows:
    >>
    >>collection->isUnique(expr : OclExpression) : Boolean
    >> post:
    >> let res = collection->collect(expr) in
    >> result = res->forAll(e $|$ res->count(e) = 1)
    >>
    >>This expression states, that each element in the collection 'res'
    >>appears exactly once, i.e. is unique.

  • Reported: UML 1.2 — Tue, 7 Dec 1999 05:00 GMT
  • Disposition: Resolved — UML 1.3
  • Disposition Summary:

    No Data Available

  • Updated: Fri, 6 Mar 2015 21:37 GMT