[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] Match/Context naming

How about just Query, and IterativeQuery?

- henrik

24 feb 2010 kl. 18.16 skrev Susan Franklin McCourt <susan_franklin@xxxxxxxxxx>:

a ha. That example really helped. I'm still thinking in "old-school" (pre-QL) query language.
Now I understand where CollectionQuery comes from.
Maybe CollectionQuery and BooleanQuery are the right ideas, then.....what do others think?


<graycol.gif>Thomas Hallgren ---02/24/2010 08:54:18 AM---On 02/24/2010 05:10 PM, Susan Franklin McCourt wrote:


To: P2 developer discussions <p2-dev@xxxxxxxxxxx>
Subject: Re: [p2-dev] Match/Context naming

On 02/24/2010 05:10 PM, Susan Franklin McCourt wrote:
> One of the queries can be determined in isolation from the other
> candidates.
Check. A boolean outcome is evaluated for each candidate.

> The other query can only be determined relative to all of the other
> candidates.
While you need all candidates in order to deliver a result, there is
nothing saying that one candidate is compared to other candidates. It
might be the case (as in the case of latest()), but far from always.

> Both queries are computed by running some _expression_ and getting a
> boolean back that determines if there is match. (In my brain, boolean
> and match are the same).
No, that's not correct. This query has no boolean _expression_ involved:

collect(iu | iu.requiredCapabilities).flatten()

It simply iterates over all candiates, obtains their
requiredCapabilities and then flatten all resulting collections into one
collection that is returned.

> The differentiating point is whether the other candidates need to be
> examined to determine the answer.
I think I see where the confusion lies. You think that there is always
some boolean function that determines whether or not a candidate should
be included in the result. In one case, that function needs the other
candidates to determine the result and in another case it can be
determined in isolation. That distinction is no longer strictly valid.
For two reasons:

1. As shown in the example above, there need not be any boolean
_expression_ invovled.
2. If there is a boolean _expression_, it might act on one candidate at a
time in isolation from other candidates.

For case #2 consider the following:

 select(x | x.id == 'some.name')

Written like that, it needs access to all candidates. Still, it peruses
one candidate at a time. The query can also be written as the 'match' query

 x.id == 'some.name'

So what is the difference between the two? That's the essence of what I
want to clarify.

- thomas

p2-dev mailing list
p2-dev mailing list