Re: [Tracker] A quick question
- From: Jürg Billeter <j bitron ch>
- To: "Zheng, Huan" <huan zheng intel com>
- Cc: "tracker-list gnome org" <tracker-list gnome org>
- Subject: Re: [Tracker] A quick question
- Date: Wed, 24 Feb 2010 07:45:35 +0100
Hi,
On Wed, 2010-02-24 at 10:22 +0800, Zheng, Huan wrote:
Hi, how can I select all music files that has no performer?
What I do now is use the following select and check the result, if the
second value is blank, then that song has no performer,
Track-sparql âq âSELECT ?song ?performer WHERE { OPTIONAL { ?song
nmm:performer ?performer} } GROUP by (?performer)â
Is there a better way?
tracker-sparql -q 'SELECT ?song WHERE {
?song a nmm:MusicPiece .
OPTIONAL { ?song nmm:performer ?performer }
FILTER (!BOUND(?performer))
}'
This returns all songs where nmm:performer has no value.
Say SELECT ?song WHERE {!{?song nmm:performer ?performer}} ?
Unfortunately, it's not possible in such a short form in SPARQL 1.0.
However, with SPARQL 1.1 (currently a draftÂ) the following is possible:
SELECT ?song WHERE {
?song a nmm:MusicPiece .
NOT EXISTS { ?song nmm:performer ?performer }
}
This is not yet implemented in Tracker.
Regards,
JÃrg
 http://www.w3.org/TR/sparql11-query/#negation
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]