[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [p2-dev] p2ql: query parent ius

Yes, of course. That method was removed, sorry. The only way to check if a requirement has a specific namespace is to write an IU that satisfies all requirements with that namespace, regardless of name and version. You should be able to write something like:

IInstallableUnit myPackageMatchingIU = new InstallableUnit() {
   @Override
   public boolean satisfies(IRequirement r) {
      return r instanceof RequiredCapability && "java.package".equals(((RequiredCapability)r).getNamespace());
   }
};

and then use that UI in the query like this:

 QueryUtil.createQuery("select(x | x.requirements.exists(r | $0 ~= r && exists(y | y ~= r)))", myPackageMatchingIU)

Looking at your example, I think I misinterpreted your question. I thought of a "known installable unit" as "some unit in a known queried set". I guess you already have an explicitly known unit. In that case, the query should be written:

 QueryUtil.createMatchQuery("requirements.exists(r | $0 ~= r && $1 ~= r))", myPackageMatchingIU, myKnownIU)

Dropping the need for the specific "java.package" requirement makes it even simpler. Now you don't need the special IU. Just write:

 QueryUtil.createMatchQuery("requirements.exists(r | $1 ~= r)", myKnownIU)

HTH,
Thomas Hallgren


On 2011-02-01 14:27, Thomas Hallgren wrote:
Hi Ivanov,

How about this:

 "select(x | x.requirements.exists(r | r.namespace = "java.package" && exists(y | y ~= r)))"

HTH,
Thomas Hallgren


On 2011-02-01 12:58, Ivanov, Radoslav wrote:
Hello
 
I am writing with regards to p2QL. I would like to select all installable units that require any package provided by an known installable unit.
 
I would be grateful if you could provide help for this query.
 
Thanks
Rado
 
_______________________________________________ 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