[tracker/wal: 11/18] tracker-store: Use tracker_data_load_turtle_file
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wal: 11/18] tracker-store: Use tracker_data_load_turtle_file
- Date: Mon, 16 Aug 2010 12:13:52 +0000 (UTC)
commit cc9f7d956f0853be9240515a075c867d208d3b92
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 9915a38..86710a9 100644
--- a/src/tracker-store/tracker-store.c
+++ b/src/tracker-store/tracker-store.c
@@ -139,60 +139,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)
{
@@ -426,11 +372,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]