|Re: [p2-dev] Executing a P2 traverse query|
On 2010-12-09 23:21, David Orme wrote:
The simplest query from the wiki looks like this:
$0.traverse(parent | parent.requirements.collect(rc | select(iu | iu ~= rc)).flatten())
It expects a collection (i.e. your set of roots) as it's first argument. You then apply it to your IQueryable.
In the _expression_, 'parent' is the variable holding each item from the roots. The _expression_ compares all iu's from your IQueryable with the requirements of the 'parent' and this results in new instances that will become 'parent' as the query traverses recursively.