[tracker/class-signal] libtracker-miner: Fixed GRAPH in IgnoreNextUpdate case



commit 875ff38fad312180138f265d0288bd8c10f3b652
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Aug 27 11:02:37 2010 +0200

    libtracker-miner: Fixed GRAPH in IgnoreNextUpdate case

 src/libtracker-miner/tracker-miner-fs.c |   17 +++++++++--------
 src/tracker-store/tracker-resources.c   |    4 ++--
 src/tracker-store/tracker-writeback.c   |   13 +++++++++----
 3 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-fs.c b/src/libtracker-miner/tracker-miner-fs.c
index da5cadc..9b92022 100644
--- a/src/libtracker-miner/tracker-miner-fs.c
+++ b/src/libtracker-miner/tracker-miner-fs.c
@@ -1494,8 +1494,8 @@ item_add_or_update_cb (TrackerMinerFS *fs,
 
 			/* update, delete all statements inserted by miner
 			   except for rdf:type statements as they could cause implicit deletion of user data */
-			full_sparql = g_strdup_printf ("DELETE { <%s> ?p ?o } WHERE { GRAPH <%s> { <%s> ?p ?o FILTER (?p != rdf:type) } } %s",
-			                               data->urn, TRACKER_MINER_FS_GRAPH_URN,
+			full_sparql = g_strdup_printf ("DELETE { GRAPH <%s> { <%s> ?p ?o } } WHERE { GRAPH <%s> { <%s> ?p ?o FILTER (?p != rdf:type) } } %s",
+			                               TRACKER_MINER_FS_GRAPH_URN, data->urn, TRACKER_MINER_FS_GRAPH_URN,
 			                               data->urn, tracker_sparql_builder_get_result (data->builder));
 		} else {
 			g_debug ("Creating new item '%s'", uri);
@@ -1710,19 +1710,20 @@ item_ignore_next_update (TrackerMinerFS *fs,
 		/* Perhaps we should move the DELETE to tracker-miner-files.c?
 		 * Or we add support for DELETE to TrackerSparqlBuilder ofcrs */
 
-		query = g_strdup_printf ("DELETE { "
+		query = g_strdup_printf ("DELETE { GRAPH <%s> { "
 		                         "  ?u nfo:fileSize ?unknown1 ; "
 		                         "     nfo:fileLastModified ?unknown2 ; "
 		                         "     nfo:fileLastAccessed ?unknown3 ; "
-		                         "     nie:mimeType ?unknown4 "
-		                         "} WHERE { "
+		                         "     nie:mimeType ?unknown4 } "
+		                         "} WHERE { GRAPH <%s> { "
 		                         "  ?u nfo:fileSize ?unknown1 ; "
 		                         "     nfo:fileLastModified ?unknown2 ; "
 		                         "     nfo:fileLastAccessed ?unknown3 ; "
 		                         "     nie:mimeType ?unknown4 ; "
-		                         "     nie:url \"%s\" "
-		                         "} %s",
-		                         uri, tracker_sparql_builder_get_result (sparql));
+		                         "     nie:url \"%s\" } "
+		                         "} %s", TRACKER_MINER_FS_GRAPH_URN,
+		                         TRACKER_MINER_FS_GRAPH_URN, uri,
+		                         tracker_sparql_builder_get_result (sparql));
 
 		tracker_sparql_connection_update_async (tracker_miner_get_connection (TRACKER_MINER (fs)),
                                                         query, 
diff --git a/src/tracker-store/tracker-resources.c b/src/tracker-store/tracker-resources.c
index 87a712f..e7eb4a3 100644
--- a/src/tracker-store/tracker-resources.c
+++ b/src/tracker-store/tracker-resources.c
@@ -731,8 +731,8 @@ on_statement_deleted (gint         graph_id,
 {
 	tracker_events_add_delete (graph_id, subject_id, subject, pred_id,
 	                           object_id, object, rdf_types);
-//	tracker_writeback_check (graph_id, graph, subject_id, subject, pred_id,
-//	                         object_id, object, rdf_types);
+	tracker_writeback_check (graph_id, graph, subject_id, subject, pred_id,
+	                         object_id, object, rdf_types);
 	check_class_signal_signal (user_data);
 }
 
diff --git a/src/tracker-store/tracker-writeback.c b/src/tracker-store/tracker-writeback.c
index f0bb8bb..846da1e 100644
--- a/src/tracker-store/tracker-writeback.c
+++ b/src/tracker-store/tracker-writeback.c
@@ -79,10 +79,7 @@ tracker_writeback_check (gint         graph_id,
 	g_return_if_fail (private != NULL);
 
 	if (g_hash_table_lookup (private->allowances, GINT_TO_POINTER (pred_id))) {
-		if (!private->ready_events || !private->pending_events) {
-			private->ready_events = g_hash_table_new_full (g_direct_hash, g_direct_equal,
-			                                               (GDestroyNotify) NULL,
-			                                               (GDestroyNotify) array_free);
+		if (!private->pending_events) {
 			private->pending_events = g_hash_table_new_full (g_direct_hash, g_direct_equal,
 			                                                 (GDestroyNotify) NULL,
 			                                                 (GDestroyNotify) NULL);
@@ -99,6 +96,8 @@ tracker_writeback_reset (void)
 {
 	g_return_if_fail (private != NULL);
 
+	// Incorrect atm
+
 	if (private->pending_events && private->ready_events) {
 		GHashTableIter iter;
 		gpointer key, value;
@@ -191,6 +190,12 @@ tracker_writeback_transact (void)
 
 	g_hash_table_iter_init (&iter, private->pending_events);
 
+	if (!private->ready_events) {
+		private->ready_events = g_hash_table_new_full (g_direct_hash, g_direct_equal,
+		                                               (GDestroyNotify) NULL,
+		                                               (GDestroyNotify) array_free);
+	}
+
 	while (g_hash_table_iter_next (&iter, &key, &value)) {
 		g_hash_table_insert (private->ready_events, key, value);
 		g_hash_table_iter_remove (&iter);



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