[tracker/equipment-onto] tracker-extract: Updated tiff extractor to canonical uris



commit f199002e7e0797e8569662659421f8c1b0164d6f
Author: Philip Van Hoof <philip codeminded be>
Date:   Tue Sep 7 14:28:49 2010 +0200

    tracker-extract: Updated tiff extractor to canonical uris

 src/tracker-extract/tracker-extract-tiff.c |   32 ++++++++++++++++++---------
 1 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 7872178..533d94e 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -536,19 +536,29 @@ extract_tiff (const gchar          *uri,
 	g_ptr_array_free (keywords, TRUE);
 
 	if (md.make || md.model) {
-		tracker_sparql_builder_predicate (metadata, "nfo:equipment");
-		tracker_sparql_builder_object_blank_open (metadata);
-		tracker_sparql_builder_predicate (metadata, "a");
-		tracker_sparql_builder_object (metadata, "nco:Equipment");
-		if (md.model) {
-			tracker_sparql_builder_predicate (metadata, "nco:model");
-			tracker_sparql_builder_object_unvalidated (metadata, md.model);
-		}
+		gchar *equip_uri;
+
+		equip_uri = tracker_sparql_escape_uri_printf ("urn:equipment:%s:%s:",
+		                                              md.make ? md.make : "",
+		                                              md.model ? md.model : "");
+
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+		tracker_sparql_builder_subject_iri (preupdate, equip_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nfo:Equipment");
+
 		if (md.make) {
-			tracker_sparql_builder_predicate (metadata, "nco:make");
-			tracker_sparql_builder_object_unvalidated (metadata, md.make);
+			tracker_sparql_builder_predicate (preupdate, "nfo:manufacturer");
+			tracker_sparql_builder_object_unvalidated (preupdate, md.make);
 		}
-		tracker_sparql_builder_object_blank_close (metadata);
+		if (md.model) {
+			tracker_sparql_builder_predicate (preupdate, "nfo:model");
+			tracker_sparql_builder_object_unvalidated (preupdate, md.model);
+		}
+		tracker_sparql_builder_insert_close (preupdate);
+		tracker_sparql_builder_predicate (metadata, "nfo:equipment");
+		tracker_sparql_builder_object_iri (metadata, equip_uri);
+		g_free (equip_uri);
 	}
 
 	if (md.title) {



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