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

Thank you for your reply, I will move to the public newsgroup after this
message.

The closure does not work in the console complaining with a simple
'Usage of non-standard "closure" iterator', otherwise I would already
have tried it out.

And you were also right about the result of my constraint, it should
really be a set of FlowNodes.

Best regards,
Steffen

Am 24.03.2011 16:56, schrieb Adolfo Sánchez-Barbudo Herrera:
> Steffen,
> 
> Please move this kind of questions to the public MDT/OCL newsgroup.
> 
> This newsgroup is usually for developers purposes
> 
> I don't know the BPMN2 metamodel, but have you had a look to the closure
> operator ?. It looks like it fits quite well to your needs...
> 
> Try the following expression as the body of your operation (without any
> input parameter)
> 
> self->closure(outgoing.targetRef)
> 
> On the other hand, shouldn't be the result of your operation a set of
> FlowNodes ?
> 
> P.S: closure operator will formally become specified in the OMG OCL 2.3
> 
> Best Regards,
> Adolfo.
> 
> El 24/03/2011 15:24, Steffen Heublein escribió:
>> 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
>>
> _______________________________________________
> mdt-ocl.dev mailing list
> mdt-ocl.dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/mdt-ocl.dev


Back to the top