Re: [Tracker] A question regarding to tracker search



Thanks a lot, I will try it out

-----Original Message-----
From: Martyn Russell [mailto:martyn lanedo com] 
Sent: Wednesday, March 17, 2010 4:27 PM
To: Zheng, Huan
Cc: tracker-list gnome org
Subject: Re: [Tracker] A question regarding to tracker search

On 17/03/10 02:09, Zheng, Huan wrote:
Hi,

Hi,

Is it possible for tracker to search like " SELECT ?p WHERE {?p a
nmm:MusicPiece . ?p nmm:performer [nmm:artistName 'T*']}"

Please note, I used T* inside artistName, I want to search songs that
their artist name start with T.

Or further more, artist name to fit for some other regular expression.

Yes, you can use:

tracker-sparql -q "select ?p nmm:artistName(?a) where { ?p a 
nmm:MusicPiece ; nmm:performer ?a  }"

However, you might want to refine this a little. Perhaps using:

tracker-sparql -q "select ?p nmm:artistName(?a) nie:title(?p) where { ?p 
a nmm:MusicPiece ; nmm:performer ?a  }"

That way you get the track name too.

For doing filters you can use either fn:starts-with as below:

tracker-sparql -q "select ?p nmm:artistName(?a) nie:title(?p) where { ?p 
a nmm:MusicPiece ; nmm:performer ?a . FILTER 
(fn:starts-with(nmm:artistName(?a), \"T\")) }"

Or a regex:

tracker-sparql -q "select ?p nmm:artistName(?a) nie:title(?p) where { ?p 
a nmm:MusicPiece ; nmm:performer ?a . FILTER regex(nmm:artistName(?a), 
\"jovi\", \"i\") }"

This would find all of bon jovi's hits for example.

Hope this helps.

-- 
Regards,
Martyn



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