instance OCL constraints?



Date view Thread view Subject view Author view Attachment view

From: SainTiss (saintiss@arklinux.org)
Date: Thu 11 Mar 2004 - 16:35:00 GMT


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

unless I'm severly mistaken, the normal way of going about with OCL is 
specifying certain constraints on a model, which must hold for each instance 
of that model. More specifically, if the constraints only apply to e.g. one 
class of the model, then accordingly, they must hold only for all instances 
of that class. The "context" specification determines this scope.

So a typical example would be a class diagram with certain constraints on the 
classes involved. An instance of that class diagram could be seen as an 
object structure, i.e. a collaboration of objects, each object being an 
instance of a class defined in the class diagram. 

Now suppose one would use an UML collaboration diagram to describe a snapshot 
of such an object structure. Then it would be handy to be able to use OCL to 
describe a constraint which must hold for a certain object in the 
collaboration. Is this possible?

I've been thinking a bit about this, and I guess it comes down to specifying a 
constraint of which the context is not "all instances of a certain type" but 
"just one instance". AFAIK the "context" keyword always needs a type, and not 
an instance, so I guess it won't work that way, but maybe something like a 
helper function which would take the one instance as a parameter for example?

Thanks in advance,

Hans


- -- 
Ark Linux - Linux for the Masses (http://arklinux.org)

Capitalism: 
You don't have any cows. The bank will not lend you money to buy cows, 
because you don't have any cows to put up as collateral.

Representative Democracy:
You have two cows. Your neighbors pick someone to tell you who gets the milk. 

In a world without walls and fences, who needs windows and gates?

Hans Schippers
2LIC INF
UA 2003-2004
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAUJU0XlnUYIbmLOQRAvvsAJ9R3/0mW36up31DBlqTzwNmfnp2SwCdEJdY
D+11hvkokm2AYrDrNKjG/9Q=
=+PfQ
-----END PGP SIGNATURE-----

Date view Thread view Subject view Author view Attachment view