OCL Invariant to find cycle in inheritance tree interface [message #539032] |
Wed, 09 June 2010 07:44  |
Eclipse User |
|
|
|
Hi,
I have a metaclass 'Interface' which can have * superInterfaces, and I
would like to write a OCL constraint or query to check/find cycle in
inheritance tree, but I don't know how to implement a cycle detection
algorithm in OCL. Someone have experienced this already?
|
|
|
|
Re: OCL Invariant to find cycle in inheritance tree interface [message #541689 is a reply to message #539181] |
Tue, 22 June 2010 03:20  |
Eclipse User |
|
|
|
Hi,
Thanks for your answer, I have found how to use closure iterator :
context Interface
inv interfaceNotPresentInAllSuperInterfaces : not
self.superInterfaces->closure(superInterfaces)->includes(self)
Best Regards.
On 09/06/2010 23:23, Ed Willink wrote:
> On 09/06/2010 12:44, Esteban DUGUEPEROUX wrote:
>> Hi,
>>
>> I have a metaclass 'Interface' which can have * superInterfaces, and I
>> would like to write a OCL constraint or query to check/find cycle in
>> inheritance tree, but I don't know how to implement a cycle detection
>> algorithm in OCL. Someone have experienced this already?
>
> OCL like any other language can encounter a stack overflow for a poorly
> programmed traversal of a loop. You need to maintain a Set of interfaces
> so far, to bound the recursion.
>
> MDT/OCL 1.3.0 implements an additional closure() iterator for exactly
> this kind of problem. My proposed specification change is attached.
> N.B the attached is a draft and has not yet been approved for OCL 2.3.
>
> Regards
>
> Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.06240 seconds