[tracker] libtracker-data: Move the range-altering to the post check



commit d7f2058f30ae3e1df88c4af09f19749d02f76e4d
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Apr 6 15:46:50 2010 +0200

    libtracker-data: Move the range-altering to the post check

 src/libtracker-data/tracker-data-manager.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index f23e058..e770827 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -493,15 +493,6 @@ tracker_data_ontology_load_statement (const gchar *ontology_path,
 			return;
 		}
 
-		if (tracker_property_get_is_new (property) != in_update) {
-			TrackerClass *class;
-			if (update_property_value ("rdfs:range", subject, predicate, object, allowed_range_conversions)) {
-				class = tracker_property_get_domain (property);
-				tracker_class_set_need_recreate (class, TRUE);
-				tracker_property_set_need_recreate (property, TRUE);
-			}
-		}
-
 		tracker_property_set_range (property, range);
 	} else if (g_strcmp0 (predicate, NRL_MAX_CARDINALITY) == 0) {
 		TrackerProperty *property;
@@ -682,6 +673,16 @@ tracker_data_ontology_post_check (GPtrArray *seen_classes,
 				fix_indexed (property, FALSE);
 			}
 		}
+
+		if (update_property_value ("rdfs:range", subject, RDFS_PREFIX "range",
+		                           tracker_class_get_uri (tracker_property_get_range (property)), 
+		                           allowed_range_conversions)) {
+			TrackerClass *class;
+
+			class = tracker_property_get_domain (property);
+			tracker_class_set_need_recreate (class, TRUE);
+			tracker_property_set_need_recreate (property, TRUE);
+		}
 	}
 }
 
@@ -2247,6 +2248,8 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
 
 		if (to_reload) {
 			/* Perform ALTER-TABLE and CREATE-TABLE calls for all that are is_new */
+			tracker_data_ontology_post_check (seen_classes, seen_properties);
+
 			tracker_data_ontology_import_into_db (TRUE);
 
 			for (l = to_reload; l; l = l->next) {
@@ -2257,7 +2260,6 @@ tracker_data_manager_init (TrackerDBManagerFlags  flags,
 			g_list_free (to_reload);
 		}
 
-		tracker_data_ontology_post_check (seen_classes, seen_properties);
 		tracker_data_ontology_free_seen (seen_classes);
 		tracker_data_ontology_free_seen (seen_properties);
 



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