RE: [Fwd: Re: asking about OCL]

RE: [Fwd: Re: asking about OCL]

From: D H. Akehurst <>
Date: Tue, 16 May 2006 14:00:25 +0100
Message-ID: <>
if you regard the string 'A' as refering to an object of type Class,
then using the dot operator makes sense, as you are calling an operation
on an object.
regarding OCL....using the double colon for referencing static features
is not very reader friendly. It is much nice (in my opinion) for '::' to
be used for structure navigation
i.e. packages, and '.' for accessing features. If a static feature is a
feature belonging to a class, then you access it by refering to an
object that represents that class
and using the dot notation.
i.e.  'x::y::A' gives an object that refers to class A in package x::y
then '' gives a feture 'xxx' of class A
maybe there is in inconsistency here that I've not considered yet.


[] On Behalf Of Anneke Kleppe
	Sent: 16 May 2006 12:49
	Subject: [Fwd: Re: asking about OCL]
	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" <>
<>  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
		and thus its use should be similar to other operations
		within OclAny, e.g. "_=_" or oclIsNew(). Therefore, on
		instance variable, i.e., self, one can write 
		"self.allInstances()".  And by the way, the Dresden OCL
		also uses this as concrete syntax :-). 
		In the old OCL 1.1 standard,  "allInstances()" is
		as operation of type OclType. This leads just to another
		   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 - 14:01:03 BST