[tracker/wip/passive-extraction: 4/12] miner-fs: Set relevant rdf:types on files
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/passive-extraction: 4/12] miner-fs: Set relevant rdf:types on files
- Date: Tue, 7 Jan 2014 22:47:06 +0000 (UTC)
commit efdc2b737057321a859f261fa8ccfc2cc425e478
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jan 3 02:11:26 2014 +0100
miner-fs: Set relevant rdf:types on files
This way, files will be recognized as promptly as possible as being
of the correct type, even though tracker-extract hasn't gone through
it yet. This information could also be used in tracker-extract itself
in order to figure out the best extractor.
src/miners/fs/tracker-miner-files.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index 0aaab53..9818b52 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1975,6 +1975,27 @@ miner_files_add_to_datasource (TrackerMinerFiles *mf,
}
static void
+miner_files_add_rdf_types (TrackerSparqlBuilder *sparql,
+ GFile *file,
+ const gchar *mime_type)
+{
+ GStrv rdf_types;
+ gint i = 0;
+
+ rdf_types = tracker_extract_module_manager_get_fallback_rdf_types (mime_type);
+
+ if (!rdf_types || !rdf_types[0])
+ return;
+
+ tracker_sparql_builder_predicate (sparql, "a");
+
+ while (rdf_types[i]) {
+ tracker_sparql_builder_object (sparql, rdf_types[i]);
+ i++;
+ }
+}
+
+static void
process_file_data_free (ProcessFileData *data)
{
g_object_unref (data->miner);
@@ -2166,6 +2187,7 @@ process_file_cb (GObject *object,
miner_files_add_to_datasource (data->miner, file, sparql);
+ miner_files_add_rdf_types (sparql, file, mime_type);
sparql_builder_finish (data, NULL, NULL, NULL, NULL);
tracker_miner_fs_file_notify (TRACKER_MINER_FS (data->miner), data->file, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]