[Fwd: Re: asking about OCL]

[Fwd: Re: asking about OCL]

From: Anneke Kleppe <a.kleppe_at_klasse.nl>
Date: Tue, 16 May 2006 13:49:02 +0200
Message-ID: <4469BC2E.8080109@klasse.nl>
The predefined operation /allInstances /is an operation that effectively 
works on a class, not on an instance. It does not make sense to ask for 
the set of all instances from a single instance, instead you should ask 
its class. This has not been addressed in the OCL specification 
properly. There is a bit of cryptic text that says: "Returns all 
instances of self. Type T is equal to self." In my opinion, the 
operation /allInstances /should have been defined as an instance of 
class /Feature /(UML Superstructure, section 7.3.10) with attribute 
'/isStatic/' set to true.

In OCL all static features, attributes or operations, are referenced 
using the double colon notation. Therefore, in my opinion, the correct 
notation would be the one that Steffen mentioned:
A::allInstances(). Unfortunately, all examples in the OCL spec. use the 
single dot notation, but they do use 'CLASSNAME.allInstances()', not 
self.allInstances(). As I said, the latter expression does  not make any 
sense at all. In fact, in our book and in the Octopus tool, the double 
colon notation is the only one that is regarded correct. :-)

I hope this helps to clear things up.
Anneke Kleppe

Achim D. Brucker wrote:

>"Prof. Dr. Peter H. Schmitt" <pschmitt@ira.uka.de> schrieb:
>>That is strange. I would have thougth Steffen Zschaler's comment correct.
>>Is there a definite way to settle disputes of this kind?
>in the OCL 2.0 standard, "allInstances" is defined as being an
>operation of class OclAny (e.g. see chapter 11 of the standard)
>and thus its use should be similar to other operations defined
>within OclAny, e.g. "_=_" or oclIsNew(). Therefore, on any 
>instance variable, i.e., self, one can write 
>"self.allInstances()".  And by the way, the Dresden OCL Parser
>also uses this as concrete syntax :-). 
>In the old OCL 1.1 standard,  "allInstances()" is declared
>as operation of type OclType. This leads just to another concrete
>   context Person:
>   inv: Person.allInstances->size() >1
>The notion "Person::allInstances" emerges often, but I have no idea
>from where it comes, albeit I have often used it myself :-)
Received on Tue 16 May 2006 - 12:49:05 BST