[tracker/wip/carlosg/serialize-api: 22/36] 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: 22/36] libtracker-data: Provide graph information at describe queries
- Date: Mon, 10 Jan 2022 10:58:35 +0000 (UTC)
commit 1e41a827641a1c35c7984f75236baa1cc8e742e1
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 | 3 +-
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, 46 insertions(+), 45 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index da0ae27d0..e3c0694df 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -3369,7 +3369,8 @@ translate_DescribeQuery (TrackerSparql *sparql,
"SELECT "
" COALESCE((SELECT Uri FROM Resource WHERE ID = subject), 'urn:bnode:' || subject),"
" (SELECT Uri FROM Resource WHERE ID = predicate),"
- " object "
+ " object, "
+ " (SELECT Uri FROM Resource WHERE ID = graph) "
"FROM tracker_triples ");
if (sparql->policy.graphs) {
diff --git a/tests/libtracker-data/describe/describe-limit.out
b/tests/libtracker-data/describe/describe-limit.out
index e983c2b48..b536c99e2 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"
+"b" "http://example/relation" "z"
+"a" "http://example/number" "42"
+"b" "http://example/number" "73"
+"a" "http://example/date" "2000-01-01T00:00:01Z"
+"b" "http://example/date" "2001-01-01T00:00:01Z"
+"a" "http://example/name" "nameA"
+"b" "http://example/name" "nameB"
+"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://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"
diff --git a/tests/libtracker-data/describe/describe-multiple.out
b/tests/libtracker-data/describe/describe-multiple.out
index 034058637..8edc0fd45 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://example/relation" "z"
+"c" "http://example/relation" "x"
+"d" "http://example/relation" "z"
+"z" "http://example/title" "titleZ"
+"x" "http://example/title" "titleX"
+"b" "http://example/number" "73"
+"c" "http://example/number" "113"
+"b" "http://example/date" "2001-01-01T00:00:01Z"
+"d" "http://example/date" "2002-01-01T00:00:01Z"
+"b" "http://example/name" "nameB"
+"c" "http://example/name" "nameC"
+"d" "http://example/name" "nameD"
+"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"
+"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"
+"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"
+"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"
+"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"
diff --git a/tests/libtracker-data/describe/describe-pattern.out
b/tests/libtracker-data/describe/describe-pattern.out
index e512b1d8c..84d8d9520 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://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"
diff --git a/tests/libtracker-data/describe/describe-single.out
b/tests/libtracker-data/describe/describe-single.out
index 0bb548ba0..b896021ee 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://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"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]