[tracker/journal: 11/21] squashme with INSERT_STATEMENT_ID one



commit d99c894a939e3219542bf27c55724bb5139a038a
Author: Philip Van Hoof <philip codeminded be>
Date:   Mon Mar 15 15:24:33 2010 +0100

    squashme with INSERT_STATEMENT_ID one

 src/libtracker-data/tracker-data-update.c |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 9cc5058..9b6724f 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2563,8 +2563,9 @@ tracker_data_replay_journal (GHashTable *classes,
 			tracker_db_journal_reader_get_statement_id (&graph_id, &subject_id, &predicate_id, &object_id);
 
 			property = g_hash_table_lookup (properties, GINT_TO_POINTER (predicate_id));
+			class = g_hash_table_lookup (classes, GINT_TO_POINTER (object_id));
 
-			if (property) {
+			if (property && class) {
 				if (tracker_property_get_data_type (property) != TRACKER_PROPERTY_TYPE_RESOURCE) {
 					g_warning ("Journal replay error: 'property with ID %d does not account URIs'", predicate_id);
 				} else {
@@ -2575,22 +2576,7 @@ tracker_data_replay_journal (GHashTable *classes,
 					}
 
 					if (property == rdf_type) {
-						/* TODO: refactor the necessity of this lookup away */
-						const gchar *object = query_resource_by_id (object_id);
-
-						/* handle rdf:type statements specially to
-						   cope with inference and insert blank rows */
-
-						if (object) {
-							class = tracker_ontologies_get_class_by_uri (object);
-						}
-
-						if (class != NULL) {
-							cache_create_service_decomposed (class, NULL, graph_id, FALSE);
-						} else {
-							g_warning ("Journal replay error: 'class with ID %d not found in the ontology'", object_id);
-						}
-
+						cache_create_service_decomposed (class, NULL, graph_id, FALSE);
 					} else {
 						GError *new_error = NULL;
 
@@ -2605,7 +2591,10 @@ tracker_data_replay_journal (GHashTable *classes,
 					}
 				}
 			} else {
-				g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
+				if (!class)
+					g_warning ("Journal replay error: 'class with ID %d not found in the ontology'", object_id);
+				if (!property)
+					g_warning ("Journal replay error: 'property with ID %d doesn't exist'", predicate_id);
 			}
 
 		} else if (type == TRACKER_DB_JOURNAL_DELETE_STATEMENT) {



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