Thanks for both of your assistance. I've found the slicer
example Pascal referred me to and think I understand the query
examples. A couple more questions:
Which approach is preferred? It seems like the query interface
might result in code that is easier to understand at a high
level, but maybe I haven't understood the slicer deeply enough
yet. I note that the query interface is advertised as being
Is there an example anywhere putting together the bits
required to use the query interface?
Collection<IMetadataRepository> metadataReposList = new
IQueryable<IInstallableUnit> allMetadataRepos =
Set<IInstallableUnit> toInstallOrUpdate =
Now suppose I've got two Features I want to use as a root to
search from. I know I need a traverse query, and I can see how
to run a query against an IQueryable, but I'm not sure how to
pass my two root Features in as arguments. Or am I asking the
Thanks in advance,
On Fri, Dec 10, 2010 at 8:35 AM, Thomas
On 2010-12-09 23:21, David Orme wrote:
I'm trying to execute a P2 query that can chase
down all IUs resulting from starting with several
features and traversing the tree of IUs and
included features until all dependencies are
It seems that I need an
IQueryable to execute against and some way to
specify the set of Features to use as roots.
I've got an IQueryable, (and
can successfully createIUAnyQuery() against it),
but haven't been able to work out how to extend
this to query for the subset that is reachable
from a set of Features that are being treated as
roots and are available via the IQueryable.
pointers to code snippets or anything
else would be welcome.
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.
p2-dev mailing list