[tracker] SPARQL: Do not require AS when using select functions
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] SPARQL: Do not require AS when using select functions
- Date: Fri, 16 Oct 2009 10:02:14 +0000 (UTC)
commit fddb0b006e4787774bc3f6f136462be8027e8a90
Author: Jürg Billeter <j bitron ch>
Date: Fri Oct 16 11:13:59 2009 +0200
SPARQL: Do not require AS when using select functions
src/libtracker-data/tracker-sparql-query.vala | 35 +++++++++++++++----------
1 files changed, 21 insertions(+), 14 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 48ed6cf..a786405 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -543,32 +543,37 @@ public class Tracker.SparqlQuery : Object {
sql.append ("COUNT(");
translate_expression_as_string (sql);
sql.append (")");
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
} else if (accept (SparqlTokenType.SUM)) {
sql.append ("SUM(");
translate_expression_as_string (sql);
sql.append (")");
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
} else if (accept (SparqlTokenType.AVG)) {
sql.append ("AVG(");
translate_expression_as_string (sql);
sql.append (")");
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
} else if (accept (SparqlTokenType.MIN)) {
sql.append ("MIN(");
translate_expression_as_string (sql);
sql.append (")");
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
} else if (accept (SparqlTokenType.MAX)) {
sql.append ("MAX(");
translate_expression_as_string (sql);
sql.append (")");
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
} else if (accept (SparqlTokenType.GROUP_CONCAT)) {
sql.append ("GROUP_CONCAT(");
expect (SparqlTokenType.OPEN_PARENS);
@@ -578,8 +583,9 @@ public class Tracker.SparqlQuery : Object {
sql.append (escape_sql_string_literal (parse_string_literal ()));
sql.append (")");
expect (SparqlTokenType.CLOSE_PARENS);
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
} else {
translate_expression_as_string (sql);
}
@@ -1082,8 +1088,9 @@ public class Tracker.SparqlQuery : Object {
long begin = sql.len;
var type = translate_function (sql, binding.literal);
expect (SparqlTokenType.CLOSE_PARENS);
- expect (SparqlTokenType.AS);
- expect (SparqlTokenType.PN_PREFIX);
+ if (accept (SparqlTokenType.AS)) {
+ expect (SparqlTokenType.PN_PREFIX);
+ }
convert_expression_to_string (sql, type, begin);
} else {
sql.append ("?");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]