[tracker/wal: 10/11] tracker-store: Use tracker_data_load_turtle_file



commit dd1209589a6a40198641d1ae422ba549f0ab82df
Author: Jürg Billeter <j bitron ch>
Date:   Fri Jul 2 16:10:04 2010 +0200

    tracker-store: Use tracker_data_load_turtle_file

 src/tracker-store/tracker-store.c |   66 ++++--------------------------------
 1 files changed, 8 insertions(+), 58 deletions(-)
---
diff --git a/src/tracker-store/tracker-store.c b/src/tracker-store/tracker-store.c
index d203038..d233782 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -135,60 +135,6 @@ store_task_free (TrackerStoreTask *task)
 	g_slice_free (TrackerStoreTask, task);
 }
 
-static void
-process_turtle_file (TrackerTurtleReader *reader, GError **error)
-{
-	GError *new_error = NULL;
-
-	tracker_events_freeze ();
-
-	tracker_data_begin_transaction (&new_error);
-	if (new_error) {
-		g_propagate_error (error, new_error);
-		tracker_events_reset ();
-		return;
-	}
-
-	while (new_error == NULL && tracker_turtle_reader_next (reader, &new_error)) {
-		/* insert statement */
-		if (tracker_turtle_reader_get_object_is_uri (reader)) {
-			tracker_data_insert_statement_with_uri (
-			                                        tracker_turtle_reader_get_graph (reader),
-			                                        tracker_turtle_reader_get_subject (reader),
-			                                        tracker_turtle_reader_get_predicate (reader),
-			                                        tracker_turtle_reader_get_object (reader),
-			                                        &new_error);
-		} else {
-			tracker_data_insert_statement_with_string (
-			                                           tracker_turtle_reader_get_graph (reader),
-			                                           tracker_turtle_reader_get_subject (reader),
-			                                           tracker_turtle_reader_get_predicate (reader),
-			                                           tracker_turtle_reader_get_object (reader),
-			                                           &new_error);
-		}
-		if (!new_error) {
-			tracker_data_update_buffer_might_flush (&new_error);
-		}
-	}
-
-	if (new_error) {
-		tracker_data_rollback_transaction ();
-		g_propagate_error (error, new_error);
-		tracker_events_reset ();
-		return;
-	}
-
-	tracker_data_commit_transaction (&new_error);
-	if (new_error) {
-		tracker_data_rollback_transaction ();
-		g_propagate_error (error, new_error);
-		tracker_events_reset ();
-		return;
-	}
-
-	tracker_events_reset ();
-}
-
 static gboolean
 watchdog_cb (gpointer user_data)
 {
@@ -418,11 +364,15 @@ pool_dispatch_cb (gpointer data,
 	} else if (task->type == TRACKER_STORE_TASK_TYPE_UPDATE_BLANK) {
 		task->data.update.blank_nodes = tracker_data_update_sparql_blank (task->data.update.query, &task->error);
 	} else if (task->type == TRACKER_STORE_TASK_TYPE_TURTLE) {
-		TrackerTurtleReader *reader;
+		GFile *file;
+
+		file = g_file_new_for_path (task->data.turtle.path);
+
+		tracker_events_freeze ();
+		tracker_data_load_turtle_file (file, &task->error);
+		tracker_events_reset ();
 
-		reader = tracker_turtle_reader_new (task->data.turtle.path, &task->error);
-		process_turtle_file (reader, &task->error);
-		g_object_unref (reader);
+		g_object_unref (file);
 	}
 
 	g_idle_add (task_finish_cb, task);



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