[tracker/on-extractor-error: 2/4] miners/fs: Don't set IE properties in case of error



commit 5adb3a720490c4baacc2a6445b87302acf4339b7
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue May 3 17:30:36 2011 +0200

    miners/fs: Don't set IE properties in case of error

 src/miners/fs/tracker-miner-files.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/src/miners/fs/tracker-miner-files.c b/src/miners/fs/tracker-miner-files.c
index d465ee2..658c5a8 100644
--- a/src/miners/fs/tracker-miner-files.c
+++ b/src/miners/fs/tracker-miner-files.c
@@ -1957,6 +1957,8 @@ extractor_get_embedded_metadata_cb (const gchar *preupdate,
 {
 	ProcessFileData *data = user_data;
 	const gchar *uuid;
+	gboolean is_iri;
+	const gchar *urn;
 
 	if (error) {
 		tracker_sparql_builder_graph_close (data->sparql);
@@ -1968,12 +1970,21 @@ extractor_get_embedded_metadata_cb (const gchar *preupdate,
 		return;
 	}
 
-	if (sparql && *sparql) {
-		gboolean is_iri;
-		const gchar *urn;
+	urn = miner_files_get_file_urn (data->miner, data->file, &is_iri);
 
-		urn = miner_files_get_file_urn (data->miner, data->file, &is_iri);
+	/* Laying the link between the IE and the DO. We use IE = DO, don't do this
+	 * in case of error so that we can distinguish between succeeded and failed
+	 * files with sparql queries */
+	tracker_sparql_builder_predicate (data->sparql, "a");
+	tracker_sparql_builder_object (data->sparql, "nie:InformationElement");
+	tracker_sparql_builder_predicate (data->sparql, "nie:isStoredAs");
+	if (is_iri) {
+		tracker_sparql_builder_object_iri (data->sparql, urn);
+	} else {
+		tracker_sparql_builder_object (data->sparql, urn);
+	}
 
+	if (sparql && *sparql) {
 		if (is_iri) {
 			gchar *str;
 
@@ -2429,7 +2440,6 @@ process_file_cb (GObject      *object,
 
 	tracker_sparql_builder_predicate (sparql, "a");
 	tracker_sparql_builder_object (sparql, "nfo:FileDataObject");
-	tracker_sparql_builder_object (sparql, "nie:InformationElement");
 
 	is_directory = (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY ?
 	                TRUE : FALSE);
@@ -2458,14 +2468,6 @@ process_file_cb (GObject      *object,
 	tracker_sparql_builder_predicate (sparql, "nfo:fileLastAccessed");
 	tracker_sparql_builder_object_date (sparql, (time_t *) &time_);
 
-	/* Laying the link between the IE and the DO. We use IE = DO */
-	tracker_sparql_builder_predicate (sparql, "nie:isStoredAs");
-	if (is_iri) {
-		tracker_sparql_builder_object_iri (sparql, urn);
-	} else {
-		tracker_sparql_builder_object (sparql, urn);
-	}
-
 	/* The URL of the DataObject (because IE = DO, this is correct) */
 	tracker_sparql_builder_predicate (sparql, "nie:url");
 	tracker_sparql_builder_object_string (sparql, uri);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]