[gnome-photos/sam/tracker3: 14/27] Update queries




commit 30f3204f2a72ef2ef10c7d494d9683cc6dc493ea
Author: Sam Thursfield <sam afuera me uk>
Date:   Wed Jul 15 13:36:13 2020 +0200

    Update queries

 src/photos-query-builder.c                  | 2 +-
 src/queries/all.sparql.template             | 3 ++-
 src/queries/collections.sparql.template     | 4 +++-
 src/queries/favorite-photos.sparql.template | 3 ++-
 src/queries/photos.sparql.template          | 3 ++-
 5 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-query-builder.c b/src/photos-query-builder.c
index dcc365de..085278e0 100644
--- a/src/photos-query-builder.c
+++ b/src/photos-query-builder.c
@@ -70,7 +70,7 @@ photos_query_builder_query (PhotosSearchContextState *state,
                      "?focal_length ?isospeed ?flash ?location ";
 
   inner_projection = "?urn "
-                     "nie:isStoredAs (?urn) AS ?file "
+                     "?file "
                      "nfo:fileName (?file) AS ?filename "
                      "nie:mimeType (?urn) AS ?mimetype "
                      "nie:title (?urn) AS ?title "
diff --git a/src/queries/all.sparql.template b/src/queries/all.sparql.template
index ac3f1f04..1582a9b3 100644
--- a/src/queries/all.sparql.template
+++ b/src/queries/all.sparql.template
@@ -21,7 +21,8 @@ FROM NAMED tracker:Pictures
         {
             SERVICE <dbus:org.freedesktop.Tracker3.Miner.Files>
             {
-                ?urn a nmm:Photo .
+                ?urn a nmm:Photo ;
+                    nie:isStoredAs ?file .
                 OPTIONAL { ?urn nco:creator ?creator . }
                 OPTIONAL { ?urn nco:publisher ?publisher . }
                 {{item_pattern}}
diff --git a/src/queries/collections.sparql.template b/src/queries/collections.sparql.template
index 8aa8550b..dfd0ab9f 100644
--- a/src/queries/collections.sparql.template
+++ b/src/queries/collections.sparql.template
@@ -4,7 +4,9 @@ SELECT {{inner_projection}}
         SELECT ?urn COUNT(?item) AS ?count
         {
             ?urn a nfo:DataContainer.
-            ?item a nmm:Photo; nie:isPartOf ?urn.
+            ?item a nmm:Photo ;
+               nie:isPartOf ?urn ;
+               nie:isStoredAs ?file .
         } GROUP BY ?urn
     }
     FILTER (?count > 0 && {{collections_default_filter}} && {{search_filter}})
diff --git a/src/queries/favorite-photos.sparql.template b/src/queries/favorite-photos.sparql.template
index edfe6006..d0db90ae 100644
--- a/src/queries/favorite-photos.sparql.template
+++ b/src/queries/favorite-photos.sparql.template
@@ -7,7 +7,8 @@ FROM tracker:Pictures
     {
         SELECT {{inner_projection}}
         {
-            ?urn a nmm:Photo .
+            ?urn a nmm:Photo ;
+                nie:isStoredAs ?file .
             OPTIONAL { ?urn nco:creator ?creator . }
             OPTIONAL { ?urn nco:publisher ?publisher . }
             {{item_pattern}}
diff --git a/src/queries/photos.sparql.template b/src/queries/photos.sparql.template
index 75e4689a..843357ca 100644
--- a/src/queries/photos.sparql.template
+++ b/src/queries/photos.sparql.template
@@ -5,7 +5,8 @@ FROM tracker:Pictures
     {
         SELECT {{inner_projection}}
         {
-            ?urn a nmm:Photo .
+            ?urn a nmm:Photo ;
+                nie:isStoredAs ?file .
             OPTIONAL { ?urn nco:creator ?creator . }
             OPTIONAL { ?urn nco:publisher ?publisher . }
             {{item_pattern}}


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