[tracker/parser] SPARQL: support for ISIRI()/ISURI() (isiri(<foo>) still needs fixing)
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/parser] SPARQL: support for ISIRI()/ISURI() (isiri(<foo>) still needs fixing)
- Date: Wed, 12 Aug 2009 14:41:34 +0000 (UTC)
commit 8a934d1bd472e5603cae27aba223118b08bdc997
Author: Philip Van Hoof <philip codeminded be>
Date: Wed Aug 12 16:40:32 2009 +0200
SPARQL: support for ISIRI()/ISURI() (isiri(<foo>) still needs fixing)
src/libtracker-data/tracker-sparql-query.vala | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index dafb132..6ecffcb 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -1029,6 +1029,28 @@ public class Tracker.SparqlQuery : Object {
expect (SparqlTokenType.CLOSE_PARENS);
}
+ void translate_isuri (StringBuilder sql) throws SparqlError {
+ if (!accept (SparqlTokenType.ISURI)) {
+ expect (SparqlTokenType.ISIRI);
+ }
+
+ expect (SparqlTokenType.OPEN_PARENS);
+
+ sql.append ("?");
+ var new_binding = new LiteralBinding ();
+ new_binding.literal_type = DataType.INTEGER;
+
+ if (translate_expression (new StringBuilder ()) == DataType.RESOURCE) {
+ new_binding.literal = "1";
+ } else {
+ new_binding.literal = "0";
+ }
+
+ bindings.append (new_binding);
+
+ expect (SparqlTokenType.CLOSE_PARENS);
+ }
+
void translate_datatype (StringBuilder sql) throws SparqlError {
expect (SparqlTokenType.DATATYPE);
expect (SparqlTokenType.OPEN_PARENS);
@@ -1233,6 +1255,8 @@ public class Tracker.SparqlQuery : Object {
return DataType.BOOLEAN;
case SparqlTokenType.ISIRI:
case SparqlTokenType.ISURI:
+ translate_isuri (sql);
+ return DataType.BOOLEAN;
// case SparqlTokenType.ISBLANK:
case SparqlTokenType.ISLITERAL:
next ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]