Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 261403 - [query] Add compound queryable
Summary: [query] Add compound queryable
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: p2 (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M5   Edit
Assignee: P2 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 261460
  Show dependency tree
 
Reported: 2009-01-16 20:10 EST by Ian Bull CLA
Modified: 2009-01-21 01:49 EST (History)
2 users (show)

See Also:


Attachments
CompoundQueryable (21.11 KB, patch)
2009-01-16 20:10 EST, Ian Bull CLA
no flags Details | Diff
Updated patch (36.11 KB, patch)
2009-01-18 02:40 EST, Ian Bull CLA
no flags Details | Diff
Compound Queryable that does not support transitive queries (29.37 KB, patch)
2009-01-20 19:29 EST, Ian Bull CLA
jeffmcaffer: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Bull CLA 2009-01-16 20:10:18 EST
Created attachment 122854 [details]
CompoundQueryable

There are a number of places that take a set of queryables and perform queries across them all.  For ContextQueries this does not work.

For example:
S1 = {1,2,3,4}
S2 = {3,4,5}

getMax{S1 + S2} != getMax{S1} + getMax{S2}

In order to properly query the combined sets when ContextQueries are used, you need to:

getMax(getMax{S1} + getMax{S2})

I have created a CompoundQueryable to make this easier for clients.

The patch includes CompoundQueryable and the 10 test cases.  81% coverage in the compound queryable (there are a few unreachable methods because there is a private inner class that implements an interface, but not all the methods are used).

The patch is ready for review.
Comment 1 Ian Bull CLA 2009-01-16 20:12:29 EST
Also, this patch adds a dependency on org.eclipse.core.tests.harness.

If this is determined to be a bad idea (I posted a question about this), i will rework the test case that causes problems.
Comment 2 Ian Bull CLA 2009-01-18 02:40:17 EST
Created attachment 122873 [details]
Updated patch

Not all queries can be evaluated by first calling the query on the sub-queryables and then calling the query on the results.

This patch fixes this.  It allows query implementers to specify the query to use on the sub-queryables.  There is a default implementation in all query superclasses.  The default implementation is not optimal, but it works in all cases.

I added a bunch of new tests cases for a variety of compound queries and compound queryables (and combinations of the two).
Comment 3 Ian Bull CLA 2009-01-20 19:29:16 EST
Created attachment 123152 [details]
Compound Queryable that does not support transitive queries

p2 currently doesn't have any transitive queries, so supporting them right now is not necessary.  I have a patch that will do this (if needed) and I will attach it here.  

This patch adds CompoundQueryables that do not support transitive queries.
Comment 4 Jeff McAffer CLA 2009-01-20 21:07:30 EST
Thanks Ian.  I committed the lates patch to head with a couple tweaks to JavaDoc.

There remains the issue about non-transitive queries on compound queryables.  Do you want to cover that in this bug or open another?

Also, a question.  Do CompositeRepos qualify as CompoundQueryables?
Comment 5 Ian Bull CLA 2009-01-20 22:23:10 EST
(In reply to comment #4)
> Thanks Ian.  I committed the lates patch to head with a couple tweaks to
> JavaDoc.
I noticed a few javadoc typos just now. If they still exist I will fix them.

> 
> There remains the issue about non-transitive queries on compound queryables. 
> Do you want to cover that in this bug or open another?
> 
I will do this.

> Also, a question.  Do CompositeRepos qualify as CompoundQueryables?
> 
YEP!  well sort of.  Because we can't have multiple inheritance, they will likely not be compound queryables, but they will use them.

See the patch in Bug 261460 for an example.  
Comment 6 Ian Bull CLA 2009-01-21 01:06:07 EST
Bug 261758 includes a patch for non-transitive queries.
Comment 7 Ian Bull CLA 2009-01-21 01:49:00 EST
I am closing this bug as Fixed.  I have set the target milestone to 3.5 M5.