[tracker/wip/passive-extraction: 4/7] miner-fs: Set relevant rdf:types on files



commit 6b0a47022c0456d82d45b17817ab6c2a946a3152
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 5f4f8ee..6e6f643 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1980,6 +1980,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);
@@ -2171,6 +2192,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]