Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] @noimplement and @noextend annotation of IQuery

It's definitely not easy to learn query language. The detail
documentation and a lot of examples are necessary to help us learn it by
ourselves. Otherwise, the teacher(Thomas) would be very busy to answer
the questions.

A suggestion for the wiki page of query language,

It'd better add some information to introduce how to find the attributes
of IArtifactKey. Why is 'classifier', and what else for other attributes
of IArtifactKey?

IQuery<IArtifactKey> query =
QueryUtil.createMatchQuery(IArtifactKey.class, "classifier == $0",
classifier);

-- 
Best Regards,
Meng Xin(Kane)


On Wed, 2010-03-10 at 14:25 -0500, John Arthorne wrote:
> These are the kinds of problems I was trying to describe in
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=304130. We have made
> life much more complicated for these clients in order to solve a
> problem they don't have. Whether or not these queries can be written
> as expression-based queries isn't really the issue - the problem is
> that only Thomas seems to be able to write (and debug) non-trivial
> expression queries and clients who don't have a Thomas on hand will
> end up having to iterate over an entire queryable anyway to manually
> collect up the matches they care about. 
> 
> John
> 
> 
> On Wed, Mar 10, 2010 at 3:03 AM, Thomas Hallgren <thomas@xxxxxxx>
> wrote:
>         On 03/10/2010 06:36 AM, Meng Xin Zhu wrote:
>                 For example,
>                 
>                 A java service records some deselected IUs, the query
>                 should exclude
>                 those IUs in that list.
>                   
>         
>         
>         You can use the function unique(). If given an argument that
>         is a Set, that Set is used as the discriminator.
>         
>         Set<IInstallableUnit> recordedIUs = ...
>         QueryUtil.createQuery("unique($0)", recordedIUs);
>         
>         
>         
>                 Another simpler case is querying the IUs whose id
>                 starts with specified
>                 string.
>                 
>                   
>         Use a SimplePattern. A string like 'my.prefix.*' will match
>         anything starting with 'my.prefix.'
>         
>         QueryUtil.createMatchQuery("id ~= $0",
>         SimplePattern.parse(prefix + '*'));
>         
>         
>         For more advanced cases that really cannot be resolved only by
>         use of a query, there is often a benefit to start with a query
>         anyway to benefit from indexing and then perform additional
>         filtering as a next step:
>         
>         HashSet<IInstallableUnit> collector = new
>         HashSet<IInstallableUnit>();
>         Iterator<IInstallableUnit> iter = queriable.query(<inital
>         query>, monitor).iterator();
>         while(iter.hasNext()) {
>           IInstallableUnit iu = iter.next();
>           if(mySpecialMatch(iu))
>               collector.add(iu);
>         }
>         
>         So far, we have seen very few cases where this has been
>         necessary.
>         
>         HTH,
>         - thomas
>         
>         
>         
>         _______________________________________________
>         p2-dev mailing list
>         p2-dev@xxxxxxxxxxx
>         https://dev.eclipse.org/mailman/listinfo/p2-dev
>         
> 
> _______________________________________________
> p2-dev mailing list
> p2-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/p2-dev


Back to the top