summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2011-10-11 16:07:35 +0200
committerMartyn Russell <martyn@lanedo.com>2011-10-12 14:09:26 +0100
commit97d9f6bf3f0d26d21889f341f0cca6c1d1cd6c81 (patch)
tree4e5075bd869d4d8529d9042952265703b65a8e29
parent61e764c1ac96c4865368e89ca2f8a1fa3f3fc9e6 (diff)
downloadtracker-97d9f6bf3f0d26d21889f341f0cca6c1d1cd6c81.tar.gz
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.
-rw-r--r--src/libtracker-data/tracker-sparql-query.vala11
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 ad45abed3..cab27790f 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;