[tracker/tracker-0.12] SPARQL: Support DELETE WHERE {...}



commit 97d9f6bf3f0d26d21889f341f0cca6c1d1cd6c81
Author: JÃrg Billeter <j bitron ch>
Date:   Tue Oct 11 16:07:35 2011 +0200

    SPARQL: Support DELETE WHERE {...}
    
    The DELETE WHERE operation is a short form where the pattern is also
    used as the template for deletion. Syntax is specified in current
    SPARQL 1.1 Update draft.

 src/libtracker-data/tracker-sparql-query.vala |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index ad45abe..cab2779 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -656,9 +656,16 @@ public class Tracker.Sparql.Query : Object {
 		var template_location = get_location ();
 
 		if (!data) {
-			skip_braces ();
+			// DELETE WHERE is a short form where the pattern is also used as the template for deletion
+			bool delete_where = accept (SparqlTokenType.WHERE);
 
-			if (accept (SparqlTokenType.WHERE)) {
+			if (delete_where) {
+				template_location = get_location ();
+			} else {
+				skip_braces ();
+			}
+
+			if (delete_where || accept (SparqlTokenType.WHERE)) {
 				pattern.current_graph = current_graph;
 				context = pattern.translate_group_graph_pattern (pattern_sql);
 				pattern.current_graph = null;



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