Re: [Tracker] SPARQL question



On 03/11/10 17:57, Ken Schmedding wrote:
I admit I have difficulty wrapping my head around these queries so here
is my question.
The following query (Tracker 0.8.17) will find all files with the tag "here"

tracker-sparql -q "SELECT ?s nie:url(?s) nie:mimeType(?s)
WHERE { ?s a nfo:FileDataObject;nao:hasTag [nao:prefLabel'here'] }"

Now what if I want to search for the tags "here" or "there" or "now"?
Can I do this in a single query that will give all the files that
contain one of these terms, and can I do it without repeating results?

Hi,

This works for me here locally (labels replaced), however,

tracker-sparql -q "SELECT ?urn nie:url(?urn) WHERE { ?urn a nfo:FileDataObject FILTER ( EXISTS { ?tag nao:hasTag [ nao:prefLabel ?label ] . FILTER(?label IN ('here','there', 'now')) } ) }"

After checking with Juergbi, the extra "FILTER ( EXISTS " is needed to filter duplicates.

--
Regards,
Martyn



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]