[tracker: 3/3] tracker-client: Refactored away tracker-statement-list



commit 0294351b26829ca3e41667935dbb462695d2dc90
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Feb 12 12:50:24 2010 +0100

    tracker-client: Refactored away tracker-statement-list

 src/libtracker-client/Makefile.am                  |    3 -
 src/libtracker-client/tracker-statement-list.h     |   58 ----------
 src/libtracker-common/tracker-statement-list.c     |  114 --------------------
 .../tracker-extract-gstreamer-helix.c              |   25 +++--
 src/tracker-extract/tracker-extract.c              |    4 +-
 src/tracker-extract/tracker-topanalyzer.cpp        |   61 +++++------
 6 files changed, 47 insertions(+), 218 deletions(-)
---
diff --git a/src/libtracker-client/Makefile.am b/src/libtracker-client/Makefile.am
index 1392d5d..d9ac612 100644
--- a/src/libtracker-client/Makefile.am
+++ b/src/libtracker-client/Makefile.am
@@ -37,9 +37,6 @@ libtracker_clientinclude_HEADERS = 			\
 	tracker.h					\
 	tracker-sparql-builder.h
 
-noinst_HEADERS =					\
-	tracker-statement-list.h
-
 # Generate DBus files from XML data.
 dbus_sources = 						\
 	tracker-resources-glue.h			\
diff --git a/src/tracker-extract/tracker-extract-gstreamer-helix.c b/src/tracker-extract/tracker-extract-gstreamer-helix.c
index ad21d80..3bd99d3 100644
--- a/src/tracker-extract/tracker-extract-gstreamer-helix.c
+++ b/src/tracker-extract/tracker-extract-gstreamer-helix.c
@@ -372,7 +372,9 @@ add_int64_info (TrackerSparqlBuilder *metadata,
                 const gchar        *key,
                 gint64      info)
 {
-	tracker_statement_list_insert_with_int64 (metadata, uri, key, info);
+	tracker_sparql_builder_subject_iri (metadata, uri);
+	tracker_sparql_builder_predicate_iri (metadata, key);
+	tracker_sparql_builder_object_int64 (metadata, info);
 }
 
 static void
@@ -381,7 +383,9 @@ add_uint_info (TrackerSparqlBuilder *metadata,
                gchar      *key,
                guint       info)
 {
-	tracker_statement_list_insert_with_int (metadata, uri, key, info);
+	tracker_sparql_builder_subject_iri (metadata, uri);
+	tracker_sparql_builder_predicate_iri (metadata, key);
+	tracker_sparql_builder_object_int64 (metadata, info);
 }
 
 static void
@@ -399,7 +403,9 @@ add_string_gst_tag (TrackerSparqlBuilder        *metadata,
 
 	if (s) {
 		if (ret && s[0] != '\0') {
-			tracker_statement_list_insert (metadata, uri, key, s);
+			tracker_sparql_builder_subject_iri (metadata, uri);
+			tracker_sparql_builder_predicate_iri (metadata, key);
+			tracker_sparql_builder_object_unvalidated (metadata, s);
 		}
 
 		g_free (s);
@@ -419,7 +425,9 @@ add_uint_gst_tag (TrackerSparqlBuilder  *metadata,
 	ret = gst_tag_list_get_uint (tag_list, tag, &n);
 
 	if (ret) {
-		tracker_statement_list_insert_with_int (metadata, uri, key, n);
+		tracker_sparql_builder_subject_iri (metadata, uri);
+		tracker_sparql_builder_predicate_iri (metadata, key);
+		tracker_sparql_builder_object_int64 (metadata, n);
 	}
 }
 
@@ -436,7 +444,9 @@ add_double_gst_tag (TrackerSparqlBuilder        *metadata,
 	ret = gst_tag_list_get_double (tag_list, tag, &n);
 
 	if (ret) {
-		tracker_statement_list_insert_with_double (metadata, uri, key, n);
+		tracker_sparql_builder_subject_iri (metadata, uri);
+		tracker_sparql_builder_predicate_iri (metadata, key);
+		tracker_sparql_builder_object_double (metadata, n);
 	}
 }
 
@@ -457,8 +467,9 @@ add_year_of_gdate_gst_tag (TrackerSparqlBuilder  *metadata,
 		gchar buf[10];
 
 		if (g_date_strftime (buf, 10, "%Y", date)) {
-			tracker_statement_list_insert (metadata, uri,
-			                               key, buf);
+			tracker_sparql_builder_subject_iri (metadata, uri);
+			tracker_sparql_builder_predicate_iri (metadata, key);
+			tracker_sparql_builder_object_unvalidated (metadata, buf);
 		}
 	}
 
diff --git a/src/tracker-extract/tracker-extract.c b/src/tracker-extract/tracker-extract.c
index 3aa29c1..2dc5fe2 100644
--- a/src/tracker-extract/tracker-extract.c
+++ b/src/tracker-extract/tracker-extract.c
@@ -236,7 +236,7 @@ get_file_metadata (TrackerExtract         *extract,
 
 #ifdef HAVE_LIBSTREAMANALYZER
 	if (!priv->force_internal_extractors) {
-		tracker_dbus_request_comment (request_id,
+		tracker_dbus_request_comment (request_id, context,
 		                              "  Extracting with libstreamanalyzer...");
 
 		tracker_topanalyzer_extract (uri, statements, &content_type);
@@ -250,7 +250,7 @@ get_file_metadata (TrackerExtract         *extract,
 			return TRUE;
 		}
 	} else {
-		tracker_dbus_request_comment (request_id,
+		tracker_dbus_request_comment (request_id, context,
 		                              "  Extracting with internal extractors ONLY...");
 	}
 #endif /* HAVE_LIBSTREAMANALYZER */
diff --git a/src/tracker-extract/tracker-topanalyzer.cpp b/src/tracker-extract/tracker-topanalyzer.cpp
index 0f673c8..1bf129e 100644
--- a/src/tracker-extract/tracker-topanalyzer.cpp
+++ b/src/tracker-extract/tracker-topanalyzer.cpp
@@ -40,8 +40,6 @@
 #include <libtracker-common/tracker-type-utils.h>
 #include <libtracker-common/tracker-os-dependant.h>
 #include <libtracker-common/tracker-sparql-builder.h>
-#include <libtracker-common/tracker-statement-list.h>
-
 #include <libtracker-common/tracker-ontology.h>
 
 #include <libtracker-extract/tracker-utils.h>
@@ -139,9 +137,10 @@ namespace Tracker {
 	                                        const char* text,
 	                                        int32_t length)
 	{
-		tracker_statement_list_insert (metadata, idx->path().c_str(),
-		                               NIE_PREFIX "plainTextContent",
-		                               text);
+
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, NIE_PREFIX "plainTextContent");
+		tracker_sparql_builder_object_unvalidated (metadata, text);
 	}
 
 	const gchar* Tracker::TripleCollector::predicateMapping (const std::string &key)
@@ -214,7 +213,7 @@ namespace Tracker {
 	}
 
 	/* The methods below basically just convert the C++ world to the C world
-	 * of tracker_statement_list_insert. Nothing magical about it. */
+	 * of TrackerSparqlBuilder. Nothing magical about it. */
 
 	void Tracker::TripleCollector::addValue (const AnalysisResult* idx,
 	                                         const RegisteredField* field,
@@ -231,10 +230,9 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert (metadata,
-		                               idx->path().c_str(),
-		                               predicate,
-		                               value.c_str());
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate);
+		tracker_sparql_builder_object_unvalidated (metadata, value.c_str());
 	}
 
 	void Tracker::TripleCollector::addValue (const AnalysisResult* idx,
@@ -248,10 +246,9 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert (metadata,
-		                               idx->path().c_str(),
-		                               predicate,
-		                               (const gchar*) data);
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate);
+		tracker_sparql_builder_object_unvalidated (metadata, (const gchar*) data);
 	}
 
 	void Tracker::TripleCollector::addValue (const AnalysisResult* idx,
@@ -264,10 +261,10 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert_with_int (metadata,
-		                                        idx->path().c_str(),
-		                                        predicate,
-		                                        (gint) value);
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate);
+		tracker_sparql_builder_object_int64 (metadata, value);
+
 	}
 
 	void Tracker::TripleCollector::addValue (const AnalysisResult* idx,
@@ -280,10 +277,9 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert_with_int (metadata,
-		                                        idx->path().c_str(),
-		                                        predicate,
-		                                        (gint) value);
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate);
+		tracker_sparql_builder_object_int64 (metadata, value);
 	}
 
 	void Tracker::TripleCollector::addValue (const AnalysisResult* idx,
@@ -296,10 +292,9 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert_with_double (metadata,
-		                                           idx->path().c_str(),
-		                                           predicate,
-		                                           (gdouble) value);
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate);
+		tracker_sparql_builder_object_double (metadata, value);
 	}
 
 	void Tracker::TripleCollector::addTriplet (const std::string& subject,
@@ -312,10 +307,9 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert (metadata,
-		                               subject.c_str(),
-		                               predicate_str,
-		                               object.c_str());
+		tracker_sparql_builder_subject_iri (metadata, subject.c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate_str);
+		tracker_sparql_builder_object_unvalidated (metadata, object.c_str());
 	}
 
 	void Tracker::TripleCollector::addValue (const AnalysisResult* idx,
@@ -334,10 +328,9 @@ namespace Tracker {
 			return;
 		}
 
-		tracker_statement_list_insert (metadata,
-		                               idx->path().c_str(),
-		                               predicate,
-		                               value.c_str());
+		tracker_sparql_builder_subject_iri (metadata, idx->path().c_str());
+		tracker_sparql_builder_predicate_iri (metadata, predicate);
+		tracker_sparql_builder_object_unvalidated (metadata, value.c_str());
 	}
 
 	void Tracker::TripleCollector::finishAnalysis (const AnalysisResult*) { }



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