[tracker/poppler-glib: 11/16] tracker-extract, pdf: Port 'Fixed nested use of anonymous blank nodes'



commit e5462431b15ef4dca18d2ab5d7d17f13eb622661
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Feb 22 11:37:39 2011 +0100

    tracker-extract,pdf: Port 'Fixed nested use of anonymous blank nodes'
    
    Original commit ID: 37cc69997955dd379f16ddd77380ff226f71286b

 src/tracker-extract/tracker-extract-pdf.c |   38 +++++++++++++++++-----------
 1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 3f86b4b..283beea 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -501,11 +501,13 @@ extract_pdf (const gchar          *uri,
 		}
 
 		if (xd->address || xd->country || xd->city) {
+			gchar *addruri;
+
 			tracker_sparql_builder_predicate (metadata, "mlo:location");
 
 			tracker_sparql_builder_object_blank_open (metadata);
 			tracker_sparql_builder_predicate (metadata, "a");
-			tracker_sparql_builder_object (metadata, "mlo:GeoPoint");
+			tracker_sparql_builder_object (metadata, "mlo:GeoPoint"); /* GeoPoint */
 
 			if (xd->address) {
 				tracker_sparql_builder_predicate (metadata, "mlo:address");
@@ -527,35 +529,41 @@ extract_pdf (const gchar          *uri,
 				tracker_sparql_builder_object_unvalidated (metadata, xd->country);
 			}
 
+			addruri = tracker_sparql_get_uuid_urn ();
+
 			tracker_sparql_builder_predicate (metadata, "mlo:asPostalAddress");
-			tracker_sparql_builder_object_blank_open (metadata); /* PostalAddress */
+			tracker_sparql_builder_object_iri (metadata, addruri);
+			tracker_sparql_builder_object_blank_close (metadata); /* GeoPoint */
 
-			tracker_sparql_builder_predicate (metadata, "a");
-			tracker_sparql_builder_object (metadata, "nco:PostalAddress");
+			tracker_sparql_builder_insert_open (preupdate, NULL);
+			tracker_sparql_builder_subject_iri (preupdate, addruri);
+
+			g_free (addruri);
+
+			tracker_sparql_builder_predicate (preupdate, "a");
+			tracker_sparql_builder_object (preupdate, "nco:PostalAddress");
 
 			if (xd->address) {
-				tracker_sparql_builder_predicate (metadata, "nco:streetAddress");
-				tracker_sparql_builder_object_unvalidated (metadata, xd->address);
+				tracker_sparql_builder_predicate (preupdate, "nco:streetAddress");
+				tracker_sparql_builder_object_unvalidated (preupdate, xd->address);
 			}
 
 			if (xd->state) {
-				tracker_sparql_builder_predicate (metadata, "nco:region");
-				tracker_sparql_builder_object_unvalidated (metadata, xd->state);
+				tracker_sparql_builder_predicate (preupdate, "nco:region");
+				tracker_sparql_builder_object_unvalidated (preupdate, xd->state);
 			}
 
 			if (xd->city) {
-				tracker_sparql_builder_predicate (metadata, "nco:locality");
-				tracker_sparql_builder_object_unvalidated (metadata, xd->city);
+				tracker_sparql_builder_predicate (preupdate, "nco:locality");
+				tracker_sparql_builder_object_unvalidated (preupdate, xd->city);
 			}
 
 			if (xd->country) {
-				tracker_sparql_builder_predicate (metadata, "nco:country");
-				tracker_sparql_builder_object_unvalidated (metadata, xd->country);
+				tracker_sparql_builder_predicate (preupdate, "nco:country");
+				tracker_sparql_builder_object_unvalidated (preupdate, xd->country);
 			}
 
-			tracker_sparql_builder_object_blank_close (metadata); /* PostalAddress */
-
-			tracker_sparql_builder_object_blank_close (metadata);
+			tracker_sparql_builder_object_blank_close (preupdate);
 		}
 
 		tracker_xmp_free (xd);



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