Issue 7969: Section: 9.14.1 (uml2-rtf) Source: (, ) Nature: Clarification Severity: Significant 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{}) Resolution: 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 Revised Text: Actions taken: December 5, 2004: received issue February 20, 2015: closed issue Discussion: End of Annotations:===== ender: juergen@amethyst.omg.org (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 6.1.0.6 Date: Mon, 06 Dec 2004 11:22:14 -0500 To: issues@omg.org, uml2-rtf@omg.org From: Juergen Boldt Subject: issue 7969 -- UML 2.0 (Infrastructure) RTF issue From: webmaster@omg.org Date: 05 Dec 2004 12:34:35 -0500 To: Subject: Issue/Bug Report -------------------------------------------------------------------------------- Name: Paul Berry Company: N/A mailFrom: Paul_Berry@alumni.hmc.edu Notification: Yes Specification: UML infrastructure Section: 9.14.1 FormalNumber: ptc/03-09-15 Version: 2.0 RevisionDate: December 2003 Page: 80-81 Nature: Clarification Severity: Significant HTTP User Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 Description 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{}) ================================= Jürgen Boldt Director, Member Services Object Management Group 250 First Avenue, Suite 100 Needham, MA 02494 Tel. +1 781 444 0404 ext. 132 Fax: +1 781 444 0320 email: juergen@omg.org www www.omg.org ================================