Re: Instance of in OCL!

Re: Instance of in OCL!

From: Vladimir Mencl ^lt;>
Date: Sun 16 Apr 2006 - 09:19:20 BST
Message-ID: <>
On 04/16/2006 02:50 AM, Milan Milanovic wrote:
> How to represent instance of relation in OCL ? Is it possible ?

Yes it is.

There are two built-in functions defined on each type, oclIsTypeOf and 

Quoting from Sect. 2.5.9 of ad/02-05-09
   oclIsTypeOf (t : OclType) : Boolean
   oclIsKindOf (t : OclType) : Boolean

   The operation is oclIsTypeOf results in true if the type of self and t
   are the same.

   The oclIsKindOf property determines whether t is either the direct type
   or one of the supertypes of an object.

Depending on whether you want the instanceof relation to include 
subclassing, either the oclIsTypeOf or oclIsKindOf operation should do 
what you want (the latter one will behave as the Java instanceof operator).

Best Regards,

> e.g. like in java object instanceOf Class
Received on Sun Apr 16 09:19:44 2006