[tracker/rss-enclosures] libtracker-data: Add support for tracker:subject() to SPARQL engine



commit 52897037923cda8053a791cbca5853971e162a73
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Aug 24 14:46:50 2010 +0200

    libtracker-data: Add support for tracker:subject() to SPARQL engine

 src/libtracker-data/tracker-sparql-expression.vala |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-expression.vala b/src/libtracker-data/tracker-sparql-expression.vala
index 064217b..5ab9663 100644
--- a/src/libtracker-data/tracker-sparql-expression.vala
+++ b/src/libtracker-data/tracker-sparql-expression.vala
@@ -567,6 +567,19 @@ class Tracker.Sparql.Expression : Object {
 			}
 
 			return PropertyType.INTEGER;
+		} else if (uri == TRACKER_NS + "subject") {
+			
+			if (current () == SparqlTokenType.INTEGER) {
+				next ();
+				sql.append ("(SELECT Uri FROM Resource WHERE ID = ?)");
+				var binding = new LiteralBinding ();
+				binding.literal = get_last_string ();
+				query.bindings.append (binding);
+			} else {
+				throw get_error ("expected ID");
+			}
+
+			return PropertyType.STRING;
 		} else if (uri == TRACKER_NS + "cartesian-distance") {
 			sql.append ("SparqlCartesianDistance(");
 			translate_expression (sql);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]