Re: allInstances at pre

Date view Thread view Subject view Author view Attachment view

From: Prof. Dr. Peter H. Schmitt (
Date: Tue 10 May 2005 - 08:21:55 BST

I still owe you an answer to one of your questions:

Andreas Awenius wrote:
>>This is okay except for the fact the OCL does not allow you
>>to attach @pre to allInstances.
> Why do you think this?

What makes me think so?
The standard document "UML 2.0 OCL Specification" ptc/03-10-14
which I believe is the latest word in the OCL 2.0 standard.

On page 79 the grammar rules for OperationCallExpCS are given.
These are the only rules where @pre is dealt with. Since
allInstances is a class operation part [G] applies. But, as you see,
no @pre allowed here.
Also the construct "User@pre" in your proposed solution  is not covered 
by the standard grammar. "User" maps to the non-terminal "pathNameCS"
and as can be seen, again from production [G], no @pre allowed here.

One could argue that this is simply an error in the standard. Is there
somebody in the OMG who cares?

It would be interesting to hear what the other OCL tools do(we have 
recently witnessed a number of announcments of new OLC tools on this
mailing list). Do they accept @pre for class operations? Do they
accept @pre an pathNames?



Fakultät für Informatik
Universität Karlsruhe

Date view Thread view Subject view Author view Attachment view