[gnome-music/wip/mschraal/sparql-property-path: 5/6] query: Start using SPARQL property paths
- From: Marinus Schraal <mschraal src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-music/wip/mschraal/sparql-property-path: 5/6] query: Start using SPARQL property paths
- Date: Mon, 27 May 2019 11:08:16 +0000 (UTC)
commit d28b66712b159dcd66f40681555080b2a79895ee
Author: Marinus Schraal <mschraal gnome org>
Date: Sat May 4 22:31:26 2019 +0200
query: Start using SPARQL property paths
Bump the tracker dependency to 2.2.0 for property path support.
gnomemusic/query.py | 22 +++++++---------------
meson.build | 2 +-
2 files changed, 8 insertions(+), 16 deletions(-)
---
diff --git a/gnomemusic/query.py b/gnomemusic/query.py
index cf254641..becad151 100644
--- a/gnomemusic/query.py
+++ b/gnomemusic/query.py
@@ -558,9 +558,7 @@ class Query():
?playlist
a nmm:Playlist ;
a nfo:MediaList ;
- nfo:hasMediaFileListEntry ?removed_entry .
- ?removed_entry
- nfo:listPosition ?removed_position .
+ nfo:hasMediaFileListEntry/nfo:listPosition ?removed_position .
FILTER (
tracker:id(?playlist) = %(playlist_id)s &&
tracker:id(?removed_entry) = %(song_id)s
@@ -648,8 +646,7 @@ class Query():
query = """
?playlist
a nmm:Playlist ;
- nao:hasTag ?tag .
- ?tag rdfs:comment ?tag_text .
+ nao:hasTag/rdfs:comment ?tag_text .
FILTER ( ?tag_text = '%(playlist_tag)s' )
""".replace('\n', ' ').strip() % {'playlist_tag': playlist_tag}
@@ -713,8 +710,7 @@ class Query():
WHERE {
?song a nmm:MusicPiece ;
nie:usageCounter ?count ;
- nie:isStoredAs ?as .
- ?as nie:url ?url .
+ nie:isStoredAs/nie:url ?url .
FILTER ( STRSTARTS(?url, '%(music_dir)s') )
} ORDER BY DESC(?count) LIMIT 50
""".replace('\n', ' ').strip() % {
@@ -729,8 +725,7 @@ class Query():
SELECT ?url
WHERE {
?song a nmm:MusicPiece ;
- nie:isStoredAs ?as .
- ?as nie:url ?url .
+ nie:isStoredAs/nie:url ?url .
FILTER ( NOT EXISTS { ?song nie:usageCounter ?count .}
&& STRSTARTS(?url, '%(music_dir)s') )
} ORDER BY nfo:fileLastAccessed(?song) LIMIT 50
@@ -754,9 +749,8 @@ class Query():
SELECT ?url
WHERE {
?song a nmm:MusicPiece ;
- nie:isStoredAs ?as ;
+ nie:isStoredAs/nie:url ?url ;
nie:contentAccessed ?last_played .
- ?as nie:url ?url .
FILTER ( ?last_played > '%(compare_date)s'^^xsd:dateTime
&& EXISTS { ?song nie:usageCounter ?count .}
&& STRSTARTS(?url, '%(music_dir)s') )
@@ -783,9 +777,8 @@ class Query():
SELECT ?url
WHERE {
?song a nmm:MusicPiece ;
- nie:isStoredAs ?as ;
+ nie:isStoredAs/nie:url ?url ;
tracker:added ?added .
- ?as nie:url ?url .
FILTER ( ?added > '%(compare_date)s'^^xsd:dateTime
&& STRSTARTS(?url, '%(music_dir)s') )
} ORDER BY DESC(?added) LIMIT 50
@@ -802,9 +795,8 @@ class Query():
SELECT ?url
WHERE {
?song a nmm:MusicPiece ;
- nie:isStoredAs ?as ;
+ nie:isStoredAs/nie:url ?url ;
nao:hasTag nao:predefined-tag-favorite .
- ?as nie:url ?url .
FILTER ( STRSTARTS(?url, '%(music_dir)s') )
} ORDER BY DESC(tracker:added(?song))
""".replace('\n', ' ').strip() % {
diff --git a/meson.build b/meson.build
index 223fb234..c139aa88 100644
--- a/meson.build
+++ b/meson.build
@@ -42,7 +42,7 @@ dependency('gtk+-3.0', version: '>= 3.23.1')
dependency('libdazzle-1.0', version: '>= 3.28.0')
dependency('libmediaart-2.0', version: '>= 1.9.1')
dependency('libsoup-2.4')
-dependency('tracker-sparql-2.0', version: '>= 1.99.1')
+dependency('tracker-sparql-2.0', version: '>= 2.2.0')
dependency('pygobject-3.0', version: '>= 3.29.1')
dependency('py3cairo', version: '>= 1.14.0')
dependency('grilo-0.3', version: '>= 0.3.4')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]