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



commit dd44cd318a962cf4592f6b26c68c3132a5bc87a5
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 6402075..d97c5b2 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2496,8 +2496,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 {
@@ -2508,22 +2509,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;
 
@@ -2538,7 +2524,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]