[gnome-photos/wip/rishi/tracker3: 7/7] query: ...




commit 75790bb98a3f51eb4473ba7b1bcb6eb0d42572f5
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Mar 8 22:50:34 2021 +0100

    query: ...

 src/photos-query-collections.sparql.template | 23 ++++++++++++++---------
 src/photos-query-favorites.sparql.template   | 19 ++++++++++++++-----
 src/photos-query-photos.sparql.template      | 20 ++++++++++++++------
 3 files changed, 42 insertions(+), 20 deletions(-)
---
diff --git a/src/photos-query-collections.sparql.template b/src/photos-query-collections.sparql.template
index 26a5a2f8..4869d7d9 100644
--- a/src/photos-query-collections.sparql.template
+++ b/src/photos-query-collections.sparql.template
@@ -15,20 +15,25 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-SELECT {{projection}}
+SELECT {{final_projection}}
 {
+    SELECT {{main_projection}}
     {
-        SELECT ?urn COUNT(?item) AS ?count
         {
-            ?urn a nfo:DataContainer.
-            ?item a nmm:Photo; nie:isPartOf ?urn.
-            {{item_where}}
+            SELECT ?urn COUNT(?item) AS ?count
+            {
+                {{values}}
+                VALUES (?file ?filename) { ("" "") }
+                ?urn a nfo:DataContainer .
+                ?item a nmm:Photo ; nie:isPartOf ?urn .
+                {{item_where}}
+            }
+            GROUP BY ?urn
         }
-        GROUP BY (?urn)
+        OPTIONAL { ?urn nco:creator ?creator . }
+        OPTIONAL { ?urn nco:publisher ?publisher . }
+        FILTER (?count > 0 && {{collections_default_filter}} && {{search_filter}})
     }
-    OPTIONAL { ?urn nco:creator ?creator . }
-    OPTIONAL { ?urn nco:publisher ?publisher . }
-    FILTER (?count > 0 && {{collections_filter}} && {{search_match_filter}} && {{source_filter}})
 }
 {{order}}
 {{offset_limit}}
diff --git a/src/photos-query-favorites.sparql.template b/src/photos-query-favorites.sparql.template
index 430e5690..ad1d9d2f 100644
--- a/src/photos-query-favorites.sparql.template
+++ b/src/photos-query-favorites.sparql.template
@@ -15,13 +15,22 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-SELECT {{projection}}
+SELECT {{final_projection}}
+FROM tracker:Pictures
 {
     ?urn a nmm:Photo; nao:hasTag nao:predefined-tag-favorite .
-    OPTIONAL { ?urn nco:creator ?creator . }
-    OPTIONAL { ?urn nco:publisher ?publisher . }
-    {{item_where}}
-    FILTER ({{blocked_mime_types_filter}} && {{search_match_filter}} && {{source_filter}})
+    SERVICE <dbus:{{miner_files_name}}>
+    {
+        SELECT {{dbus_projection}}
+        {
+            {{values}}
+            ?urn a nmm:Photo ; nie:isStoredAs ?file .
+            OPTIONAL { ?urn nco:creator ?creator . }
+            OPTIONAL { ?urn nco:publisher ?publisher . }
+            {{item_where}}
+            FILTER ({{blocked_mime_types_filter}} && {{search_match_filter}} && {{source_filter}})
+        }
+    }
 }
 {{order}}
 {{offset_limit}}
diff --git a/src/photos-query-photos.sparql.template b/src/photos-query-photos.sparql.template
index aad7cb92..03905a7a 100644
--- a/src/photos-query-photos.sparql.template
+++ b/src/photos-query-photos.sparql.template
@@ -15,13 +15,21 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-SELECT {{projection}}
+SELECT {{final_projection}}
+FROM tracker:Pictures
 {
-    ?urn a nmm:Photo .
-    OPTIONAL { ?urn nco:creator ?creator . }
-    OPTIONAL { ?urn nco:publisher ?publisher . }
-    {{item_where}}
-    FILTER ({{blocked_mime_types_filter}} && {{search_match_filter}} && {{source_filter}})
+    SERVICE <dbus:{{miner_files_name}}>
+    {
+        SELECT {{dbus_projection}}
+        {
+            {{values}}
+            ?urn a nmm:Photo ; nie:isStoredAs ?file .
+            OPTIONAL { ?urn nco:creator ?creator . }
+            OPTIONAL { ?urn nco:publisher ?publisher . }
+            {{item_where}}
+            FILTER ({{blocked_mime_types_filter}} && {{search_match_filter}} && {{source_filter}})
+        }
+    }
 }
 {{order}}
 {{offset_limit}}


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