[tracker/anonymous-file-nodes] DROP GRAPH now uses the value of nie:url instead of subjects
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/anonymous-file-nodes] DROP GRAPH now uses the value of nie:url instead of subjects
- Date: Fri, 29 Jan 2010 15:53:01 +0000 (UTC)
commit e3bb7e2ec54d4a2ad70996a4674a12a2f6fb0865
Author: Philip Van Hoof <philip codeminded be>
Date: Fri Jan 29 16:52:12 2010 +0100
DROP GRAPH now uses the value of nie:url instead of subjects
src/libtracker-data/tracker-data-update.c | 24 +++++++++++++++++++-----
src/libtracker-data/tracker-data-update.h | 2 +-
src/libtracker-data/tracker-sparql-query.vala | 4 ++--
3 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index 001fd6c..2aac07c 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1952,7 +1952,7 @@ format_sql_value_as_string (GString *sql,
*/
void
tracker_data_delete_resource_description (const gchar *graph,
- const gchar *uri,
+ const gchar *url,
GError **error)
{
TrackerDBInterface *iface;
@@ -1970,10 +1970,24 @@ tracker_data_delete_resource_description (const gchar *graph,
* that otherwise the query of the outer cursor would be reused by the
* cursors of the inner queries. */
- resource_id = tracker_data_query_resource_id (uri);
-
iface = tracker_db_manager_get_db_interface ();
+ /* DROP GRAPH <url> - url here is nie:url */
+
+ stmt = tracker_db_interface_create_statement (iface, "SELECT ID FROM \"nie:DataObject\" WHERE \"nie:DataObject\".\"nie:url\" = ?");
+ tracker_db_statement_bind_text (stmt, 0, url);
+ result_set = tracker_db_statement_execute (stmt, NULL);
+ g_object_unref (stmt);
+
+ if (result_set) {
+ tracker_db_result_set_get (result_set, 0, &resource_id, -1);
+ g_object_unref (result_set);
+ } else {
+ /* For fallback to the old behaviour, we could do this here:
+ * resource_id = tracker_data_query_resource_id (url); */
+ return;
+ }
+
properties = tracker_ontology_get_properties (&n_props);
stmt = tracker_db_interface_create_statement (iface, "SELECT (SELECT Uri FROM Resource WHERE ID = \"rdf:type\") FROM \"rdfs:Resource_rdf:type\" WHERE ID = ?");
@@ -2058,7 +2072,7 @@ tracker_data_delete_resource_description (const gchar *graph,
tracker_db_result_set_get (single_result, i++, &value, -1);
if (value) {
- tracker_data_delete_statement (graph, uri,
+ tracker_data_delete_statement (graph, url,
tracker_property_get_uri (property),
value,
&new_error);
@@ -2093,7 +2107,7 @@ tracker_data_delete_resource_description (const gchar *graph,
tracker_db_result_set_get (multi_result, 0, &value, -1);
- tracker_data_delete_statement (graph, uri,
+ tracker_data_delete_statement (graph, url,
tracker_property_get_uri (property),
value,
&new_error);
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 4483441..71614ed 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -54,7 +54,7 @@ GQuark tracker_data_error_quark (void);
/* Metadata */
void tracker_data_delete_resource_description (const gchar *graph,
- const gchar *uri,
+ const gchar *url,
GError **error);
void tracker_data_delete_statement (const gchar *graph,
const gchar *subject,
diff --git a/src/libtracker-data/tracker-sparql-query.vala b/src/libtracker-data/tracker-sparql-query.vala
index 88ae9d8..6e93b04 100644
--- a/src/libtracker-data/tracker-sparql-query.vala
+++ b/src/libtracker-data/tracker-sparql-query.vala
@@ -1057,9 +1057,9 @@ public class Tracker.SparqlQuery : Object {
expect (SparqlTokenType.GRAPH);
bool is_var;
- string uri = parse_var_or_term (null, out is_var);
+ string url = parse_var_or_term (null, out is_var);
- Data.delete_resource_description (uri, uri);
+ Data.delete_resource_description (url, url);
// ensure possible WHERE clause in next part gets the correct results
Data.update_buffer_flush ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]