[tracker/wip/extract-graphs] tracker-extract: use provided graph when inserting keywords from JPEG images



commit bfe07dd8ac15292dd9442c0edc45e83b025d5c94
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 25 18:02:38 2011 +0200

    tracker-extract: use provided graph when inserting keywords from JPEG images

 src/tracker-extract/tracker-extract-jpeg.c |   22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 46559e3..1e4c302 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -155,7 +155,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 	goffset size;
 	gchar *filename, *uri;
 	gchar *comment = NULL;
-	const gchar *dlna_profile;
+	const gchar *dlna_profile, *graph;
 	GPtrArray *keywords;
 	gboolean success = TRUE;
 	GString *where;
@@ -163,6 +163,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 
 	metadata = tracker_extract_info_get_metadata_builder (info);
 	preupdate = tracker_extract_info_get_preupdate_builder (info);
+	graph = tracker_extract_info_get_graph (info);
 
 	file = tracker_extract_info_get_file (info);
 	filename = g_file_get_path (file);
@@ -431,11 +432,26 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
 		var = g_strdup_printf ("tag%d", i + 1);
 
 		/* ensure tag with specified label exists */
+		tracker_sparql_builder_append (preupdate, "INSERT { ");
+
+		if (graph) {
+			tracker_sparql_builder_append (preupdate, "GRAPH <");
+			tracker_sparql_builder_append (preupdate, graph);
+			tracker_sparql_builder_append (preupdate, "> { ");
+		}
+
 		tracker_sparql_builder_append (preupdate,
-		                               "INSERT { _:tag a nao:Tag ; nao:prefLabel \"");
+		                               "_:tag a nao:Tag ; nao:prefLabel \"");
 		tracker_sparql_builder_append (preupdate, escaped);
+		tracker_sparql_builder_append (preupdate, "\"");
+
+		if (graph) {
+			tracker_sparql_builder_append (preupdate, " } ");
+		}
+
+		tracker_sparql_builder_append (preupdate, " }\n");
 		tracker_sparql_builder_append (preupdate,
-		                               "\" }\nWHERE { FILTER (NOT EXISTS { "
+		                               "WHERE { FILTER (NOT EXISTS { "
 		                               "?tag a nao:Tag ; nao:prefLabel \"");
 		tracker_sparql_builder_append (preupdate, escaped);
 		tracker_sparql_builder_append (preupdate,



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