Re: OCL equal (=) operator , comparing identities



Date view Thread view Subject view Author view Attachment view

From: Joaquin Miller (jm-miller-at@sbcglobal.net)
Date: Fri 25 Jun 2004 - 19:37:28 BST


Ahmad, i feel questions like this arise because the UML vocabulary is 
lacking.  ODP makes and explains the distinction between being an instance 
of a class and being an instantiation of an object template.  (Since UML 
conflates class with object template, I'd like to say that in UML terms the 
distinction is between being an instance of a class and being an 
instantiation of that class.  But i can't even say that, since UML 
conflates instance with instantiation and uses 'instance' and 
'instantiation' interchangeably.)

        http://www.joaquin.net/ODP/Part2/9.html#9.19

Obviously: If we have two {pointers | handles | variables | ...} to 
objects, and one, c, is to an instance of UML class C (that is, to an 
object that conforms to the specification of class C) and the other, b, is 
to an instance of UML class B, both c and b can be to the same object.  C 
might be a subclass of B and that object might be an object instantiated 
using class C or some subclass of class C.  So it is certainly possible 
that both c and b are to that same object.

The technical questions remain:  Is 'c = b' a well formed OCL 
expression?  Does it mean what you hope it means?  Anneke and others have 
provided the answers.

Cordially,

Joaquin

02:57 AM 6/24/2004, Ahmad Hani wrote:
>I am sure that the OCL equal (=) operator is capable of comparing operands 
>that conform to the same data type either predefined or userdefined
>
>The thing I am not sure of : is it also capable of comparing objects based 
>on their identity ?
>
>Example
>
>Let c1 an instance of Class C, and b1 an instance of Class B, is the 
>following a valid expression, regardless it evaluates to true or false
>
>c1 = b1??
>
>and if the = can not compare objects based on ObjectID is it possible to 
>compare between instances that belong to different classes,
>
>That might sound crazy , but I need confirmation
>
>Thanks
>
>
>Ahmad

Date view Thread view Subject view Author view Attachment view