recursion [message #41558] |
Wed, 24 October 2007 10:21 |
Eclipse User |
|
|
|
Originally posted by: nickkirtley.gmail.com
hi,
I have a model, and in that model there are a number of aggregated
components.
c1 aggregates c2, c2 agg. c3, c3 to c4 etc.
I then want a list of the aggregated components. The problem is that I
don't how many components there are. How can solve this problem in a query?
regards,
nick
|
|
|
Re: recursion [message #41580 is a reply to message #41558] |
Wed, 24 October 2007 12:26 |
Eclipse User |
|
|
|
Originally posted by: cdamus.ca.ibm.com
Hi, Nick,
If you don't mind using non-standard OCL capabilities (and, in the latest
I-build, getting warnings when you use them), then you can try our custom
"closure" iterator:
self->closure(
attribute->select(aggregation <> AggregationKind::none).type->select(
oclIsKindOf(Component))
This gets the transitive closure, starting from the self component, of all
components related by an aggregation attribute (in the aggregating
direction).
If you need to use only standard OCL, then you would probably have to define
a recursive helper operation using a def: expression.
HTH,
Christian
Nick Kirtley wrote:
> hi,
>
> I have a model, and in that model there are a number of aggregated
> components.
> c1 aggregates c2, c2 agg. c3, c3 to c4 etc.
> I then want a list of the aggregated components. The problem is that I
> don't how many components there are. How can solve this problem in a
> query?
>
> regards,
> nick
|
|
|
Powered by
FUDForum. Page generated in 0.01942 seconds