[tracker/wip/carlosg/update-perf: 57/72] core: Shuffle graph URI expansion
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/update-perf: 57/72] core: Shuffle graph URI expansion
- Date: Tue, 30 Aug 2022 15:39:42 +0000 (UTC)
commit 25db39f3b9998a6dc52c88f2ec78dbc01207e3d0
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Aug 18 23:26:48 2022 +0200
core: Shuffle graph URI expansion
Since the function it is being expanded from can be called
recursively, on deeper iterations it would pointessly try to
expand the URI again.
Do it from the toplevel function, so it's done once for the
whole TrackerResource update.
src/libtracker-sparql/core/tracker-data-update.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c
b/src/libtracker-sparql/core/tracker-data-update.c
index f98a4409f..b3cfeb5e7 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -3424,7 +3424,7 @@ update_resource_property (TrackerData *data,
static gboolean
update_resource_single (TrackerData *data,
- const gchar *graph,
+ const gchar *graph_uri,
TrackerResource *resource,
GHashTable *visited,
GHashTable *bnodes,
@@ -3435,7 +3435,6 @@ update_resource_single (TrackerData *data,
GError *inner_error = NULL;
const gchar *subject_str;
TrackerRowid subject;
- gchar *graph_uri = NULL;
gboolean is_bnode = FALSE;
if (tracker_resource_is_blank_node (resource)) {
@@ -3463,12 +3462,6 @@ update_resource_single (TrackerData *data,
properties = tracker_resource_get_properties (resource);
- if (graph) {
- tracker_data_manager_expand_prefix (data->manager,
- graph, NULL, NULL,
- &graph_uri);
- }
-
/* Handle rdf:type first */
if (g_list_find_custom (properties, "rdf:type", (GCompareFunc) g_strcmp0)) {
update_resource_property (data, graph_uri, resource,
@@ -3516,7 +3509,6 @@ update_resource_single (TrackerData *data,
out:
g_list_free (properties);
- g_free (graph_uri);
if (inner_error) {
g_propagate_error (error, inner_error);
@@ -3538,15 +3530,23 @@ tracker_data_update_resource (TrackerData *data,
GError **error)
{
gboolean retval;
+ gchar *graph_uri = NULL;
if (bnodes)
g_hash_table_ref (bnodes);
else
bnodes = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)
tracker_rowid_free);
- retval = update_resource_single (data, graph, resource, visited, bnodes, NULL, error);
+ if (graph) {
+ tracker_data_manager_expand_prefix (data->manager,
+ graph, NULL, NULL,
+ &graph_uri);
+ }
+
+ retval = update_resource_single (data, graph_uri, resource, visited, bnodes, NULL, error);
g_hash_table_unref (bnodes);
+ g_free (graph_uri);
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]