[tracker/uuid-geo-stuff: 6/7] tracker-extract: png: Fixed nested use of anonymous blank nodes



commit 3704d434b4bd1d0dba57d51e13e9743e4074117c
Author: Philip Van Hoof <philip codeminded be>
Date:   Wed Nov 24 15:13:08 2010 +0100

    tracker-extract: png: Fixed nested use of anonymous blank nodes
    
    Fixes NB#202291

 src/tracker-extract/tracker-extract-png.c |   39 +++++++++++++++++------------
 1 files changed, 23 insertions(+), 16 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index c29c6d2..b5a1d73 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -412,11 +412,13 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 	}
 
 	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");
@@ -438,35 +440,40 @@ read_metadata (TrackerSparqlBuilder *preupdate,
 			tracker_sparql_builder_object_unvalidated (metadata, xd->country);
 		}
 
+		addruri = tracker_sparql_get_uuid_urn ("postal-address");
+
 		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_predicate (metadata, "a");
-		tracker_sparql_builder_object (metadata, "nco:PostalAddress");
+		tracker_sparql_builder_object_blank_close (metadata); /* GeoPoint */
+
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+		tracker_sparql_builder_subject_iri (preupdate, 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_insert_close (preupdate);
 	}
 
 	if (ed->x_resolution) {



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