[tracker] libtracker-extract: xmp: Fixed nested use of anonymous blank nodes



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

    libtracker-extract: xmp: Fixed nested use of anonymous blank nodes
    
    Fixes NB#202291

 src/libtracker-extract/tracker-xmp.c |   38 ++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index 7b3b394..6ff14f6 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -872,9 +872,11 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
 	}
 
 	if (data->address || data->country || data->city) {
+		gchar *addruri;
+
 		tracker_sparql_builder_predicate (metadata, "mlo:location");
 
-		tracker_sparql_builder_object_blank_open (metadata);
+		tracker_sparql_builder_object_blank_open (metadata); /* GeoPoint */
 		tracker_sparql_builder_predicate (metadata, "a");
 		tracker_sparql_builder_object (metadata, "mlo:GeoPoint");
 
@@ -898,35 +900,41 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
 			tracker_sparql_builder_object_unvalidated (metadata, data->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_predicate (metadata, "a");
-		tracker_sparql_builder_object (metadata, "nco:PostalAddress");
+		tracker_sparql_builder_object_iri (metadata, addruri);
+
+		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 (data->address) {
-			tracker_sparql_builder_predicate (metadata, "nco:streetAddress");
-			tracker_sparql_builder_object_unvalidated (metadata, data->address);
+			tracker_sparql_builder_predicate (preupdate, "nco:streetAddress");
+			tracker_sparql_builder_object_unvalidated (preupdate, data->address);
 		}
 
 		if (data->state) {
-			tracker_sparql_builder_predicate (metadata, "nco:region");
-			tracker_sparql_builder_object_unvalidated (metadata, data->state);
+			tracker_sparql_builder_predicate (preupdate, "nco:region");
+			tracker_sparql_builder_object_unvalidated (preupdate, data->state);
 		}
 
 		if (data->city) {
-			tracker_sparql_builder_predicate (metadata, "nco:locality");
-			tracker_sparql_builder_object_unvalidated (metadata, data->city);
+			tracker_sparql_builder_predicate (preupdate, "nco:locality");
+			tracker_sparql_builder_object_unvalidated (preupdate, data->city);
 		}
 
 		if (data->country) {
-			tracker_sparql_builder_predicate (metadata, "nco:country");
-			tracker_sparql_builder_object_unvalidated (metadata, data->country);
+			tracker_sparql_builder_predicate (preupdate, "nco:country");
+			tracker_sparql_builder_object_unvalidated (preupdate, data->country);
 		}
 
-		tracker_sparql_builder_object_blank_close (metadata); /* PostalAddress */
-
-		tracker_sparql_builder_object_blank_close (metadata);
+		tracker_sparql_builder_insert_close (preupdate);
 	}
 
 	return TRUE;



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