[tracker/sparql-update: 6/16] libtracker-data: Check for domain in support for REPLACE



commit 5a9e1c876bf7d46b676b9f7f71bb07e71bcf8ba7
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Mar 10 17:52:07 2011 +0100

    libtracker-data: Check for domain in support for REPLACE

 src/libtracker-data/tracker-data-update.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index d8af943..67e95ad 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -2620,6 +2620,14 @@ tracker_data_update_statement_with_uri (const gchar            *graph,
 		gboolean multiple_values;
 		GError *new_error = NULL;
 
+		if (!check_property_domain (property)) {
+			g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_CONSTRAINT,
+			             "Subject `%s' is not in domain `%s' of property `%s'",
+			             resource_buffer->subject,
+			             tracker_class_get_name (tracker_property_get_domain (property)),
+			             tracker_property_get_name (property));
+		}
+
 		multiple_values = tracker_property_get_multiple_values (property);
 
 		/* We can disable correct object-id for deletes array here */
@@ -2738,6 +2746,14 @@ tracker_data_update_statement_with_string (const gchar            *graph,
 		return;
 	}
 
+	if (!check_property_domain (property)) {
+		g_set_error (error, TRACKER_SPARQL_ERROR, TRACKER_SPARQL_ERROR_CONSTRAINT,
+		             "Subject `%s' is not in domain `%s' of property `%s'",
+		             resource_buffer->subject,
+		             tracker_class_get_name (tracker_property_get_domain (property)),
+		             tracker_property_get_name (property));
+	}
+
 	/* add or update value to metadata database */
 	change = cache_update_metadata_decomposed (property, object, 0, graph, 0, &actual_error);
 	if (actual_error) {



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