[tracker/wip/carlosg/data-update-cleanups: 7/11] libtracker-data: Find out URI-ness through property in ontology updates



commit 6501a97a1ee5ff495d1d35af77299e801d7277de
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sat Apr 25 21:16:40 2020 +0200

    libtracker-data: Find out URI-ness through property in ontology updates
    
    It seems we can rely better on our own ontology definition, than the
    RDF we are being fed. Also makes it unnecessary to expose some
    tracker-data-update.c guts.

 src/libtracker-data/tracker-data-manager.c | 18 ++++--------------
 src/libtracker-data/tracker-data-update.c  | 14 ++++++++++++++
 src/libtracker-data/tracker-data-update.h  | 14 --------------
 3 files changed, 18 insertions(+), 28 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index 997eeafd4..25a3e65a3 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -1910,7 +1910,6 @@ tracker_data_ontology_process_statement (TrackerDataManager *manager,
                                          const gchar        *subject,
                                          const gchar        *predicate,
                                          const gchar        *object,
-                                         gboolean            is_uri,
                                          gboolean            in_update)
 {
        GError *error = NULL;
@@ -1991,16 +1990,9 @@ tracker_data_ontology_process_statement (TrackerDataManager *manager,
 
        bytes = g_bytes_new (object, strlen (object) + 1);
 
-       if (is_uri) {
-               tracker_data_insert_statement_with_uri (manager->data_update, NULL, subject,
-                                                       predicate, bytes,
-                                                       &error);
-       } else {
-               tracker_data_insert_statement_with_string (manager->data_update, NULL, subject,
-                                                          predicate, bytes,
-                                                          &error);
-       }
-
+       tracker_data_insert_statement (manager->data_update, NULL, subject,
+                                      predicate, bytes,
+                                      &error);
        g_bytes_unref (bytes);
 
        if (error != NULL) {
@@ -2016,7 +2008,6 @@ import_ontology_file (TrackerDataManager *manager,
                       gboolean            in_update)
 {
        const gchar *subject, *predicate, *object;
-       gboolean object_is_uri;
        GError *error = NULL;
        TrackerTurtleReader* reader;
 
@@ -2030,10 +2021,9 @@ import_ontology_file (TrackerDataManager *manager,
 
        while (tracker_turtle_reader_next (reader,
                                           &subject, &predicate, &object,
-                                          &object_is_uri, &error)) {
+                                          NULL, &error)) {
                tracker_data_ontology_process_statement (manager,
                                                         subject, predicate, object,
-                                                        object_is_uri,
                                                         in_update);
        }
 
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index a96ea1978..b44aa2579 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -166,6 +166,20 @@ static gboolean     resource_buffer_switch     (TrackerData  *data,
                                                 gint          subject_id,
                                                 GError      **error);
 
+void tracker_data_insert_statement_with_uri    (TrackerData  *data,
+                                                const gchar  *graph,
+                                                const gchar  *subject,
+                                                const gchar  *predicate,
+                                                GBytes       *object,
+                                                GError      **error);
+void tracker_data_insert_statement_with_string (TrackerData  *data,
+                                                const gchar  *graph,
+                                                const gchar  *subject,
+                                                const gchar  *predicate,
+                                                GBytes       *object,
+                                                GError      **error);
+
+
 void
 tracker_data_add_commit_statement_callback (TrackerData             *data,
                                             TrackerCommitCallback    callback,
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index a7f60eaa5..17c315fe5 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -76,18 +76,6 @@ void     tracker_data_insert_statement              (TrackerData               *
                                                      const gchar               *predicate,
                                                      GBytes                    *object,
                                                      GError                   **error);
-void     tracker_data_insert_statement_with_uri     (TrackerData               *data,
-                                                     const gchar               *graph,
-                                                     const gchar               *subject,
-                                                     const gchar               *predicate,
-                                                     GBytes                    *object,
-                                                     GError                   **error);
-void     tracker_data_insert_statement_with_string  (TrackerData               *data,
-                                                     const gchar               *graph,
-                                                     const gchar               *subject,
-                                                     const gchar               *predicate,
-                                                     GBytes                    *object,
-                                                     GError                   **error);
 void     tracker_data_update_statement              (TrackerData               *data,
                                                      const gchar               *graph,
                                                      const gchar               *subject,
@@ -117,8 +105,6 @@ void     tracker_data_load_turtle_file              (TrackerData               *
                                                      const gchar               *graph,
                                                      GError                   **error);
 
-void     tracker_data_sync                          (TrackerData               *data);
-
 gint     tracker_data_ensure_graph                  (TrackerData               *data,
                                                      const gchar               *name,
                                                      GError                   **error);


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