diff options
author | Sam Thursfield <sam@afuera.me.uk> | 2020-06-02 12:26:16 +0200 |
---|---|---|
committer | Sam Thursfield <sam@afuera.me.uk> | 2020-06-02 12:38:19 +0200 |
commit | bb75f2d8f45b9d8247c97be025f18eb149f94cd5 (patch) | |
tree | 9c9a73c2c8a77accfc092c21e1dd40b991ce9a97 | |
parent | 134bb91611ba8ddc7c42104d218b136e281f2f60 (diff) | |
download | tracker-bb75f2d8f45b9d8247c97be025f18eb149f94cd5.tar.gz |
cli: tracker export: Hardcode some value types
We were outputting tag URIs formatted as strings rather than URIs.
The root cause here is that tracker_sparql_cursor_get_value_type()
doesn't reliably distingish URIs and strings for us. I worked around
this by querying from the schema, but the query doesn't work when
rdfs:range is rdf:Resource. Rather than complicate the query, I've
hardcoded the values here.
-rw-r--r-- | src/tracker/tracker-export.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/tracker/tracker-export.c b/src/tracker/tracker-export.c index 87947788f..96f3ae955 100644 --- a/src/tracker/tracker-export.c +++ b/src/tracker/tracker-export.c @@ -337,18 +337,17 @@ export_run_photo_favourites (void) const gchar *query; g_autoptr(GError) error = NULL; - query = "SELECT \"\" COALESCE(nie:url(?u), ?u) ?p ?v" - " (EXISTS { ?p rdfs:range [ rdfs:subClassOf rdfs:Resource ] }) AS ?is_resource " + query = "SELECT \"\" COALESCE(nie:url(?u), ?u) ?p ?v ?is_resource" "{" " { " - " SELECT ?u (rdf:type AS ?p) (nmm:Photo AS ?v) " + " SELECT ?u (rdf:type AS ?p) (nmm:Photo AS ?v) (true AS ?is_resource)" " { " " ?u a nmm:Photo ; nao:hasTag nao:predefined-tag-favorite . " " } " " } " " UNION " " { " - " SELECT ?u (nao:hasTag AS ?p) (nao:predefined-tag-favorite AS ?v) " + " SELECT ?u (nao:hasTag AS ?p) (nao:predefined-tag-favorite AS ?v) (true AS ?is_resource)" " { " " ?u a nmm:Photo ; nao:hasTag nao:predefined-tag-favorite . " " } " @@ -371,18 +370,17 @@ export_run_files_starred (void) const gchar *query; g_autoptr(GError) error = NULL; - query = "SELECT \"\" COALESCE(nie:url(?u), ?u) ?p ?v" - " (EXISTS { ?p rdfs:range [ rdfs:subClassOf rdfs:Resource ] }) AS ?is_resource " + query = "SELECT \"\" COALESCE(nie:url(?u), ?u) ?p ?v ?is_resource" "{" " { " - " SELECT ?u (rdf:type AS ?p) (nfo:FileDataObject AS ?v) " + " SELECT ?u (rdf:type AS ?p) (nfo:FileDataObject AS ?v) (true AS ?is_resource)" " { " " ?u a nfo:FileDataObject ; nao:hasTag <urn:gnome:nautilus:starred> " " } " " } " " UNION " " { " - " SELECT ?u (nao:hasTag AS ?p) (<urn:gnome:nautilus:starred> AS ?v) " + " SELECT ?u (nao:hasTag AS ?p) (<urn:gnome:nautilus:starred> AS ?v) (true AS ?is_resource)" " { " " ?u a nfo:FileDataObject ; nao:hasTag <urn:gnome:nautilus:starred> " " } " |