[tracker/anonymous-file-nodes: 2/4] TrackerMinerFiles: Create anonymous nodes for files.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/anonymous-file-nodes: 2/4] TrackerMinerFiles: Create anonymous nodes for files.
- Date: Thu, 21 Jan 2010 14:32:53 +0000 (UTC)
commit 6ba01f209fd5aecd1185c8a1c4b4ced8f479d65b
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Jan 21 15:27:03 2010 +0100
TrackerMinerFiles: Create anonymous nodes for files.
src/tracker-miner-fs/tracker-miner-files.c | 44 +++++++++++++++++-----------
1 files changed, 27 insertions(+), 17 deletions(-)
---
diff --git a/src/tracker-miner-fs/tracker-miner-files.c b/src/tracker-miner-fs/tracker-miner-files.c
index a271e47..85b6bcd 100644
--- a/src/tracker-miner-fs/tracker-miner-files.c
+++ b/src/tracker-miner-fs/tracker-miner-files.c
@@ -481,8 +481,11 @@ set_up_mount_point (TrackerMinerFiles *miner,
uri = g_file_get_uri (file);
g_string_append_printf (queries,
- "DROP GRAPH <%s>\n "
- "INSERT INTO <%s> { <%s> a tracker:Volume; tracker:mountPoint <%s> } ",
+ "DROP GRAPH <%s> "
+ "INSERT INTO <%s> { "
+ " <%s> a tracker:Volume; "
+ " tracker:mountPoint [ a rdfs:Resource ; nie:url \"%s\" ] "
+ "} ",
removable_device_urn, removable_device_urn, removable_device_urn, uri);
g_object_unref (file);
@@ -1193,7 +1196,7 @@ miner_files_add_to_datasource (TrackerMinerFiles *mf,
removable_device_urn = g_strdup (TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN);
}
- tracker_sparql_builder_subject_iri (sparql, uri);
+ tracker_sparql_builder_subject (sparql, "_:foo");
tracker_sparql_builder_predicate (sparql, "a");
tracker_sparql_builder_object (sparql, "nfo:FileDataObject");
@@ -1342,11 +1345,17 @@ process_file_cb (GObject *object,
uri = g_file_get_uri (file);
mime_type = g_file_info_get_content_type (file_info);
- tracker_sparql_builder_insert_open (sparql, uri);
+ tracker_sparql_builder_insert_open (sparql, NULL);
+
+ tracker_sparql_builder_subject (sparql, "_:foo");
- tracker_sparql_builder_subject_iri (sparql, uri);
tracker_sparql_builder_predicate (sparql, "a");
tracker_sparql_builder_object (sparql, "nfo:FileDataObject");
+ tracker_sparql_builder_object (sparql, "nie:InformationElement");
+
+ if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY) {
+ tracker_sparql_builder_object (sparql, "nfo:Folder");
+ }
parent = g_file_get_parent (file);
if (parent) {
@@ -1371,14 +1380,6 @@ process_file_cb (GObject *object,
tracker_sparql_builder_predicate (sparql, "nfo:fileLastAccessed");
tracker_sparql_builder_object_date (sparql, (time_t *) &time_);
- tracker_sparql_builder_subject_iri (sparql, uri); /* Change to URN */
- tracker_sparql_builder_predicate (sparql, "a");
- tracker_sparql_builder_object (sparql, "nie:InformationElement");
-
- if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY) {
- tracker_sparql_builder_object (sparql, "nfo:Folder");
- }
-
/* Laying the link between the IE and the DO. We use IE = DO */
tracker_sparql_builder_predicate (sparql, "nie:isStoredAs");
tracker_sparql_builder_object_iri (sparql, uri);
@@ -1475,9 +1476,9 @@ miner_files_writeback_file (TrackerMinerFS *fs,
/* For writeback we only write a few properties back. These properties
* should NEVER be marked as tracker:writeback in the ontology ! */
- tracker_sparql_builder_insert_open (sparql, uri);
+ tracker_sparql_builder_insert_open (sparql, NULL);
- tracker_sparql_builder_subject_iri (sparql, uri);
+ tracker_sparql_builder_subject_variable (sparql, "urn");
tracker_sparql_builder_predicate (sparql, "a");
tracker_sparql_builder_object (sparql, "nfo:FileDataObject");
@@ -1495,11 +1496,20 @@ miner_files_writeback_file (TrackerMinerFS *fs,
tracker_sparql_builder_predicate (sparql, "nie:mimeType");
tracker_sparql_builder_object_string (sparql, mime_type);
+ tracker_sparql_builder_insert_close (sparql);
+
+ tracker_sparql_builder_where_open (sparql);
+
+ tracker_sparql_builder_subject_variable (sparql, "urn");
+ tracker_sparql_builder_predicate (sparql, "nie:url");
+ tracker_sparql_builder_object_string (sparql, uri);
+
+ tracker_sparql_builder_where_close (sparql);
+
+
g_object_unref (file_info);
g_free (uri);
- tracker_sparql_builder_insert_close (sparql);
-
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]