[tracker/tracker-0.10] libtracker-extract: new function to generate sparql of the region struct
- From: Martyn James Russell <mr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/tracker-0.10] libtracker-extract: new function to generate sparql of the region struct
- Date: Thu, 8 Sep 2011 12:52:40 +0000 (UTC)
commit 5ae70a3c14ebdde06be54c32caf5a54e7c335f04
Author: Ivan Frade <ivan frade gmail com>
Date: Mon Aug 1 17:14:39 2011 +0300
libtracker-extract: new function to generate sparql of the region struct
Input arguments "uri" and "where" are not needed, but I keep the there
for consistency with the other sparql-generation function.
src/libtracker-extract/tracker-xmp.c | 24 +++++++++++++++++++++---
src/libtracker-extract/tracker-xmp.h | 21 +++++++++++++--------
tests/libtracker-extract/tracker-test-xmp.c | 9 ++++-----
3 files changed, 38 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index 22d0bff..655f700 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -832,8 +832,6 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
TrackerXmpData *data)
{
GPtrArray *keywords;
- GList *iter;
- TrackerXmpRegion *region;
guint i;
GString *where = NULL;
@@ -1140,6 +1138,27 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
g_string_free (where, TRUE);
}
+ if (data->regions) {
+ tracker_xmp_apply_regions (preupdate, metadata, where, uri, data);
+ }
+
+ return TRUE;
+}
+
+void
+tracker_xmp_apply_regions (TrackerSparqlBuilder *preupdate,
+ TrackerSparqlBuilder *metadata,
+ GString *where,
+ const gchar *uri,
+ TrackerXmpData *data)
+{
+ GList *iter;
+ TrackerXmpRegion *region;
+
+ if (!data->regions) {
+ return;
+ }
+
for (iter = data->regions; iter != NULL; iter = iter->next) {
gchar *reguuid;
reguuid = tracker_sparql_get_uuid_urn ();
@@ -1209,5 +1228,4 @@ tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
g_free (reguuid);
}
- return TRUE;
}
diff --git a/src/libtracker-extract/tracker-xmp.h b/src/libtracker-extract/tracker-xmp.h
index 80d477f..23dcb9a 100644
--- a/src/libtracker-extract/tracker-xmp.h
+++ b/src/libtracker-extract/tracker-xmp.h
@@ -105,14 +105,19 @@ typedef struct {
gchar *link_uri;
} TrackerXmpRegion;
-TrackerXmpData * tracker_xmp_new (const gchar *buffer,
- gsize len,
- const gchar *uri);
-void tracker_xmp_free (TrackerXmpData *data);
-gboolean tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
- TrackerSparqlBuilder *metadata,
- const gchar *uri,
- TrackerXmpData *data);
+TrackerXmpData *tracker_xmp_new (const gchar *buffer,
+ gsize len,
+ const gchar *uri);
+void tracker_xmp_free (TrackerXmpData *data);
+gboolean tracker_xmp_apply (TrackerSparqlBuilder *preupdate,
+ TrackerSparqlBuilder *metadata,
+ const gchar *uri,
+ TrackerXmpData *data);
+void tracker_xmp_apply_regions (TrackerSparqlBuilder *preupdate,
+ TrackerSparqlBuilder *metadata,
+ GString *where,
+ const gchar *uri,
+ TrackerXmpData *data);
#ifndef TRACKER_DISABLE_DEPRECATED
diff --git a/tests/libtracker-extract/tracker-test-xmp.c b/tests/libtracker-extract/tracker-test-xmp.c
index 8e37d2d..d4aaac0 100644
--- a/tests/libtracker-extract/tracker-test-xmp.c
+++ b/tests/libtracker-extract/tracker-test-xmp.c
@@ -343,16 +343,14 @@ debug_print_sparql (TrackerXmpData *data)
{
/* To print the sparql */
TrackerSparqlBuilder *metadata, *preupdate;
- GString *where;
metadata = tracker_sparql_builder_new_update ();
preupdate = tracker_sparql_builder_new_update ();
- where = g_string_new ("");
tracker_sparql_builder_insert_open (metadata, NULL);
tracker_sparql_builder_subject_iri (metadata, "urn:uuid:test");
- tracker_xmp_apply (preupdate, metadata, where, "urn:uuid:test", data);
+ tracker_xmp_apply (preupdate, metadata, "urn:uuid:test", data);
tracker_sparql_builder_insert_close (metadata);
@@ -361,7 +359,6 @@ debug_print_sparql (TrackerXmpData *data)
g_object_unref (metadata);
g_object_unref (preupdate);
- g_string_free (where, TRUE);
}
static void
@@ -400,7 +397,9 @@ test_xmp_regions (void)
g_assert_cmpstr (region->type, ==, "Face");
g_assert_cmpstr (region->title, ==, "John Doe");
- //debug_print_sparql (data);
+ if (0) {
+ debug_print_sparql (data);
+ }
tracker_xmp_free (data);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]