[tracker/wip/carlosg/sparql1.1: 182/201] libtracker-data: Honor UsingClause
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/sparql1.1: 182/201] libtracker-data: Honor UsingClause
- Date: Mon, 9 Sep 2019 22:34:07 +0000 (UTC)
commit 5a8ec5adc52f0b8c78a2a8f3e281a021db016ce7
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Sep 7 16:33:11 2019 +0200
libtracker-data: Honor UsingClause
The full syntax of Modify clause is:
(WITH <iri>)? (DELETE {...})? (INSERT {...})? (USING ...)* (WHERE {...})?
The first with is meant to affect the graphs used in the DELETE/INSERT
parts, whereas USING is used to influence the graphs used in the WHERE{}
clause.
src/libtracker-data/tracker-sparql.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 4e507d99c..6c4b99fbe 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -3943,15 +3943,28 @@ static gboolean
translate_UsingClause (TrackerSparql *sparql,
GError **error)
{
+ gboolean named = FALSE;
+ gchar *graph;
+
/* UsingClause ::= 'USING' ( iri | 'NAMED' iri )
*/
_expect (sparql, RULE_TYPE_LITERAL, LITERAL_USING);
- // FIXME
- if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_NAMED)) {
- }
+ if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_NAMED))
+ named = TRUE;
_call_rule (sparql, NAMED_RULE_iri, error);
+ _init_token (&sparql->current_state.graph,
+ sparql->current_state.prev_node, sparql);
+ graph = g_strdup (tracker_token_get_idstring (&sparql->current_state.graph));
+
+ if (named)
+ g_ptr_array_add (sparql->named_graphs, graph);
+ else
+ g_ptr_array_add (sparql->anon_graphs, graph);
+
+ tracker_token_unset (&sparql->current_state.graph);
+ g_free (graph);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]