[tracker] libtracker-data: Add support for the CONTAINS builtin function
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Add support for the CONTAINS builtin function
- Date: Mon, 19 Oct 2015 12:14:49 +0000 (UTC)
commit b8017378897454444e17b1c62e59b4e70c18d321
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Jul 28 20:28:31 2015 +0200
libtracker-data: Add support for the CONTAINS builtin function
This function is defined in Sparql 1.1 query language recommendation,
http://www.w3.org/TR/sparql11-query/#func-contains
src/libtracker-data/tracker-sparql-expression.vala | 6 ++++++
src/libtracker-data/tracker-sparql-scanner.vala | 13 ++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala
b/src/libtracker-data/tracker-sparql-expression.vala
index d9ca3b8..a4318a3 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -1178,6 +1178,12 @@ class Tracker.Sparql.Expression : Object {
var result = translate_function (sql, FN_NS + "concat");
expect (SparqlTokenType.CLOSE_PARENS);
return result;
+ case SparqlTokenType.CONTAINS:
+ next ();
+ expect (SparqlTokenType.OPEN_PARENS);
+ var result = translate_function (sql, FN_NS + "contains");
+ expect (SparqlTokenType.CLOSE_PARENS);
+ return result;
case SparqlTokenType.IF:
return translate_if_call (sql);
case SparqlTokenType.SAMETERM:
diff --git a/src/libtracker-data/tracker-sparql-scanner.vala b/src/libtracker-data/tracker-sparql-scanner.vala
index 77983f4..cd2f29a 100644
--- a/src/libtracker-data/tracker-sparql-scanner.vala
+++ b/src/libtracker-data/tracker-sparql-scanner.vala
@@ -328,7 +328,16 @@ public class Tracker.SparqlScanner : Object {
switch (begin[0]) {
case 'C':
case 'c':
- if (matches (begin, "COALESCE")) return SparqlTokenType.COALESCE;
+ switch (begin[2]) {
+ case 'A':
+ case 'a':
+ if (matches (begin, "COALESCE")) return SparqlTokenType.COALESCE;
+ break;
+ case 'N':
+ case 'n':
+ if (matches (begin, "CONTAINS")) return SparqlTokenType.CONTAINS;
+ break;
+ }
break;
case 'D':
case 'd':
@@ -877,6 +886,7 @@ public enum Tracker.SparqlTokenType {
COALESCE,
COLON,
CONCAT,
+ CONTAINS,
COMMA,
CONSTRUCT,
COUNT,
@@ -978,6 +988,7 @@ public enum Tracker.SparqlTokenType {
case COALESCE: return "`COALESCE'";
case COLON: return "`:'";
case CONCAT: return "`CONCAT'";
+ case CONTAINS: return "`CONTAINS'";
case COMMA: return "`,'";
case CONSTRUCT: return "`CONSTRUCT'";
case COUNT: return "`COUNT'";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]