[tracker] tracker-extract, pdf: Port 'Change nfo:Equipment to use canonical uris'



commit cdbafab352e972f5c17797dd038d612046545719
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Feb 22 11:24:17 2011 +0100

    tracker-extract,pdf: Port 'Change nfo:Equipment to use canonical uris'
    
    Original commit ID: 3d0203cb46fbc6518203e13b44574fabbd85e461

 src/tracker-extract/tracker-extract-pdf.c |   32 +++++++++++++++++++----------
 1 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index e1295b1..5fb562a 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -397,20 +397,30 @@ extract_pdf (const gchar          *uri,
 		}
 
 		if (xd->make || xd->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 (xd->model) {
-				tracker_sparql_builder_predicate (metadata, "nco:model");
-				tracker_sparql_builder_object_unvalidated (metadata, xd->model);
-			}
+			gchar *equip_uri;
+
+			equip_uri = tracker_sparql_escape_uri_printf ("urn:equipment:%s:%s:",
+			                                              xd->make ? xd->make : "",
+			                                              xd->model ? xd->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 (xd->make) {
-				tracker_sparql_builder_predicate (metadata, "nco:make");
-				tracker_sparql_builder_object_unvalidated (metadata, xd->make);
+				tracker_sparql_builder_predicate (preupdate, "nfo:manufacturer");
+				tracker_sparql_builder_object_unvalidated (preupdate, xd->make);
 			}
-			tracker_sparql_builder_object_blank_close (metadata);
+
+			if (xd->model) {
+				tracker_sparql_builder_predicate (preupdate, "nfo:model");
+				tracker_sparql_builder_object_unvalidated (preupdate, xd->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 (xd->orientation) {



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