[tracker/anonymous-file-nodes: 8/8] Turn preinserts into more generic preupdate.



commit 0b4748f6146a7ba7a239f64685e1b18df01325af
Author: Carlos Garnacho <carlos lanedo com>
Date:   Tue Jan 26 15:31:28 2010 +0100

    Turn preinserts into more generic preupdate.
    
    Now implementations must open/close inserts themselves, since more
    than just inserts could be added there.

 data/dbus/tracker-extract.xml                      |    2 +-
 src/libtracker-extract/tracker-extract.h           |   12 ++--
 src/tracker-extract/tracker-extract-abw.c          |    4 +-
 .../tracker-extract-gstreamer-helix.c              |   14 ++--
 src/tracker-extract/tracker-extract-gstreamer.c    |   74 +++++++++++---------
 src/tracker-extract/tracker-extract-html.c         |    4 +-
 src/tracker-extract/tracker-extract-imagemagick.c  |    4 +-
 src/tracker-extract/tracker-extract-jpeg.c         |   18 +++--
 src/tracker-extract/tracker-extract-libxine.c      |   26 +++++---
 src/tracker-extract/tracker-extract-mp3.c          |   39 +++++++----
 src/tracker-extract/tracker-extract-mplayer.c      |   26 ++++---
 src/tracker-extract/tracker-extract-msoffice.c     |    8 +-
 src/tracker-extract/tracker-extract-oasis.c        |    4 +-
 src/tracker-extract/tracker-extract-pdf.c          |    4 +-
 src/tracker-extract/tracker-extract-playlist.c     |    4 +-
 src/tracker-extract/tracker-extract-png.c          |    4 +-
 src/tracker-extract/tracker-extract-ps.c           |   10 ++--
 src/tracker-extract/tracker-extract-text.c         |    4 +-
 src/tracker-extract/tracker-extract-tiff.c         |   18 +++--
 src/tracker-extract/tracker-extract-totem.c        |   36 ++++++----
 src/tracker-extract/tracker-extract-vorbis.c       |   32 +++++---
 src/tracker-extract/tracker-extract-xmp.c          |    4 +-
 src/tracker-extract/tracker-extract.c              |   43 +++++------
 23 files changed, 224 insertions(+), 170 deletions(-)
---
diff --git a/data/dbus/tracker-extract.xml b/data/dbus/tracker-extract.xml
index acf5be8..308f211 100644
--- a/data/dbus/tracker-extract.xml
+++ b/data/dbus/tracker-extract.xml
@@ -19,7 +19,7 @@
       <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
       <arg type="s" name="uri" direction="in" />
       <arg type="s" name="mime" direction="in" />
-      <arg type="s" name="preinserts" direction="out" />
+      <arg type="s" name="preupdate" direction="out" />
       <arg type="s" name="embedded" direction="out" />
     </method>
   </interface>
diff --git a/src/libtracker-extract/tracker-extract.h b/src/libtracker-extract/tracker-extract.h
index 27b9595..d55867d 100644
--- a/src/libtracker-extract/tracker-extract.h
+++ b/src/libtracker-extract/tracker-extract.h
@@ -58,7 +58,7 @@ G_BEGIN_DECLS
  * 
  *  static void
  *  extract_png (const gchar          *uri,
- *               TrackerSparqlBuilder *preinserts,
+ *               TrackerSparqlBuilder *preupdate,
  *               TrackerSparqlBuilder *metadata)
  *  {
  *          gint height, width;
@@ -95,9 +95,9 @@ G_BEGIN_DECLS
 /**
  * TrackerExtractMimeFunc:
  * @uri: a string representing a URI.
- * @preinserts: used to populate with data inserts that
- *              are a prerequisite for the actual file
- *              metadata insertion.
+ * @preupdate: used to populate with data updates that
+ *             are a prerequisite for the actual file
+ *             metadata insertion.
  * @metadata: used to populate with file metadata predicate/object(s).
  *
  * Extracts metadata from a file, and inserts it into @metadata.
@@ -112,13 +112,13 @@ G_BEGIN_DECLS
  * Whenever any of the inserted triples rely on entities that
  * should also be provided by this extractor (for example, album
  * or artist information from a song), such insertions should be
- * added to @preinserts, which is a #TrackerSparqlBuilder constructed.
+ * added to @preupdate, which is a #TrackerSparqlBuilder constructed.
  * through tracker_sparql_builder_new_update().
  *
  * Since: 0.8
  **/
 typedef void (*TrackerExtractMimeFunc) (const gchar          *uri,
-					TrackerSparqlBuilder *preinsert,
+					TrackerSparqlBuilder *preupdate,
                                         TrackerSparqlBuilder *metadata);
 
 /**
diff --git a/src/tracker-extract/tracker-extract-abw.c b/src/tracker-extract/tracker-extract-abw.c
index ad151b7..da95e51 100644
--- a/src/tracker-extract/tracker-extract-abw.c
+++ b/src/tracker-extract/tracker-extract-abw.c
@@ -46,7 +46,7 @@
 #define RDF_TYPE RDF_PREFIX "type"
 
 static void extract_abw (const gchar          *uri,
-			 TrackerSparqlBuilder *preinserts,
+                         TrackerSparqlBuilder *preupdate,
                          TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -56,7 +56,7 @@ static TrackerExtractData data[] = {
 
 static void
 extract_abw (const gchar          *uri,
-	     TrackerSparqlBuilder *preinserts,
+             TrackerSparqlBuilder *preupdate,
              TrackerSparqlBuilder *metadata)
 {
 	FILE *f;
diff --git a/src/tracker-extract/tracker-extract-gstreamer-helix.c b/src/tracker-extract/tracker-extract-gstreamer-helix.c
index bf8d2da..ad21d80 100644
--- a/src/tracker-extract/tracker-extract-gstreamer-helix.c
+++ b/src/tracker-extract/tracker-extract-gstreamer-helix.c
@@ -69,10 +69,10 @@ typedef struct {
 } MetadataExtractor;
 
 static void extract_gstreamer_helix_audio (const gchar          *uri,
-					   TrackerSparqlBuilder *preinserts,
+                                           TrackerSparqlBuilder *preupdate,
                                            TrackerSparqlBuilder *metadata);
 static void extract_gstreamer_helix_video (const gchar          *uri,
-					   TrackerSparqlBuilder *preinserts,
+                                           TrackerSparqlBuilder *preupdate,
                                            TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -767,7 +767,7 @@ poll_for_state_change (MetadataExtractor *extractor,
 
 static void
 tracker_extract_gstreamer_helix (const gchar *uri,
-				 TrackerSparqlBuilder *preinserts,
+                                 TrackerSparqlBuilder *preupdate,
                                  TrackerSparqlBuilder *metadata,
                                  ExtractMime    type)
 {
@@ -849,18 +849,18 @@ tracker_extract_gstreamer_helix (const gchar *uri,
 
 static void
 extract_gstreamer_helix_audio (const gchar          *uri,
-			       TrackerSparqlBuilder *preinserts,
+                               TrackerSparqlBuilder *preupdate,
 			       TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer_helix (uri, preinserts, metadata, EXTRACT_MIME_AUDIO);
+	tracker_extract_gstreamer_helix (uri, preupdate, metadata, EXTRACT_MIME_AUDIO);
 }
 
 static void
 extract_gstreamer_helix_video (const gchar          *uri,
-			       TrackerSparqlBuilder *preinserts,
+                               TrackerSparqlBuilder *preupdate,
 			       TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer_helix (uri, preinserts, metadata, EXTRACT_MIME_VIDEO);
+	tracker_extract_gstreamer_helix (uri, preupdate, metadata, EXTRACT_MIME_VIDEO);
 }
 
 TrackerExtractData *
diff --git a/src/tracker-extract/tracker-extract-gstreamer.c b/src/tracker-extract/tracker-extract-gstreamer.c
index 4055a67..599aae6 100644
--- a/src/tracker-extract/tracker-extract-gstreamer.c
+++ b/src/tracker-extract/tracker-extract-gstreamer.c
@@ -124,16 +124,16 @@ typedef struct {
 } MetadataExtractor;
 
 static void extract_gstreamer_audio (const gchar          *uri,
-				     TrackerSparqlBuilder *preinserts,
+                                     TrackerSparqlBuilder *preupdate,
                                      TrackerSparqlBuilder *metadata);
 static void extract_gstreamer_video (const gchar          *uri,
-				     TrackerSparqlBuilder *preinserts,
+                                     TrackerSparqlBuilder *preupdate,
                                      TrackerSparqlBuilder *metadata);
 static void extract_gstreamer_image (const gchar          *uri,
-				     TrackerSparqlBuilder *preinserts,
+                                     TrackerSparqlBuilder *preupdate,
                                      TrackerSparqlBuilder *metadata);
 static void extract_gstreamer_3gpp  (const gchar          *uri,
-				     TrackerSparqlBuilder *preinserts,
+                                     TrackerSparqlBuilder *preupdate,
                                      TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -449,7 +449,7 @@ extract_stream_metadata_decodebin (MetadataExtractor *extractor,
 static void
 extract_metadata (MetadataExtractor      *extractor,
                   const gchar            *uri,
-		  TrackerSparqlBuilder   *preinserts,
+                  TrackerSparqlBuilder   *preupdate,
                   TrackerSparqlBuilder   *metadata,
                   gchar                 **album,
                   gchar                 **scount)
@@ -494,11 +494,13 @@ extract_metadata (MetadataExtractor      *extractor,
 			if (s) {
 				performer_uri = tracker_uri_printf_escaped ("urn:artist:%s", s);
 
-				tracker_sparql_builder_subject_iri (preinserts, performer_uri);
-				tracker_sparql_builder_predicate (preinserts, "a");
-				tracker_sparql_builder_object (preinserts, "nmm:Artist");
-				tracker_sparql_builder_predicate (preinserts, "nmm:artistName");
-				tracker_sparql_builder_object_unvalidated (preinserts, s);
+				tracker_sparql_builder_insert_open (preupdate, NULL);
+				tracker_sparql_builder_subject_iri (preupdate, performer_uri);
+				tracker_sparql_builder_predicate (preupdate, "a");
+				tracker_sparql_builder_object (preupdate, "nmm:Artist");
+				tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
+				tracker_sparql_builder_object_unvalidated (preupdate, s);
+				tracker_sparql_builder_insert_close (preupdate);
 
 				g_free (s);
 			}
@@ -509,9 +511,11 @@ extract_metadata (MetadataExtractor      *extractor,
 			if (s) {
 				gchar *canonical_uri = tracker_uri_printf_escaped ("urn:artist:%s", s);
 
-				tracker_sparql_builder_subject_iri (preinserts, canonical_uri);
-				tracker_sparql_builder_predicate (preinserts, "a");
-				tracker_sparql_builder_object (preinserts, "nmm:Artist");
+				tracker_sparql_builder_insert_open (preupdate, NULL);
+
+				tracker_sparql_builder_subject_iri (preupdate, canonical_uri);
+				tracker_sparql_builder_predicate (preupdate, "a");
+				tracker_sparql_builder_object (preupdate, "nmm:Artist");
 
 				/*
 				if (extractor->mime == EXTRACT_MIME_AUDIO) {
@@ -520,8 +524,10 @@ extract_metadata (MetadataExtractor      *extractor,
 					tracker_sparql_builder_object (metadata, "nmm:director");
 				}
 				*/
-				tracker_sparql_builder_predicate (preinserts, "nmm:artistName");
-				tracker_sparql_builder_object_unvalidated (preinserts, s);
+				tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
+				tracker_sparql_builder_object_unvalidated (preupdate, s);
+
+				tracker_sparql_builder_insert_close (preupdate);
 
 				g_free (canonical_uri);
 				g_free (s);
@@ -536,14 +542,18 @@ extract_metadata (MetadataExtractor      *extractor,
 			if (s) {
 				album_uri = tracker_uri_printf_escaped ("urn:album:%s", s);
 
-				tracker_sparql_builder_subject_iri (preinserts, album_uri);
-				tracker_sparql_builder_predicate (preinserts, "a");
-				tracker_sparql_builder_object (preinserts, "nmm:MusicAlbum");
-				tracker_sparql_builder_predicate (preinserts, "nmm:albumTitle");
-				tracker_sparql_builder_object_unvalidated (preinserts, s);
-				add_uint_gst_tag (preinserts, album_uri, "nmm:albumTrackCount", extractor->tagcache, GST_TAG_TRACK_COUNT);
-				add_uint_gst_tag (preinserts, album_uri, "nmm:setNumber", extractor->tagcache, GST_TAG_ALBUM_VOLUME_NUMBER);
+				tracker_sparql_builder_insert_open (preupdate, NULL);
+
+				tracker_sparql_builder_subject_iri (preupdate, album_uri);
+				tracker_sparql_builder_predicate (preupdate, "a");
+				tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
+				tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
+				tracker_sparql_builder_object_unvalidated (preupdate, s);
+				add_uint_gst_tag (preupdate, album_uri, "nmm:albumTrackCount", extractor->tagcache, GST_TAG_TRACK_COUNT);
+				add_uint_gst_tag (preupdate, album_uri, "nmm:setNumber", extractor->tagcache, GST_TAG_ALBUM_VOLUME_NUMBER);
 				*album = s;
+
+				tracker_sparql_builder_insert_close (preupdate);
 			}
 		}
 
@@ -898,7 +908,7 @@ create_tagreadbin_pipeline (MetadataExtractor *extractor, const gchar *uri)
 
 static void
 tracker_extract_gstreamer (const gchar *uri,
-			   TrackerSparqlBuilder  *preinserts,
+                           TrackerSparqlBuilder  *preupdate,
                            TrackerSparqlBuilder  *metadata,
                            ExtractMime  type)
 {
@@ -969,7 +979,7 @@ tracker_extract_gstreamer (const gchar *uri,
 	album = NULL;
 	scount = NULL;
 
-	extract_metadata (extractor, uri, preinserts, metadata, &album, &scount);
+	extract_metadata (extractor, uri, preupdate, metadata, &album, &scount);
 
 	tracker_albumart_process (extractor->album_art_data,
 	                          extractor->album_art_size,
@@ -996,34 +1006,34 @@ tracker_extract_gstreamer (const gchar *uri,
 
 static void
 extract_gstreamer_audio (const gchar          *uri,
-			 TrackerSparqlBuilder *preinserts,
+                         TrackerSparqlBuilder *preupdate,
 			 TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer (uri, preinserts, metadata, EXTRACT_MIME_AUDIO);
+	tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_AUDIO);
 }
 
 static void
 extract_gstreamer_video (const gchar          *uri,
-			 TrackerSparqlBuilder *preinserts,
+                         TrackerSparqlBuilder *preupdate,
 			 TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer (uri, preinserts, metadata, EXTRACT_MIME_VIDEO);
+	tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_VIDEO);
 }
 
 static void
 extract_gstreamer_image (const gchar          *uri,
-			 TrackerSparqlBuilder *preinserts,
+                         TrackerSparqlBuilder *preupdate,
 			 TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer (uri, preinserts, metadata, EXTRACT_MIME_IMAGE);
+	tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_IMAGE);
 }
 
 static void
 extract_gstreamer_3gpp (const gchar          *uri,
-			TrackerSparqlBuilder *preinserts,
+                        TrackerSparqlBuilder *preupdate,
 			TrackerSparqlBuilder *metadata)
 {
-	tracker_extract_gstreamer (uri, preinserts, metadata, EXTRACT_MIME_3GPP);
+	tracker_extract_gstreamer (uri, preupdate, metadata, EXTRACT_MIME_3GPP);
 }
 
 TrackerExtractData *
diff --git a/src/tracker-extract/tracker-extract-html.c b/src/tracker-extract/tracker-extract-html.c
index 15578fe..10dbfed 100644
--- a/src/tracker-extract/tracker-extract-html.c
+++ b/src/tracker-extract/tracker-extract-html.c
@@ -43,7 +43,7 @@ typedef struct {
 } parser_data;
 
 static void extract_html (const gchar          *filename,
-			  TrackerSparqlBuilder *preinserts,
+                          TrackerSparqlBuilder *preupdate,
                           TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -198,7 +198,7 @@ parser_characters (void          *data,
 
 static void
 extract_html (const gchar          *uri,
-	      TrackerSparqlBuilder *preinserts,
+              TrackerSparqlBuilder *preupdate,
               TrackerSparqlBuilder *metadata)
 {
 	htmlDocPtr doc;
diff --git a/src/tracker-extract/tracker-extract-imagemagick.c b/src/tracker-extract/tracker-extract-imagemagick.c
index 23a9043..67d9182 100644
--- a/src/tracker-extract/tracker-extract-imagemagick.c
+++ b/src/tracker-extract/tracker-extract-imagemagick.c
@@ -42,7 +42,7 @@
 #define RDF_TYPE RDF_PREFIX "type"
 
 static void extract_imagemagick (const gchar          *uri,
-				 TrackerSparqlBuilder *preinserts,
+                                 TrackerSparqlBuilder *preupdate,
                                  TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -52,7 +52,7 @@ static TrackerExtractData data[] = {
 
 static void
 extract_imagemagick (const gchar          *uri,
-		     TrackerSparqlBuilder *preinserts,
+                     TrackerSparqlBuilder *preupdate,
                      TrackerSparqlBuilder *metadata)
 {
 	gchar *argv[6];
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 5e04a0d..1463cd1 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -93,7 +93,7 @@ typedef struct {
 } MergeData;
 
 static void extract_jpeg (const gchar          *filename,
-			  TrackerSparqlBuilder *preinserts,
+                          TrackerSparqlBuilder *preupdate,
                           TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -153,7 +153,7 @@ extract_jpeg_error_exit (j_common_ptr cinfo)
 
 static void
 extract_jpeg (const gchar          *uri,
-	      TrackerSparqlBuilder *preinserts,
+              TrackerSparqlBuilder *preupdate,
               TrackerSparqlBuilder *metadata)
 {
 	struct jpeg_decompress_struct cinfo;
@@ -525,12 +525,16 @@ extract_jpeg (const gchar          *uri,
 		if (md.creator) {
 
 			if (id.byline_title) {
-				tracker_sparql_builder_subject (preinserts, "_:affiliation_by_line");
-				tracker_sparql_builder_predicate (preinserts, "a");
-				tracker_sparql_builder_object (preinserts, "nco:Affiliation");
+				tracker_sparql_builder_insert_open (preupdate, NULL);
 
-				tracker_sparql_builder_predicate (preinserts, "nco:title");
-				tracker_sparql_builder_object_unvalidated (preinserts, id.byline_title);
+				tracker_sparql_builder_subject (preupdate, "_:affiliation_by_line");
+				tracker_sparql_builder_predicate (preupdate, "a");
+				tracker_sparql_builder_object (preupdate, "nco:Affiliation");
+
+				tracker_sparql_builder_predicate (preupdate, "nco:title");
+				tracker_sparql_builder_object_unvalidated (preupdate, id.byline_title);
+
+				tracker_sparql_builder_insert_close (preupdate);
 			}
 
 			tracker_sparql_builder_predicate (metadata, "nco:creator");
diff --git a/src/tracker-extract/tracker-extract-libxine.c b/src/tracker-extract/tracker-extract-libxine.c
index 5eb1c51..c2a7527 100644
--- a/src/tracker-extract/tracker-extract-libxine.c
+++ b/src/tracker-extract/tracker-extract-libxine.c
@@ -39,7 +39,7 @@
 
 static void
 tracker_extract_xine (const gchar          *uri,
-		      TrackerSparqlBuilder *preinserts,
+                      TrackerSparqlBuilder *preupdate,
 		      TrackerSparqlBuilder *metadata)
 {
 	xine_t            *xine_base;
@@ -110,9 +110,13 @@ tracker_extract_xine (const gchar          *uri,
 	if (author) {
 		gchar *canonical_uri = tracker_uri_printf_escaped ("urn:artist:%s", author);
 
-		tracker_sparql_builder_subject_iri (preinserts, canonical_uri);
-		tracker_sparql_builder_predicate (preinserts, "a");
-		tracker_sparql_builder_object (preinserts, "nmm:Artist");
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+
+		tracker_sparql_builder_subject_iri (preupdate, canonical_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nmm:Artist");
+
+		tracker_sparql_builder_insert_close (preupdate);
 
 		g_free (canonical_uri);
 	}
@@ -121,11 +125,15 @@ tracker_extract_xine (const gchar          *uri,
 	if (album) {
 		gchar *canonical_uri = tracker_uri_printf_escaped ("urn:album:%s", album);
 
-		tracker_sparql_builder_subject_iri (preinserts, canonical_uri);
-		tracker_sparql_builder_predicate (preinserts, "a");
-		tracker_sparql_builder_object (preinserts, "nmm:MusicAlbum");
-		tracker_sparql_builder_predicate (preinserts, "nmm:albumTitle");
-		tracker_sparql_builder_object_unvalidated (preinserts, album);
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+
+		tracker_sparql_builder_subject_iri (preupdate, canonical_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
+		tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
+		tracker_sparql_builder_object_unvalidated (preupdate, album);
+
+		tracker_sparql_builder_insert_close (preupdate);
 
 		g_free (canonical_uri);
 	}
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index aae185c..9935408 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -173,7 +173,7 @@ typedef struct {
 } MP3Data;
 
 static void extract_mp3 (const gchar           *uri,
-			 TrackerSparqlBuilder  *preinserts,
+                         TrackerSparqlBuilder  *preupdate,
                          TrackerSparqlBuilder  *metadata);
 
 enum {
@@ -1854,7 +1854,7 @@ parse_id3v2 (const gchar          *data,
 
 static void
 extract_mp3 (const gchar          *uri,
-	     TrackerSparqlBuilder *preinserts,
+             TrackerSparqlBuilder *preupdate,
              TrackerSparqlBuilder *metadata)
 {
 	gchar *filename;
@@ -1975,27 +1975,38 @@ extract_mp3 (const gchar          *uri,
 
 	if (md.performer) {
 		md.performer_uri = tracker_uri_printf_escaped ("urn:artist:%s", md.performer);
-		tracker_sparql_builder_subject_iri (preinserts, md.performer_uri);
-		tracker_sparql_builder_predicate (preinserts, "a");
-		tracker_sparql_builder_object (preinserts, "nmm:Artist");
-		tracker_sparql_builder_predicate (preinserts, "nmm:artistName");
-		tracker_sparql_builder_object_unvalidated (preinserts, md.performer);
+
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+
+		tracker_sparql_builder_subject_iri (preupdate, md.performer_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nmm:Artist");
+		tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
+		tracker_sparql_builder_object_unvalidated (preupdate, md.performer);
+
+		tracker_sparql_builder_insert_close (preupdate);
+
 		g_free (md.performer);
 	}
 
 	if (md.album) {
 		md.album_uri = tracker_uri_printf_escaped ("urn:album:%s", md.album);
-		tracker_sparql_builder_subject_iri (preinserts, md.album_uri);
-		tracker_sparql_builder_predicate (preinserts, "a");
-		tracker_sparql_builder_object (preinserts, "nmm:MusicAlbum");
-		tracker_sparql_builder_predicate (preinserts, "nmm:albumTitle");
-		tracker_sparql_builder_object_unvalidated (preinserts, md.album);
+
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+
+		tracker_sparql_builder_subject_iri (preupdate, md.album_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
+		tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
+		tracker_sparql_builder_object_unvalidated (preupdate, md.album);
 
 		if (md.track_count > 0) {
-			tracker_sparql_builder_predicate (preinserts, "nmm:albumTrackCount");
-			tracker_sparql_builder_object_int64 (preinserts, md.track_count);
+			tracker_sparql_builder_predicate (preupdate, "nmm:albumTrackCount");
+			tracker_sparql_builder_object_int64 (preupdate, md.track_count);
 		}
 
+		tracker_sparql_builder_insert_close (preupdate);
+
 		g_free (md.album);
 	}
 
diff --git a/src/tracker-extract/tracker-extract-mplayer.c b/src/tracker-extract/tracker-extract-mplayer.c
index d6e7514..09675af 100644
--- a/src/tracker-extract/tracker-extract-mplayer.c
+++ b/src/tracker-extract/tracker-extract-mplayer.c
@@ -41,6 +41,7 @@
 #define RDF_TYPE RDF_PREFIX "type"
 
 static void extract_mplayer (const gchar          *uri,
+                             TrackerSparqlBuilder *preupdate,
                              TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData extract_data[] = {
@@ -85,7 +86,7 @@ static const gchar *info_tags[][2] = {
 };
 
 typedef struct {
-	TrackerSparqlBuilder *preinserts;
+	TrackerSparqlBuilder *preupdate;
 	TrackerSparqlBuilder *metadata;
 	const gchar *uri;
 } ForeachCopyInfo;
@@ -100,12 +101,16 @@ copy_hash_table_entry (gpointer key,
 	if (g_strcmp0 (key, "nmm:performer") == 0) {
 		gchar *canonical_uri = tracker_uri_printf_escaped ("urn:artist:%s", value);
 
-		tracker_sparql_builder_subject_iri (info->preinserts, canonical_uri);
-		tracker_sparql_builder_predicate (info->preinserts, "a");
-		tracker_sparql_builder_object (info->preinserts, "nmm:Artist");
+		tracker_sparql_builder_insert_open (info->preupdate, NULL);
 
-		tracker_sparql_builder_predicate (info->preinserts, "nmm:artistName");
-		tracker_sparql_builder_object_unvalidated (info->preinserts, value);
+		tracker_sparql_builder_subject_iri (info->preupdate, canonical_uri);
+		tracker_sparql_builder_predicate (info->preupdate, "a");
+		tracker_sparql_builder_object (info->preupdate, "nmm:Artist");
+
+		tracker_sparql_builder_predicate (info->preupdate, "nmm:artistName");
+		tracker_sparql_builder_object_unvalidated (info->preupdate, value);
+
+		tracker_sparql_builder_insert_close (info->preupdate);
 
 		g_free (canonical_uri);
 	} else {
@@ -115,8 +120,9 @@ copy_hash_table_entry (gpointer key,
 }
 
 static void
-extract_mplayer (const gchar *uri,
-                 TrackerSparqlBuilder  *metadata)
+extract_mplayer (const gchar          *uri,
+                 TrackerSparqlBuilder *preupdate,
+                 TrackerSparqlBuilder *metadata)
 {
 	gchar *argv[10];
 	gchar *mplayer;
@@ -256,7 +262,7 @@ extract_mplayer (const gchar *uri,
 			tracker_sparql_builder_object (metadata, "nmm:Video");
 
 			if (tmp_metadata_video) {
-				ForeachCopyInfo info = { preinserts, metadata, uri };
+				ForeachCopyInfo info = { preupdate, metadata, uri };
 				g_hash_table_foreach (tmp_metadata_video,
 				                      copy_hash_table_entry,
 				                      &info);
@@ -275,7 +281,7 @@ extract_mplayer (const gchar *uri,
 			tracker_sparql_builder_object (metadata, "nfo:Audio");
 
 			if (tmp_metadata_audio) {
-				ForeachCopyInfo info = { preinserts, metadata, uri };
+				ForeachCopyInfo info = { preupdate, metadata, uri };
 				g_hash_table_foreach (tmp_metadata_audio,
 				                      copy_hash_table_entry,
 				                      &info);
diff --git a/src/tracker-extract/tracker-extract-msoffice.c b/src/tracker-extract/tracker-extract-msoffice.c
index b264966..e41d957 100644
--- a/src/tracker-extract/tracker-extract-msoffice.c
+++ b/src/tracker-extract/tracker-extract-msoffice.c
@@ -83,10 +83,10 @@
 #define SLIDELISTWITHTEXT_RECORD_TYPE           0x0FF0
 
 static void extract_msoffice   (const gchar          *uri,
-				TrackerSparqlBuilder *preinserts,
+                                TrackerSparqlBuilder *preupdate,
                                 TrackerSparqlBuilder *metadata);
 static void extract_powerpoint (const gchar          *uri,
-				TrackerSparqlBuilder *preinserts,
+                                TrackerSparqlBuilder *preupdate,
                                 TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -1003,7 +1003,7 @@ open_uri (const gchar *uri)
  */
 static void
 extract_msoffice (const gchar          *uri,
-		  TrackerSparqlBuilder *preinserts,
+                  TrackerSparqlBuilder *preupdate,
                   TrackerSparqlBuilder *metadata)
 {
 	GsfInfile *infile = open_uri(uri);
@@ -1021,7 +1021,7 @@ extract_msoffice (const gchar          *uri,
  */
 static void
 extract_powerpoint (const gchar          *uri,
-		    TrackerSparqlBuilder *preinserts,
+                    TrackerSparqlBuilder *preupdate,
                     TrackerSparqlBuilder *metadata)
 {
 	GsfInfile *infile = open_uri(uri);
diff --git a/src/tracker-extract/tracker-extract-oasis.c b/src/tracker-extract/tracker-extract-oasis.c
index 6ab92a8..9318771 100644
--- a/src/tracker-extract/tracker-extract-oasis.c
+++ b/src/tracker-extract/tracker-extract-oasis.c
@@ -71,7 +71,7 @@ static void text_handler          (GMarkupParseContext   *context,
                                    gpointer               user_data,
                                    GError               **error);
 static void extract_oasis         (const gchar           *filename,
-				   TrackerSparqlBuilder  *preinserts,
+                                   TrackerSparqlBuilder  *preupdate,
                                    TrackerSparqlBuilder  *metadata);
 
 static TrackerExtractData extract_data[] = {
@@ -106,7 +106,7 @@ extract_content (const gchar *path,
 
 static void
 extract_oasis (const gchar          *uri,
-	       TrackerSparqlBuilder *preinserts,
+               TrackerSparqlBuilder *preupdate,
                TrackerSparqlBuilder *metadata)
 {
 	gchar         *argv[5];
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 497d1b2..20ed497 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -45,7 +45,7 @@ typedef struct {
 } PDFData;
 
 static void extract_pdf (const gchar          *uri,
-			 TrackerSparqlBuilder *preinserts,
+                         TrackerSparqlBuilder *preupdate,
                          TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -167,7 +167,7 @@ write_pdf_data (PDFData               data,
 
 static void
 extract_pdf (const gchar          *uri,
-	     TrackerSparqlBuilder *preinserts,
+             TrackerSparqlBuilder *preupdate,
              TrackerSparqlBuilder *metadata)
 {
 	TrackerFTSConfig *fts_config;
diff --git a/src/tracker-extract/tracker-extract-playlist.c b/src/tracker-extract/tracker-extract-playlist.c
index bfc10fd..6f3df7b 100644
--- a/src/tracker-extract/tracker-extract-playlist.c
+++ b/src/tracker-extract/tracker-extract-playlist.c
@@ -60,7 +60,7 @@ typedef struct {
 } PlaylistMetadata;
 
 static void extract_playlist (const gchar          *uri,
-			      TrackerSparqlBuilder *preinserts,
+                              TrackerSparqlBuilder *preupdate,
                               TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData playlist_data[] = {
@@ -127,7 +127,7 @@ entry_parsed (TotemPlParser *parser, const gchar *to_uri, GHashTable *to_metadat
 
 static void
 extract_playlist (const gchar          *uri,
-		  TrackerSparqlBuilder *preinserts,
+                  TrackerSparqlBuilder *preupdate,
                   TrackerSparqlBuilder *metadata)
 {
 	TotemPlParser       *pl;
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index 18be0a6..e21a075 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -65,7 +65,7 @@ typedef struct {
 
 static gchar *rfc1123_to_iso8601_date (gchar                *rfc_date);
 static void   extract_png             (const gchar          *filename,
-				       TrackerSparqlBuilder *preinserts,
+                                       TrackerSparqlBuilder *preupdate,
                                        TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -443,7 +443,7 @@ read_metadata (png_structp png_ptr, png_infop info_ptr, const gchar *uri, Tracke
 
 static void
 extract_png (const gchar          *uri,
-	     TrackerSparqlBuilder *preinserts,
+             TrackerSparqlBuilder *preupdate,
              TrackerSparqlBuilder *metadata)
 {
 	goffset      size;
diff --git a/src/tracker-extract/tracker-extract-ps.c b/src/tracker-extract/tracker-extract-ps.c
index 3c79077..41e8335 100644
--- a/src/tracker-extract/tracker-extract-ps.c
+++ b/src/tracker-extract/tracker-extract-ps.c
@@ -56,11 +56,11 @@
 
 #ifdef USING_UNZIPPSFILES
 static void extract_ps_gz (const gchar          *uri,
-			   TrackerSparqlBuilder *preinserts,
+                           TrackerSparqlBuilder *preupdate,
                            TrackerSparqlBuilder *metadata);
 #endif
 static void extract_ps    (const gchar          *uri,
-			   TrackerSparqlBuilder *preinserts,
+                           TrackerSparqlBuilder *preupdate,
                            TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -207,7 +207,7 @@ date_to_iso8601 (const gchar *date)
 
 static void
 extract_ps (const gchar          *uri,
-	    TrackerSparqlBuilder *preinserts,
+            TrackerSparqlBuilder *preupdate,
             TrackerSparqlBuilder *metadata)
 {
 	FILE *f;
@@ -293,7 +293,7 @@ extract_ps (const gchar          *uri,
 
 static void
 extract_ps_gz (const gchar          *uri,
-	       TrackerSparqlBuilder *preinserts,
+               TrackerSparqlBuilder *preupdate,
                TrackerSparqlBuilder *metadata)
 {
 	FILE *fz, *f;
@@ -383,7 +383,7 @@ extract_ps_gz (const gchar          *uri,
 		fclose (f);
 	}
 
-	extract_ps (gunzipped, preinserts, metadata);
+	extract_ps (gunzipped, preupdate, metadata);
 	g_unlink (gunzipped);
 	g_free (filename);
 }
diff --git a/src/tracker-extract/tracker-extract-text.c b/src/tracker-extract/tracker-extract-text.c
index 6354741..6550ca5 100644
--- a/src/tracker-extract/tracker-extract-text.c
+++ b/src/tracker-extract/tracker-extract-text.c
@@ -31,7 +31,7 @@
 #define TEXT_CHECK_SIZE 65535    /* bytes */
 
 static void extract_text (const gchar          *uri,
-			  TrackerSparqlBuilder *preinserts,
+                          TrackerSparqlBuilder *preupdate,
                           TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -275,7 +275,7 @@ get_file_content (const gchar *uri)
 
 static void
 extract_text (const gchar          *uri,
-	      TrackerSparqlBuilder *preinserts,
+              TrackerSparqlBuilder *preupdate,
               TrackerSparqlBuilder *metadata)
 {
 	gchar *content;
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 12f8f30..ce95191 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -77,7 +77,7 @@ typedef struct {
 } TiffData;
 
 static void extract_tiff (const gchar          *filename,
-			  TrackerSparqlBuilder *preinserts,
+                          TrackerSparqlBuilder *preupdate,
                           TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData extract_data[] = {
@@ -271,7 +271,7 @@ insert_keywords (TrackerSparqlBuilder *metadata, const gchar *uri, gchar *keywor
 
 static void
 extract_tiff (const gchar          *uri,
-	      TrackerSparqlBuilder *preinserts,
+              TrackerSparqlBuilder *preupdate,
 	      TrackerSparqlBuilder *metadata)
 {
 	TIFF *image;
@@ -693,12 +693,16 @@ extract_tiff (const gchar          *uri,
 
 	if (merge_data.creator) {
 		if (iptc_data.byline_title) {
-			tracker_sparql_builder_subject (preinserts, "_:affiliation_by_line");
-			tracker_sparql_builder_predicate (preinserts, "a");
-			tracker_sparql_builder_object (preinserts, "nco:Affiliation");
+			tracker_sparql_builder_insert_open (preupdate, NULL);
 
-			tracker_sparql_builder_predicate (preinserts, "nco:title");
-			tracker_sparql_builder_object_unvalidated (preinserts, iptc_data.byline_title);
+			tracker_sparql_builder_subject (preupdate, "_:affiliation_by_line");
+			tracker_sparql_builder_predicate (preupdate, "a");
+			tracker_sparql_builder_object (preupdate, "nco:Affiliation");
+
+			tracker_sparql_builder_predicate (preupdate, "nco:title");
+			tracker_sparql_builder_object_unvalidated (preupdate, iptc_data.byline_title);
+
+			tracker_sparql_builder_insert_close (preupdate);
 		}
 
 		tracker_sparql_builder_predicate (metadata, "nco:creator");
diff --git a/src/tracker-extract/tracker-extract-totem.c b/src/tracker-extract/tracker-extract-totem.c
index 8251850..b685b60 100644
--- a/src/tracker-extract/tracker-extract-totem.c
+++ b/src/tracker-extract/tracker-extract-totem.c
@@ -54,7 +54,7 @@ static const gchar *tags[][2] = {
 };
 
 static void extract_totem (const gchar          *uri,
-			   TrackerSparqlBuilder *preinserts,
+                           TrackerSparqlBuilder *preupdate,
                            TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -76,7 +76,7 @@ metadata_write_foreach (gpointer key,
 
 static void
 extract_totem (const gchar          *uri,
-	       TrackerSparqlBuilder *preinserts,
+               TrackerSparqlBuilder *preupdate,
                TrackerSparqlBuilder *metadata)
 {
 	gchar *argv[3];
@@ -126,26 +126,34 @@ extract_totem (const gchar          *uri,
 		}
 
 		if (artist) {
-			tracker_sparql_builder_subject_iri (preinserts, artist_uri);
-			tracker_sparql_builder_predicate (preinserts, "a");
-			tracker_sparql_builder_object (preinserts, "nmm:Artist");
+			tracker_sparql_builder_insert_open (preupdate, NULL);
+
+			tracker_sparql_builder_subject_iri (preupdate, artist_uri);
+			tracker_sparql_builder_predicate (preupdate, "a");
+			tracker_sparql_builder_object (preupdate, "nmm:Artist");
 
 			if (has_video) {
-				tracker_sparql_builder_object (preinserts, "nmm:director");
+				tracker_sparql_builder_object (preupdate, "nmm:director");
 			} else {
-				tracker_sparql_builder_object (preinserts, "nmm:composer");
+				tracker_sparql_builder_object (preupdate, "nmm:composer");
 			}
 
-			tracker_sparql_builder_predicate (preinserts, "nmm:artistName");
-			tracker_sparql_builder_object_unvalidated (preinserts, artist);
+			tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
+			tracker_sparql_builder_object_unvalidated (preupdate, artist);
+
+			tracker_sparql_builder_insert_close (preupdate);
 		}
 
 		if (album) {
-			tracker_sparql_builder_subject_iri (preinserts, album_uri);
-			tracker_sparql_builder_predicate (preinserts, "a");
-			tracker_sparql_builder_object (preinserts, "nmm:MusicAlbum");
-			tracker_sparql_builder_predicate (preinserts, "nmm:albumTitle");
-			tracker_sparql_builder_object_unvalidated (preinserts, album);
+			tracker_sparql_builder_insert_open (preupdate, NULL);
+
+			tracker_sparql_builder_subject_iri (preupdate, album_uri);
+			tracker_sparql_builder_predicate (preupdate, "a");
+			tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
+			tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
+			tracker_sparql_builder_object_unvalidated (preupdate, album);
+
+			tracker_sparql_builder_insert_close (preupdate);
 		}
 
 		tracker_sparql_builder_predicate (metadata, "a");
diff --git a/src/tracker-extract/tracker-extract-vorbis.c b/src/tracker-extract/tracker-extract-vorbis.c
index 034233a..0eb44da 100644
--- a/src/tracker-extract/tracker-extract-vorbis.c
+++ b/src/tracker-extract/tracker-extract-vorbis.c
@@ -41,7 +41,7 @@
 #define RDF_PREFIX TRACKER_RDF_PREFIX
 
 static void extract_vorbis (const char            *uri,
-			    TrackerSparqlBuilder  *preinserts,
+                            TrackerSparqlBuilder  *preupdate,
                             TrackerSparqlBuilder  *metadata);
 
 
@@ -83,7 +83,7 @@ ogg_get_comment (vorbis_comment *vc,
 
 static void
 extract_vorbis (const char *uri,
-		TrackerSparqlBuilder *preinserts,
+                TrackerSparqlBuilder *preupdate,
                 TrackerSparqlBuilder *metadata)
 {
 	FILE           *f;
@@ -151,23 +151,31 @@ extract_vorbis (const char *uri,
 	if (merge_data.creator) {
 		artist_uri = tracker_uri_printf_escaped ("urn:artist:%s", merge_data.creator);
 
-		tracker_sparql_builder_subject_iri (preinserts, artist_uri);
-		tracker_sparql_builder_predicate (preinserts, "a");
-		tracker_sparql_builder_object (preinserts, "nmm:Artist");
-		tracker_sparql_builder_predicate (preinserts, "nmm:artistName");
-		tracker_sparql_builder_object_unvalidated (preinserts, merge_data.creator);
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+
+		tracker_sparql_builder_subject_iri (preupdate, artist_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nmm:Artist");
+		tracker_sparql_builder_predicate (preupdate, "nmm:artistName");
+		tracker_sparql_builder_object_unvalidated (preupdate, merge_data.creator);
+
+		tracker_sparql_builder_insert_close (preupdate);
+
 		g_free (merge_data.creator);
 	}
 
 	if (vorbis_data.album) {
 		album_uri = tracker_uri_printf_escaped ("urn:album:%s", vorbis_data.album);
 
-		tracker_sparql_builder_subject_iri (preinserts, album_uri);
-		tracker_sparql_builder_predicate (preinserts, "a");
-		tracker_sparql_builder_object (preinserts, "nmm:MusicAlbum");
-		tracker_sparql_builder_predicate (preinserts, "nmm:albumTitle");
-		tracker_sparql_builder_object_unvalidated (preinserts, vorbis_data.album);
+		tracker_sparql_builder_insert_open (preupdate, NULL);
+
+		tracker_sparql_builder_subject_iri (preupdate, album_uri);
+		tracker_sparql_builder_predicate (preupdate, "a");
+		tracker_sparql_builder_object (preupdate, "nmm:MusicAlbum");
+		tracker_sparql_builder_predicate (preupdate, "nmm:albumTitle");
+		tracker_sparql_builder_object_unvalidated (preupdate, vorbis_data.album);
 
+		tracker_sparql_builder_insert_close (preupdate);
 
 		if (vorbis_data.trackcount) {
 			tracker_sparql_builder_predicate (metadata, "nmm:albumTrackCount");
diff --git a/src/tracker-extract/tracker-extract-xmp.c b/src/tracker-extract/tracker-extract-xmp.c
index 6f7759b..c4ee88e 100644
--- a/src/tracker-extract/tracker-extract-xmp.c
+++ b/src/tracker-extract/tracker-extract-xmp.c
@@ -31,7 +31,7 @@
 #include <libtracker-extract/tracker-xmp.h>
 
 static void extract_xmp (const gchar          *filename,
-			 TrackerSparqlBuilder *preinserts,
+                         TrackerSparqlBuilder *preupdate,
                          TrackerSparqlBuilder *metadata);
 
 static TrackerExtractData data[] = {
@@ -137,7 +137,7 @@ find_orig_uri (const gchar *xmp_filename)
 
 static void
 extract_xmp (const gchar          *uri,
-	     TrackerSparqlBuilder *preinserts,
+             TrackerSparqlBuilder *preupdate,
              TrackerSparqlBuilder *metadata)
 {
 	gchar *contents;
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 45ab5f9..766f1df 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -213,21 +213,20 @@ get_file_metadata (TrackerExtract         *extract,
                    DBusGMethodInvocation  *context,
                    const gchar            *uri,
                    const gchar            *mime,
-		   TrackerSparqlBuilder  **preinserts_out,
+		   TrackerSparqlBuilder  **preupdate_out,
 		   TrackerSparqlBuilder  **statements_out)
 {
 	TrackerExtractPrivate *priv;
-	TrackerSparqlBuilder *statements, *preinserts;
+	TrackerSparqlBuilder *statements, *preupdate;
 	gchar *mime_used = NULL;
 	gchar *content_type = NULL;
 
 	priv = TRACKER_EXTRACT_GET_PRIVATE (extract);
 
 	/* Create sparql builders to send back */
-	preinserts = tracker_sparql_builder_new_update ();
+	preupdate = tracker_sparql_builder_new_update ();
 	statements = tracker_sparql_builder_new_embedded_insert ();
 
-	tracker_sparql_builder_insert_open (preinserts, NULL);
 	tracker_sparql_builder_subject (statements, "_:foo");
 
 #ifdef HAVE_LIBSTREAMANALYZER
@@ -288,7 +287,7 @@ get_file_metadata (TrackerExtract         *extract,
 
 			g_object_unref (file);
 			g_object_unref (statements);
-			g_object_unref (preinserts);
+			g_object_unref (preupdate);
 
 			return FALSE;
 		}
@@ -326,7 +325,7 @@ get_file_metadata (TrackerExtract         *extract,
 				                              "  Extracting with module:'%s'",
 				                              g_module_name ((GModule*) mdata.module));
 
-				(*edata->func) (uri, preinserts, statements);
+				(*edata->func) (uri, preupdate, statements);
 
 				items = tracker_sparql_builder_get_length (statements);
 
@@ -338,12 +337,11 @@ get_file_metadata (TrackerExtract         *extract,
 					continue;
 				}
 
-				tracker_sparql_builder_insert_close (preinserts);
 				tracker_sparql_builder_insert_close (statements);
 
 				g_free (mime_used);
 
-				*preinserts_out = preinserts;
+				*preupdate_out = preupdate;
 				*statements_out = statements;
 
 				return TRUE;
@@ -365,7 +363,7 @@ get_file_metadata (TrackerExtract         *extract,
 				                              "  Extracting with module:'%s'",
 				                              g_module_name ((GModule*) mdata.module));
 
-				(*edata->func) (uri, preinserts, statements);
+				(*edata->func) (uri, preupdate, statements);
 
 				items = tracker_sparql_builder_get_length (statements);
 
@@ -377,12 +375,11 @@ get_file_metadata (TrackerExtract         *extract,
 					continue;
 				}
 
-				tracker_sparql_builder_insert_close (preinserts);
 				tracker_sparql_builder_insert_close (statements);
 
 				g_free (mime_used);
 
-				*preinserts_out = preinserts;
+				*preupdate_out = preupdate;
 				*statements_out = statements;
 
 				return TRUE;
@@ -400,13 +397,11 @@ get_file_metadata (TrackerExtract         *extract,
 		                              "  No mime available, not extracting data");
 	}
 
-	tracker_sparql_builder_insert_close (preinserts);
-
 	if (tracker_sparql_builder_get_length (statements) > 0) {
 		tracker_sparql_builder_insert_close (statements);
 	}
 
-	*preinserts_out = preinserts;
+	*preupdate_out = preupdate;
 	*statements_out = statements;
 
 	return TRUE;
@@ -418,7 +413,7 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
                                          const gchar    *mime)
 {
 	guint request_id;
-	TrackerSparqlBuilder *statements, *preinserts;
+	TrackerSparqlBuilder *statements, *preupdate;
 
 	request_id = tracker_dbus_get_next_request_id ();
 
@@ -435,9 +430,9 @@ tracker_extract_get_metadata_by_cmdline (TrackerExtract *object,
 
 	if (get_file_metadata (object, request_id,
 			       NULL, uri, mime,
-			       &preinserts, &statements)) {
+			       &preupdate, &statements)) {
 		tracker_dbus_request_info (request_id, NULL, "%s",
-					   tracker_sparql_builder_get_result (preinserts));
+					   tracker_sparql_builder_get_result (preupdate));
 		tracker_dbus_request_info (request_id, NULL, "%s",
 					   tracker_sparql_builder_get_result (statements));
 		g_object_unref (statements);
@@ -480,7 +475,7 @@ tracker_extract_get_metadata (TrackerExtract         *object,
 {
 	guint request_id;
 	TrackerExtractPrivate *priv;
-	TrackerSparqlBuilder *sparql, *preinserts;
+	TrackerSparqlBuilder *sparql, *preupdate;
 	gboolean extracted = FALSE;
 
 	request_id = tracker_dbus_get_next_request_id ();
@@ -505,21 +500,21 @@ tracker_extract_get_metadata (TrackerExtract         *object,
 		alarm (MAX_EXTRACT_TIME);
 	}
 
-	extracted = get_file_metadata (object, request_id, context, uri, mime, &preinserts, &sparql);
+	extracted = get_file_metadata (object, request_id, context, uri, mime, &preupdate, &sparql);
 
 	if (extracted) {
 		tracker_dbus_request_success (request_id, context);
 
 		if (tracker_sparql_builder_get_length (sparql) > 0) {
-			const gchar *preinserts_str = NULL;
+			const gchar *preupdate_str = NULL;
 
-			if (tracker_sparql_builder_get_length (preinserts) > 0) {
-				preinserts_str = tracker_sparql_builder_get_result (preinserts);
+			if (tracker_sparql_builder_get_length (preupdate) > 0) {
+				preupdate_str = tracker_sparql_builder_get_result (preupdate);
 			}
 
 			dbus_g_method_return (context,
-					      (preinserts_str) ? preinserts_str : "",
-					      tracker_sparql_builder_get_result (sparql));
+			                      (preupdate_str) ? preupdate_str : "",
+			                      tracker_sparql_builder_get_result (sparql));
 		} else {
 			dbus_g_method_return (context, "", "");
 		}



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