[gme-users] Polymorphism in OCL

Akos Ledeczi akos.ledeczi at vanderbilt.edu
Thu Mar 9 10:46:18 CST 2006


Inheritance in the metamodel is ony a tool to help metamodeling itself: 
in the target language the inheritance relationship disappears. In other 
words, there is no relation between Valuetype and any other model kind 
in your language. Hence, you constraint will only work with Valuetype 
objects and nothing else. Akos

Zawar Qayyum wrote:
> Hello Guys
>  
> I can't seem find any reference to polymorphism in the OCL reference, 
> although its present in UML. In GME for example the following doesn't 
> produce the desired results:
>  
> self->parts(ValueType)->forAll(q1, q2 : ValueType | q1 <> q2 implies 
> q1.Index <> q2.Index)
>  
> In the above scenario, various Models inherit from ValueType. The 
> variable Index is defined in ValueType, and containment of ValueType is 
> defined for the current object (self) class. But all the objects 
> contained in self are child types of ValueType, and not of ValueType 
> itself. But the condition q1, q2: ValueType doesn't seem to include the 
> child types and therefore the constraint is not applied.
>  
> The question is: is this an OCL shortcoming or is it something thats 
> missing in the implementation?
>  
> Regards
> Zawar
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users


More information about the gme-users mailing list