[tracker] SPARQL: Only retrieve graph from database when necessary
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] SPARQL: Only retrieve graph from database when necessary
- Date: Thu, 10 Jun 2010 08:11:31 +0000 (UTC)
commit 68165f1d58421bd17fda5082c2599d7d2c32c5e2
Author: Jürg Billeter <j bitron ch>
Date: Wed Jun 9 17:14:28 2010 +0200
SPARQL: Only retrieve graph from database when necessary
src/libtracker-data/tracker-sparql-pattern.vala | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/src/libtracker-data/tracker-sparql-pattern.vala b/src/libtracker-data/tracker-sparql-pattern.vala
index 37115b7..4b169e7 100644
--- a/src/libtracker-data/tracker-sparql-pattern.vala
+++ b/src/libtracker-data/tracker-sparql-pattern.vala
@@ -22,6 +22,7 @@ namespace Tracker.Sparql {
class PredicateVariable : Object {
public string? subject;
public string? object;
+ public bool return_graph;
public Class? domain;
@@ -59,8 +60,11 @@ namespace Tracker.Sparql {
Expression.append_expression_as_string (sql, "\"%s\"".printf (prop.name), prop.data_type);
- sql.append_printf (" AS \"object\", \"%s:graph\" AS \"graph\" FROM ", prop.name);
- sql.append_printf ("\"%s\"", prop.table_name);
+ sql.append (" AS \"object\"");
+ if (return_graph) {
+ sql.append_printf (", \"%s:graph\" AS \"graph\"", prop.name);
+ }
+ sql.append_printf (" FROM \"%s\"", prop.table_name);
sql.append (" WHERE ID = ?");
@@ -102,8 +106,11 @@ namespace Tracker.Sparql {
Expression.append_expression_as_string (sql, "\"%s\"".printf (prop.name), prop.data_type);
- sql.append_printf (" AS \"object\", \"%s:graph\" AS \"graph\" FROM ", prop.name);
- sql.append_printf ("\"%s\"", prop.table_name);
+ sql.append (" AS \"object\"");
+ if (return_graph) {
+ sql.append_printf (", \"%s:graph\" AS \"graph\"", prop.name);
+ }
+ sql.append_printf (" FROM \"%s\"", prop.table_name);
}
}
} while (result_set.iter_next ());
@@ -1266,6 +1273,9 @@ class Tracker.Sparql.Pattern : Object {
// single object
table.predicate_variable.object = object;
}
+ if (current_graph != null) {
+ table.predicate_variable.return_graph = true;
+ }
table.sql_query_tablename = current_predicate + (++counter).to_string ();
triple_context.tables.append (table);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]