[tracker/wip/carlosg/batches-and-resources: 6/11] libtracker-data: Add blank node map argument to update parser




commit e9cfce3fa9645f835fbcde8601157ce69d09335f
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 26 12:03:52 2020 +0100

    libtracker-data: Add blank node map argument to update parser
    
    We may want to specify one externally at the time of executing it.

 src/libtracker-data/tracker-data-update.c | 2 +-
 src/libtracker-data/tracker-sparql.c      | 3 +++
 src/libtracker-data/tracker-sparql.h      | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 3ce1b7897..8bced383b 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2637,7 +2637,7 @@ update_sparql (TrackerData  *data,
        }
 
        sparql_query = tracker_sparql_new_update (data->manager, update);
-       blank_nodes = tracker_sparql_execute_update (sparql_query, blank, &actual_error);
+       blank_nodes = tracker_sparql_execute_update (sparql_query, blank, NULL, &actual_error);
        g_object_unref (sparql_query);
 
        if (actual_error) {
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 57432fd04..9f435702d 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -9569,6 +9569,7 @@ tracker_sparql_new_update (TrackerDataManager *manager,
 GVariant *
 tracker_sparql_execute_update (TrackerSparql  *sparql,
                                gboolean        blank,
+                               GHashTable     *bnode_map,
                                GError        **error)
 {
        TrackerSparqlState state = { 0 };
@@ -9584,6 +9585,8 @@ tracker_sparql_execute_update (TrackerSparql  *sparql,
 
        sparql->current_state = &state;
        sparql->current_state->node = tracker_node_tree_get_root (sparql->tree);
+       sparql->current_state->blank_node_map =
+               bnode_map ? g_hash_table_ref (bnode_map) : NULL;
        tracker_sparql_init_string_builder (sparql);
        retval = _call_rule_func (sparql, NAMED_RULE_Update, error);
        sparql->current_state = NULL;
diff --git a/src/libtracker-data/tracker-sparql.h b/src/libtracker-data/tracker-sparql.h
index 57651de1a..74297bd0a 100644
--- a/src/libtracker-data/tracker-sparql.h
+++ b/src/libtracker-data/tracker-sparql.h
@@ -40,9 +40,10 @@ TrackerSparqlCursor * tracker_sparql_execute_cursor (TrackerSparql  *sparql,
                                                      GError        **error);
 
 TrackerSparql * tracker_sparql_new_update (TrackerDataManager *manager,
-                                          const gchar        *query);
+                                           const gchar        *query);
 GVariant *      tracker_sparql_execute_update (TrackerSparql  *sparql,
                                               gboolean        blank,
+                                               GHashTable     *bnode_map,
                                               GError        **error);
 
 GBytes * tracker_sparql_make_langstring (const gchar *str,


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