[tracker] SPARQL: Add error reporting about nested anonymous blank nodes



commit f2152f7a3d1b2f2eca438e5a3f426d8aa20ac35f
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Mar 3 12:42:15 2010 +0100

    SPARQL: Add error reporting about nested anonymous blank nodes

 src/libtracker-data/tracker-sparql-query.vala |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 86dea26..2a9e696 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -2184,6 +2184,7 @@ public class Tracker.SparqlQuery : Object {
 		expect (SparqlTokenType.CLOSE_BRACE);
 	}
 
+	bool anon_blank_node_open = false;
 
 	string parse_construct_var_or_term (HashTable<string,string> var_value_map) throws SparqlError, DataError, DateError {
 		string result = "";
@@ -2244,6 +2245,12 @@ public class Tracker.SparqlQuery : Object {
 		} else if (current () == SparqlTokenType.STRING_LITERAL_LONG2) {
 			result = parse_string_literal ();
 		} else if (current () == SparqlTokenType.OPEN_BRACKET) {
+
+			if (anon_blank_node_open) {
+				throw get_error ("no support for nested anonymous blank nodes");
+			}
+
+			anon_blank_node_open = true;
 			next ();
 
 			result = generate_bnodeid (null);
@@ -2254,6 +2261,7 @@ public class Tracker.SparqlQuery : Object {
 			current_subject = result;
 			parse_construct_property_list_not_empty (var_value_map);
 			expect (SparqlTokenType.CLOSE_BRACKET);
+			anon_blank_node_open = false;
 
 			current_subject = old_subject;
 			current_subject_is_var = old_subject_is_var;



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