[tracker/wip/carlosg/sparql-parser-ng: 41/43] libtracker-data: Support inverse property path
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/sparql-parser-ng: 41/43] libtracker-data: Support inverse property path
- Date: Sat, 3 Nov 2018 13:10:58 +0000 (UTC)
commit d1008607302fea969f5e35b604c3eed0f6e3b886
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Nov 3 13:14:35 2018 +0100
libtracker-data: Support inverse property path
"?a ^:foo ?b" is equivalent to "?b :foo ?a", invert the subject/predicate
in order to handle this.
src/libtracker-data/tracker-sparql.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-sparql.c b/src/libtracker-data/tracker-sparql.c
index 10ba7b2ca..c348ad9de 100644
--- a/src/libtracker-data/tracker-sparql.c
+++ b/src/libtracker-data/tracker-sparql.c
@@ -4091,14 +4091,26 @@ static gboolean
translate_PathEltOrInverse (TrackerSparql *sparql,
GError **error)
{
+ TrackerToken old_object, old_subject, *old_token;
+
/* PathEltOrInverse ::= PathElt | '^' PathElt
*/
+ old_object = sparql->current_state.object;
+ old_subject = sparql->current_state.subject;
+ old_token = sparql->current_state.token;
+
if (_accept (sparql, RULE_TYPE_LITERAL, LITERAL_PATH_INVERSE)) {
- _unimplemented ("Property paths");
+ sparql->current_state.object = old_subject;
+ sparql->current_state.subject = old_object;
+ sparql->current_state.token = &sparql->current_state.subject;
}
_call_rule (sparql, NAMED_RULE_PathElt, error);
+ sparql->current_state.subject = old_subject;
+ sparql->current_state.object = old_object;
+ sparql->current_state.token = old_token;
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]