Re: Question to OCL-Constraints in MOF 2.0: Usage of "oclType"



Re: Question to OCL-Constraints in MOF 2.0: Usage of "oclType"

From: Anneke Kleppe ^lt;a.kleppe@klasse.nl>
Date: Tue 20 Sep 2005 - 13:21:58 BST
Message-ID: <432FFEE6.3050806@klasse.nl>
Reflection was not included in OCL because the MOF itself provides 
reflection. You can use the getMetaClass() operation in 
Reflection::Element to obtain the type of any element. This operation 
can be used in OCL expressions in the same manner as any other operation.

However, this is only available in MOF. At the time OCL 2.0 was created, 
it was unclear wether this was to be included in the part that the MOF 
shares with the UML. In the end it was not, so this option is not 
available in UML.

Regards, Anneke Kleppe

Steffen Zschaler wrote:

> oclType is not defined in OCL. OCL is not intented to support full 
> reflection, it only allows comparison to directly provided classifier 
> *names* as in c.oclIsKindOf (MyClass), but you cannot obtain a 
> reification of an actual classifier.
>
> Best wishes,
>
> Steffen
>
> Sascha Rüter wrote:
>
>> Dear all,
>>
>> I'd like to find a solution to get access to the type of Classifier 
>> in OCL
>> 2.0. The existing method below uses the expression "c.oclType", which 
>> seems
>> not to be valid in OCL 2.0:
>>
>> context Classifier
>> def:    maySpecializeType(c: Classifier): Boolean
>>   =    self.oclIsKindOf(c.oclType)
>>
>>
>> I'm not an expert in OCL but in MOF, so I'm sorry if there is a simple
>> solution that I'm not aware of.
>>
>> Thanks for your help!
>>
>> Kind regards,
>> Sascha
>>
>>
>>
>> To remove yourself from this list please mail 
>> puml-list-request@cs.york.ac.uk
>> with a message containing the word "unsubscribe".
>>
>>  
>>
>
Received on Tue Sep 20 13:21:52 2005