Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mdt-ocl.dev] OCL recursive operation

Steffen,

it seems you may be able to solve the problem elegantly using ->closure which is supported by MDT/OCL.

Best,
-- Axel

Steffen Heublein <steffen.heublein@xxxxxxxxxxxxxx> wrote:
Hello, I am trying to set up a recursive operation in OCL so that I get all objects that are associated to a certain one (and only those). The context is a BPMN2 process graph and I wish to get a collection with all connectors (i.e. sequence flows) that are successors of a certain node) My constraint looks like this: context FlowNode def: getOutgoingSF(FN : FlowNode) : Set(SequenceFlow) = FN.outgoing.targetRef->collect(x|getOutgoingSF(x))->asSet()->union(FN.outgoing.targetRef) FN.outgoing.targetRef gets the direct successor node(s) of the current node. As such an operation is not really testable with the OCL Interactive Console (my current choice for trying out constraints) I am using Dresden OCL (http://www.dresden-ocl.org/index.php/DresdenOCL) to evaluate my constraints. Alas, the syntax checker complains that he can neither resolve the second getOutgoingSF nor (what is strange) the predefined operations asSet() and union(). Now, I am unsure if my recursive code is wrong or if there is some issue with Dresden OCL. Or if there is anything else that i did not think of (maybe also a simpler way to achieve my goal). Any help would be greatly appreciated and already thanks for reading this. Regards, Steffen
mdt-ocl.dev mailing list mdt-ocl.dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/mdt-ocl.dev

Back to the top