[tracker/wip/carlosg/update-perf: 27/43] core: Avoid expanding property names for lookups




commit 1da6af0b4da62c335b17781368f18b50e8bf0c57
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 18 23:19:05 2022 +0200

    core: Avoid expanding property names for lookups
    
    We can no look up properties in either short or long URI form, so
    the URI expansion can be avoided here.

 src/libtracker-sparql/core/tracker-data-update.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c 
b/src/libtracker-sparql/core/tracker-data-update.c
index 8d1131b77..f98a4409f 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -3340,22 +3340,17 @@ update_resource_property (TrackerData      *data,
        TrackerOntologies *ontologies;
        TrackerProperty *predicate;
        GList *values, *v;
-       gchar *property_uri;
        GError *inner_error = NULL;
 
        values = tracker_resource_get_values (resource, property);
-       tracker_data_manager_expand_prefix (data->manager,
-                                           property,
-                                           NULL, NULL,
-                                           &property_uri);
 
        ontologies = tracker_data_manager_get_ontologies (data->manager);
-       predicate = tracker_ontologies_get_property_by_uri (ontologies, property_uri);
+       predicate = tracker_ontologies_get_property_by_uri (ontologies, property);
        if (predicate == NULL) {
                g_set_error (error, TRACKER_SPARQL_ERROR,
                             TRACKER_SPARQL_ERROR_UNKNOWN_PROPERTY,
                             "Property '%s' not found in the ontology",
-                            property_uri);
+                            property);
                return FALSE;
        }
 
@@ -3418,7 +3413,6 @@ update_resource_property (TrackerData      *data,
        }
 
        g_list_free (values);
-       g_free (property_uri);
 
        if (inner_error) {
                g_propagate_error (error, inner_error);
@@ -3492,23 +3486,13 @@ update_resource_single (TrackerData      *data,
                        const gchar *property = l->data;
 
                        if (tracker_resource_get_property_overwrite (resource, property)) {
-                               gchar *property_uri;
-
-                               tracker_data_manager_expand_prefix (data->manager,
-                                                                   property,
-                                                                   NULL, NULL,
-                                                                   &property_uri);
-
                                if (resource_maybe_reset_property (data, graph_uri, resource,
-                                                                  subject, property_uri,
+                                                                  subject, property,
                                                                   bnodes, &inner_error)) {
                                        need_flush = TRUE;
                                } else if (inner_error) {
-                                       g_free (property_uri);
                                        goto out;
                                }
-
-                               g_free (property_uri);
                        }
                }
 


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