UML 2.2 RTF Avatar
  1. OMG Issue

UML22 — Section: 9.14.1

  • Key: UML22-48
  • Legacy Issue Number: 7969
  • Status: closed  
  • Source: N/A ( Paul Berry)
  • Summary:

    The allOwnedElements query (defined in Core::Abstractions::Ownerships) operates by recursing downward through the ownership hierarchy. Its OCL implementation looks like this: Element::allOwnedElements(): Set(Element); allOwnedElements = ownedElement->union(ownedElement->collect(e | e.allOwnedElements())) In the absence of sophisticated optimization, this query is only guaranteed to terminate if the ownership hierarchy is non-circular. The ownership hierarchy is guaranteed to be circular by constraint [1] (An element may not directly or indirectly own itself). But the OCL description of constraint [1] is written in terms of the allOwnedElements() query: not self.allOwnedElements()>includes(self) If a modeling tool were to be written based on these rules in a straightforward way, it would never be able to detect a violation of constraint [1]. Instead it would go into infinite recursion while trying to check the constraint. Proposed solution: Add the following operation to 9.14.1: [3] The query isCircularlyOwned walks the chain of direct and indirect owners of an element, checking whether the chain contains any circularities, or any of the elements in the set prohibitedElements. Element::isCircularlyOwned(prohibitedElements: Set(Element)): Boolean; isCircularlyOwned = if owner>isEmpty() then false else if prohibitedElements->including(self)>includes(owner) then true else owner.isCircularlyOwned(prohibitedElements>including(self)) And change constraint [1] to: [1] An element may not be directly or indirectly owned by itself. not self.isCircularlyOwned(Set{})

  • Reported: UML 2.0 — Sun, 5 Dec 2004 05:00 GMT
  • Disposition: Resolved — UML 2.2
  • Disposition Summary:

    Discussion
    It is not necessary for the OCL in the specification to be implementable in some “straightforward way”. It is only
    necessary that the OCL have the proper meaning according to OCL semantics, which the identified expressions do.
    An implementation is free to implement them in the manner that the issue author suggests. It is not necessary to
    complicate the specification by adopting a specific implementation approach.
    Disposition: Closed - No Change

  • Updated: Fri, 6 Mar 2015 20:58 GMT