Issue 8917: allInstances (ocl2-rtf) Source: SAP AG (Mr. David Frankel, david.frankel(at)sap.com) Nature: Uncategorized Issue Severity: Summary: It is not entirely clear from the OCL 2.0 specification whether the allInstances operation returns instances of subclasses of the designated type. In other words, it isn't 100% clear whether t.allInstances( ) returns instances of subclasses of t. Recommendation: The best solution would be to have two operations, one which returns instances of subclasses and one which does not. A second-best solution would be to make it clear that allInstances returns instances of subclasses. In this case, an OCL programmer could use the oclIsTypeOf( ) operation as a filter to write a derived operation that does not return instances of subclasses. If allInstances does not return instances of subclasses, it would not be nearly as straightforward to write a derived operation that does return instances of subclasses. Resolution: Revised Text: Update the allInstances() definition in Section 11.2.5 Operations and Wel-formedness Rules: allInstances() : Set(T) Returns all instances of T, including subtypes, where T is self. May only be used for classifiers that have a finite number of instances. This is the case, for example, for user-defined classes because instances need to be created explicitly. This is not the case, for example, for data types such as the standard String, Integer, and Real types. pre: self.oclIsKindOf(Classifier) -- self must be a Classifier and not self.oclIsKindOf(DataType) -- self must have a finite number of instances NOTE: The revision cannot be applied since superseded by issue 6532 which moves the definition 'allInstances' from 11.2.5 to 8.3.8. The new text of allInstances as defined by issue 6532 is in line with the intended clarification of this issue since it says: "returns all instances of the classifier and the classifiers specializing it" Actions taken: July 12, 2005: received issue October 16, 2009: closed issue Discussion: To obtain all instances of a class that are not instances of some specializing class, it is sufficient to be able to select them fron the allInstances set: t.allInstances()->select(oclIsTypeOf(t)). End of Annotations:===== ubject: allInstances Date: Tue, 12 Jul 2005 15:58:09 -0700 Thread-Topic: allInstances Thread-Index: AcWHNSP4spqvEdGhSwSVOuUM0cOBXQ== From: "Frankel, David" To: Cc: , "Uhl, Axel" X-OriginalArrivalTime: 12 Jul 2005 22:58:15.0632 (UTC) FILETIME=[2FE28D00:01C58735] X-SAP: out X-SAP: out Issue: It is not entirely clear from the OCL 2.0 specification whether the allInstances operation returns instances of subclasses of the designated type. In other words, it isn't 100% clear whether t.allInstances( ) returns instances of subclasses of t. Recommendation: The best solution would be to have two operations, one which returns instances of subclasses and one which does not. A second-best solution would be to make it clear that allInstances returns instances of subclasses. In this case, an OCL programmer could use the oclIsTypeOf( ) operation as a filter to write a derived operation that does not return instances of subclasses. If allInstances does not return instances of subclasses, it would not be nearly as straightforward to write a derived operation that does return instances of subclasses.