[tracker/wip/carlosg/serialize-api: 7/11] libtracker-data: Provide graph information at describe queries
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/serialize-api: 7/11] libtracker-data: Provide graph information at describe queries
- Date: Mon, 22 Nov 2021 11:57:41 +0000 (UTC)
commit 57bbf47e0c582754af825869cbdba929b30d2171
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Nov 21 16:03:37 2021 +0100
libtracker-data: Provide graph information at describe queries
And ensure ordering by first subject then graph, so information for a
single resource from multiple graphs is clustered together. Since
the cursor format and output changed, update the tests that expect a
specific DESCRIBE output.
src/libtracker-data/tracker-sparql.c | 5 ++-
tests/libtracker-data/describe/describe-limit.out | 22 +++++------
.../libtracker-data/describe/describe-multiple.out | 44 +++++++++++-----------
.../libtracker-data/describe/describe-pattern.out | 12 +++---
tests/libtracker-data/describe/describe-single.out | 10 ++---
5 files changed, 47 insertions(+), 46 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index b7112a940..bd06d52b6 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -3242,7 +3242,8 @@ translate_DescribeQuery (TrackerSparql *sparql,
"SELECT "
" (SELECT Uri FROM Resource WHERE ID = subject),"
" (SELECT Uri FROM Resource WHERE ID = predicate),"
- " object "
+ " object, "
+ " (SELECT Uri FROM Resource WHERE ID = graph) "
"FROM tracker_triples ");
if (sparql->policy.graphs) {
@@ -3353,7 +3354,7 @@ translate_DescribeQuery (TrackerSparql *sparql,
}
_call_rule (sparql, NAMED_RULE_SolutionModifier, error);
- _append_string (sparql, ") ");
+ _append_string (sparql, ") ORDER BY subject, graph, predicate");
g_list_free_full (resources, g_object_unref);
g_clear_pointer (&where_str, tracker_string_builder_free);
diff --git a/tests/libtracker-data/describe/describe-limit.out
b/tests/libtracker-data/describe/describe-limit.out
index e983c2b48..a77017ea4 100644
--- a/tests/libtracker-data/describe/describe-limit.out
+++ b/tests/libtracker-data/describe/describe-limit.out
@@ -1,11 +1,11 @@
-"a" "http://example/number" "42"
-"a" "http://example/date" "2000-01-01T00:00:01Z"
-"a" "http://example/name" "nameA"
-"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
-"b" "http://example/relation" "z"
-"b" "http://example/number" "73"
-"b" "http://example/date" "2001-01-01T00:00:01Z"
-"b" "http://example/name" "nameB"
-"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"a" "http://example/name" "nameA"
+"a" "http://example/date" "2000-01-01T00:00:01Z"
+"a" "http://example/number" "42"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"b" "http://example/name" "nameB"
+"b" "http://example/date" "2001-01-01T00:00:01Z"
+"b" "http://example/number" "73"
+"b" "http://example/relation" "z"
diff --git a/tests/libtracker-data/describe/describe-multiple.out
b/tests/libtracker-data/describe/describe-multiple.out
index 034058637..634eef00d 100644
--- a/tests/libtracker-data/describe/describe-multiple.out
+++ b/tests/libtracker-data/describe/describe-multiple.out
@@ -1,22 +1,22 @@
-"b" "http://example/relation" "z"
-"b" "http://example/number" "73"
-"b" "http://example/date" "2001-01-01T00:00:01Z"
-"b" "http://example/name" "nameB"
-"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
-"z" "http://example/title" "titleZ"
-"z" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"z" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/B"
-"c" "http://example/relation" "x"
-"c" "http://example/number" "113"
-"c" "http://example/name" "nameC"
-"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
-"x" "http://example/title" "titleX"
-"x" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"x" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/B"
-"d" "http://example/relation" "z"
-"d" "http://example/date" "2002-01-01T00:00:01Z"
-"d" "http://example/name" "nameD"
-"d" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"d" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"b" "http://example/name" "nameB"
+"b" "http://example/date" "2001-01-01T00:00:01Z"
+"b" "http://example/number" "73"
+"b" "http://example/relation" "z"
+"z" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"z" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/B"
+"z" "http://example/title" "titleZ"
+"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"c" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"c" "http://example/name" "nameC"
+"c" "http://example/number" "113"
+"c" "http://example/relation" "x"
+"x" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"x" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/B"
+"x" "http://example/title" "titleX"
+"d" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"d" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"d" "http://example/name" "nameD"
+"d" "http://example/date" "2002-01-01T00:00:01Z"
+"d" "http://example/relation" "z"
diff --git a/tests/libtracker-data/describe/describe-pattern.out
b/tests/libtracker-data/describe/describe-pattern.out
index e512b1d8c..c29e73905 100644
--- a/tests/libtracker-data/describe/describe-pattern.out
+++ b/tests/libtracker-data/describe/describe-pattern.out
@@ -1,6 +1,6 @@
-"b" "http://example/relation" "z"
-"b" "http://example/number" "73"
-"b" "http://example/date" "2001-01-01T00:00:01Z"
-"b" "http://example/name" "nameB"
-"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"b" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"b" "http://example/name" "nameB"
+"b" "http://example/date" "2001-01-01T00:00:01Z"
+"b" "http://example/number" "73"
+"b" "http://example/relation" "z"
diff --git a/tests/libtracker-data/describe/describe-single.out
b/tests/libtracker-data/describe/describe-single.out
index 0bb548ba0..a0fd4df49 100644
--- a/tests/libtracker-data/describe/describe-single.out
+++ b/tests/libtracker-data/describe/describe-single.out
@@ -1,5 +1,5 @@
-"a" "http://example/number" "42"
-"a" "http://example/date" "2000-01-01T00:00:01Z"
-"a" "http://example/name" "nameA"
-"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
-"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
"http://www.w3.org/2000/01/rdf-schema#Resource"
+"a" "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" "http://example/A"
+"a" "http://example/name" "nameA"
+"a" "http://example/date" "2000-01-01T00:00:01Z"
+"a" "http://example/number" "42"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]