[tracker-miners: 1/2] tracker-info: show informationElement resource
- From: Sam Thursfield <sthursfield src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners: 1/2] tracker-info: show informationElement resource
- Date: Mon, 3 May 2021 10:44:19 +0000 (UTC)
commit bea933bdc3e7636fe5233aeaf5e5c4eba2377719
Author: Nishit Patel <nishitlimbani130 gmail com>
Date: Thu Apr 29 22:26:05 2021 +0530
tracker-info: show informationElement resource
Show corresponding resource from informationElement graph when
passing URI in tracker info
src/tracker/tracker-info.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/src/tracker/tracker-info.c b/src/tracker/tracker-info.c
index f01f5d3b8..5ea83350c 100644
--- a/src/tracker/tracker-info.c
+++ b/src/tracker/tracker-info.c
@@ -314,7 +314,8 @@ print_turtle (gchar *urn,
while (tracker_sparql_cursor_next (cursor, NULL, NULL)) {
const gchar *key = tracker_sparql_cursor_get_string (cursor, 0, NULL);
const gchar *value = tracker_sparql_cursor_get_string (cursor, 1, NULL);
- const gchar *is_resource = tracker_sparql_cursor_get_string (cursor, 2, NULL);
+ const gchar *subject_value = tracker_sparql_cursor_get_string (cursor, 2, NULL);
+ const gchar *is_resource = tracker_sparql_cursor_get_string (cursor, 3, NULL);
if (!key || !value || !is_resource) {
continue;
@@ -340,6 +341,9 @@ print_turtle (gchar *urn,
g_free (escaped_value);
}
+ if (subject_value)
+ subject = g_strdup (subject_value);
+
/* Print final statement */
g_print ("<%s> %s %s .\n", subject, predicate, object);
@@ -465,12 +469,17 @@ info_run (void)
g_object_unref (cursor);
}
- query = g_strdup_printf ("SELECT ?predicate ?object"
+ query = g_strdup_printf ("SELECT DISTINCT ?predicate ?object ?x"
" ( EXISTS { ?predicate rdfs:range [ rdfs:subClassOf rdfs:Resource
] } )"
"WHERE {"
- " <%s> ?predicate ?object "
+ " { <%s> ?predicate ?object . } "
+ " UNION "
+ " { <%s> nie:interpretedAs ?x . "
+ " ?x ?predicate ?object . "
+ " } "
"}",
- urn);
+ urn,
+ urn);
cursor = tracker_sparql_connection_query (connection, query, NULL, &error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]