[tracker/wip/carlosg/expand-resource-uri] libtracker-sparql: Expand TrackerResource URIs before insertion




commit bfcaffba8f768522f76495ba4fff3ac7030b50e7
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jul 14 20:53:28 2022 +0200

    libtracker-sparql: Expand TrackerResource URIs before insertion
    
    When using the APIs to insert TrackerResources into the database, the
    resources might be identified through a compressed URI. We do only store
    expanded URIs, so these compressed URIs should be expanded according to
    the available prefixes.

 src/libtracker-sparql/core/tracker-data-update.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-sparql/core/tracker-data-update.c 
b/src/libtracker-sparql/core/tracker-data-update.c
index 10abd777d..f4c857cd3 100644
--- a/src/libtracker-sparql/core/tracker-data-update.c
+++ b/src/libtracker-sparql/core/tracker-data-update.c
@@ -3254,7 +3254,13 @@ update_resource_single (TrackerData      *data,
                if (!subject)
                        return FALSE;
        } else {
-               subject = tracker_data_update_ensure_resource (data, subject_str, error);
+               gchar *subject_uri;
+
+               tracker_data_manager_expand_prefix (data->manager,
+                                                   subject_str, NULL, NULL,
+                                                   &subject_uri);
+               subject = tracker_data_update_ensure_resource (data, subject_uri, error);
+               g_free (subject_uri);
                if (subject == 0)
                        return FALSE;
        }


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