[tracker] tracker-extract, libtracker-extract: Bugfix NB#170142: avoid duplicate tags
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract, libtracker-extract: Bugfix NB#170142: avoid duplicate tags
- Date: Wed, 26 May 2010 10:30:42 +0000 (UTC)
commit 39d7aa2ac913a10195a3f2ceacfa54a9be930247
Author: Philip Van Hoof <philip codeminded be>
Date: Wed May 26 12:28:48 2010 +0200
tracker-extract, libtracker-extract: Bugfix NB#170142: avoid duplicate tags
src/libtracker-extract/tracker-utils.c | 54 +++++++++++++++++++++
src/libtracker-extract/tracker-utils.h | 2 +
src/libtracker-extract/tracker-xmp.c | 64 ++++++++++---------------
src/tracker-extract/tracker-extract-gif.c | 65 +++++++++----------------
src/tracker-extract/tracker-extract-jpeg.c | 66 ++++++++++----------------
src/tracker-extract/tracker-extract-pdf.cpp | 69 ++++++++++----------------
src/tracker-extract/tracker-extract-png.c | 63 +++++++++---------------
src/tracker-extract/tracker-extract-tiff.c | 65 ++++++++++---------------
8 files changed, 204 insertions(+), 244 deletions(-)
---
diff --git a/src/libtracker-extract/tracker-utils.c b/src/libtracker-extract/tracker-utils.c
index fb6fbb3..ebc87ee 100644
--- a/src/libtracker-extract/tracker-utils.c
+++ b/src/libtracker-extract/tracker-utils.c
@@ -947,3 +947,57 @@ tracker_getline (gchar **lineptr,
}
#endif /* HAVE_GETLINE */
+
+void
+tracker_keywords_parse (GPtrArray *store,
+ const gchar *keywords)
+{
+ gchar *keywords_d = g_strdup (keywords);
+ char *saveptr, *p;
+ size_t len;
+
+ p = keywords_d;
+ keywords_d = strchr (keywords_d, '"');
+
+ if (keywords_d) {
+ keywords_d++;
+ } else {
+ keywords_d = p;
+ }
+
+ len = strlen (keywords_d);
+ if (keywords_d[len - 1] == '"') {
+ keywords_d[len - 1] = '\0';
+ }
+
+ for (p = strtok_r (keywords_d, ",;", &saveptr); p;
+ p = strtok_r (NULL, ",;", &saveptr)) {
+ guint i;
+ gboolean found = FALSE;
+ gchar *p_do = g_strdup (p);
+ gchar *p_dup = p_do;
+ guint len = strlen (p_dup);
+
+ if (*p_dup == ' ')
+ p_dup++;
+
+ if (p_dup[len-1] == ' ')
+ p_dup[len-1] = '\0';
+
+ for (i = 0; i < store->len; i++) {
+ const gchar *earlier = g_ptr_array_index (store, i);
+ if (g_strcmp0 (earlier, p_dup) == 0) {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found) {
+ g_ptr_array_add (store, g_strdup (p_dup));
+ }
+
+ g_free (p_do);
+ }
+
+ g_free (keywords_d);
+}
diff --git a/src/libtracker-extract/tracker-utils.h b/src/libtracker-extract/tracker-utils.h
index 5f6aadd..28d3337 100644
--- a/src/libtracker-extract/tracker-utils.h
+++ b/src/libtracker-extract/tracker-utils.h
@@ -54,6 +54,8 @@ gchar* tracker_merge_const (const gchar *delimiter,
gssize tracker_getline (gchar **lineptr,
gsize *n,
FILE *stream);
+void tracker_keywords_parse (GPtrArray *store,
+ const gchar *keywords);
G_END_DECLS
diff --git a/src/libtracker-extract/tracker-xmp.c b/src/libtracker-extract/tracker-xmp.c
index 925b9c3..d8b12a0 100644
--- a/src/libtracker-extract/tracker-xmp.c
+++ b/src/libtracker-extract/tracker-xmp.c
@@ -641,42 +641,6 @@ tracker_xmp_free (TrackerXmpData *data)
g_free (data);
}
-static void
-insert_keywords (TrackerSparqlBuilder *metadata,
- const gchar *uri,
- gchar *keywords)
-{
- char *lasts, *keyw;
- size_t len;
-
- keyw = keywords;
- keywords = strchr (keywords, '"');
- if (keywords) {
- keywords++;
- } else {
- keywords = keyw;
- }
-
- len = strlen (keywords);
- if (keywords[len - 1] == '"')
- keywords[len - 1] = '\0';
-
- for (keyw = strtok_r (keywords, ",;", &lasts);
- keyw;
- keyw = strtok_r (NULL, ",;", &lasts)) {
- tracker_sparql_builder_predicate (metadata, "nao:hasTag");
-
- tracker_sparql_builder_object_blank_open (metadata);
- tracker_sparql_builder_predicate (metadata, "a");
- tracker_sparql_builder_object (metadata, "nao:Tag");
-
- tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
- tracker_sparql_builder_object_unvalidated (metadata, keyw);
-
- tracker_sparql_builder_object_blank_close (metadata);
- }
-}
-
/**
* tracker_xmp_apply:
* @metadata: the metadata object to apply XMP data to.
@@ -695,21 +659,43 @@ tracker_xmp_apply (TrackerSparqlBuilder *metadata,
const gchar *uri,
TrackerXmpData *data)
{
+ GPtrArray *keywords;
+ guint i;
+
g_return_val_if_fail (TRACKER_IS_SPARQL_BUILDER (metadata), FALSE);
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (data != NULL, FALSE);
+ keywords = g_ptr_array_new ();
+
if (data->keywords) {
- insert_keywords (metadata, uri, data->keywords);
+ tracker_keywords_parse (keywords, data->keywords);
}
if (data->subject) {
- insert_keywords (metadata, uri, data->subject);
+ tracker_keywords_parse (keywords, data->subject);
}
if (data->pdf_keywords) {
- insert_keywords (metadata, uri, data->pdf_keywords);
+ tracker_keywords_parse (keywords, data->pdf_keywords);
+ }
+
+ for (i = 0; i < keywords->len; i++) {
+ gchar *p;
+
+ p = g_ptr_array_index (keywords, i);
+
+ tracker_sparql_builder_predicate (metadata, "nao:hasTag");
+
+ tracker_sparql_builder_object_blank_open (metadata);
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nao:Tag");
+ tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
+ tracker_sparql_builder_object_unvalidated (metadata, p);
+ tracker_sparql_builder_object_blank_close (metadata);
+ g_free (p);
}
+ g_ptr_array_free (keywords, TRUE);
if (data->publisher) {
tracker_sparql_builder_predicate (metadata, "nco:publisher");
diff --git a/src/tracker-extract/tracker-extract-gif.c b/src/tracker-extract/tracker-extract-gif.c
index f17c11c..cf886a7 100644
--- a/src/tracker-extract/tracker-extract-gif.c
+++ b/src/tracker-extract/tracker-extract-gif.c
@@ -78,43 +78,6 @@ ext_block_append(ExtBlock *extBlock,
}
static void
-insert_keywords (TrackerSparqlBuilder *metadata,
- const gchar *uri,
- gchar *keywords)
-{
- char *lasts, *keyw;
- size_t len;
-
- keyw = keywords;
- keywords = strchr (keywords, '"');
- if (keywords) {
- keywords++;
- } else {
- keywords = keyw;
- }
-
- len = strlen (keywords);
- if (keywords[len - 1] == '"') {
- keywords[len - 1] = '\0';
- }
-
- for (keyw = strtok_r (keywords, ",;", &lasts);
- keyw;
- keyw = strtok_r (NULL, ",;", &lasts)) {
- tracker_sparql_builder_predicate (metadata, "nao:hasTag");
-
- tracker_sparql_builder_object_blank_open (metadata);
- tracker_sparql_builder_predicate (metadata, "a");
- tracker_sparql_builder_object (metadata, "nao:Tag");
-
- tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
- tracker_sparql_builder_object_unvalidated (metadata, keyw);
-
- tracker_sparql_builder_object_blank_close (metadata);
- }
-}
-
-static void
read_metadata (TrackerSparqlBuilder *preupdate,
TrackerSparqlBuilder *metadata,
GifFileType *gifFile,
@@ -124,9 +87,9 @@ read_metadata (TrackerSparqlBuilder *preupdate,
int frameheight;
int framewidth;
unsigned char *framedata = NULL;
-
+ GPtrArray *keywords;
+ guint i;
int status;
-
MergeData md = { 0 };
GifData gd = { 0 };
TrackerXmpData *xd = NULL;
@@ -333,13 +296,14 @@ read_metadata (TrackerSparqlBuilder *preupdate,
tracker_sparql_builder_object_unvalidated (metadata, xd->metering_mode);
}
+ keywords = g_ptr_array_new ();
if (xd->keywords) {
- insert_keywords (metadata, uri, xd->keywords);
+ tracker_keywords_parse (keywords, xd->keywords);
}
if (xd->pdf_keywords) {
- insert_keywords (metadata, uri, xd->pdf_keywords);
+ tracker_keywords_parse (keywords, xd->pdf_keywords);
}
if (xd->rating) {
@@ -348,8 +312,25 @@ read_metadata (TrackerSparqlBuilder *preupdate,
}
if (xd->subject) {
- insert_keywords (metadata, uri, xd->subject);
+ tracker_keywords_parse (keywords, xd->subject);
+ }
+
+ for (i = 0; i < keywords->len; i++) {
+ gchar *p;
+
+ p = g_ptr_array_index (keywords, i);
+
+ tracker_sparql_builder_predicate (metadata, "nao:hasTag");
+
+ tracker_sparql_builder_object_blank_open (metadata);
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nao:Tag");
+ tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
+ tracker_sparql_builder_object_unvalidated (metadata, p);
+ tracker_sparql_builder_object_blank_close (metadata);
+ g_free (p);
}
+ g_ptr_array_free (keywords, TRUE);
if (xd->publisher) {
gchar *uri = tracker_uri_printf_escaped ("urn:contact:%s", xd->publisher);
diff --git a/src/tracker-extract/tracker-extract-jpeg.c b/src/tracker-extract/tracker-extract-jpeg.c
index 3e07c9d..354d038 100644
--- a/src/tracker-extract/tracker-extract-jpeg.c
+++ b/src/tracker-extract/tracker-extract-jpeg.c
@@ -91,43 +91,6 @@ struct tej_error_mgr {
};
static void
-insert_keywords (TrackerSparqlBuilder *metadata,
- gchar *keywords)
-{
- char *saveptr, *p;
- size_t len;
-
- p = keywords;
- keywords = strchr (keywords, '"');
-
- if (keywords) {
- keywords++;
- } else {
- keywords = p;
- }
-
- len = strlen (keywords);
- if (keywords[len - 1] == '"') {
- keywords[len - 1] = '\0';
- }
-
- for (p = strtok_r (keywords, ",;", &saveptr);
- p;
- p = strtok_r (NULL, ",;", &saveptr)) {
- tracker_sparql_builder_predicate (metadata, "nao:hasTag");
-
- tracker_sparql_builder_object_blank_open (metadata);
- tracker_sparql_builder_predicate (metadata, "a");
- tracker_sparql_builder_object (metadata, "nao:Tag");
-
- tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
- tracker_sparql_builder_object_unvalidated (metadata, p);
-
- tracker_sparql_builder_object_blank_close (metadata);
- }
-}
-
-static void
extract_jpeg_error_exit (j_common_ptr cinfo)
{
struct tej_error_mgr *h = (struct tej_error_mgr *) cinfo->err;
@@ -151,6 +114,8 @@ extract_jpeg (const gchar *uri,
goffset size;
gchar *filename;
gchar *comment = NULL;
+ GPtrArray *keywords;
+ guint i;
filename = g_filename_from_uri (uri, NULL, NULL);
@@ -330,16 +295,18 @@ extract_jpeg (const gchar *uri,
g_free (uri);
}
+ keywords = g_ptr_array_new ();
+
if (xd->keywords) {
- insert_keywords (metadata, xd->keywords);
+ tracker_keywords_parse (keywords, xd->keywords);
}
if (xd->pdf_keywords) {
- insert_keywords (metadata, xd->pdf_keywords);
+ tracker_keywords_parse (keywords, xd->pdf_keywords);
}
if (xd->subject) {
- insert_keywords (metadata, xd->subject);
+ tracker_keywords_parse (keywords, xd->subject);
}
if (xd->publisher) {
@@ -404,8 +371,25 @@ extract_jpeg (const gchar *uri,
}
if (id->keywords) {
- insert_keywords (metadata, id->keywords);
+ tracker_keywords_parse (keywords, id->keywords);
+ }
+
+ for (i = 0; i < keywords->len; i++) {
+ gchar *p;
+
+ p = g_ptr_array_index (keywords, i);
+
+ tracker_sparql_builder_predicate (metadata, "nao:hasTag");
+
+ tracker_sparql_builder_object_blank_open (metadata);
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nao:Tag");
+ tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
+ tracker_sparql_builder_object_unvalidated (metadata, p);
+ tracker_sparql_builder_object_blank_close (metadata);
+ g_free (p);
}
+ g_ptr_array_free (keywords, TRUE);
if (md.camera) {
tracker_sparql_builder_predicate (metadata, "nmm:camera");
diff --git a/src/tracker-extract/tracker-extract-pdf.cpp b/src/tracker-extract/tracker-extract-pdf.cpp
index 22016db..241b95b 100644
--- a/src/tracker-extract/tracker-extract-pdf.cpp
+++ b/src/tracker-extract/tracker-extract-pdf.cpp
@@ -251,42 +251,6 @@ read_outline (PDFDoc *document,
}
}
-static void
-insert_keywords (TrackerSparqlBuilder *metadata,
- gchar *keywords)
-{
- char *saveptr, *p;
- size_t len;
-
- p = keywords;
- keywords = strchr (keywords, '"');
-
- if (keywords) {
- keywords++;
- } else {
- keywords = p;
- }
-
- len = strlen (keywords);
- if (keywords[len - 1] == '"') {
- keywords[len - 1] = '\0';
- }
-
- for (p = strtok_r (keywords, ",;", &saveptr);
- p;
- p = strtok_r (NULL, ",;", &saveptr)) {
- tracker_sparql_builder_predicate (metadata, "nao:hasTag");
-
- tracker_sparql_builder_object_blank_open (metadata);
- tracker_sparql_builder_predicate (metadata, "a");
- tracker_sparql_builder_object (metadata, "nao:Tag");
-
- tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
- tracker_sparql_builder_object_unvalidated (metadata, p);
-
- tracker_sparql_builder_object_blank_close (metadata);
- }
-}
static void
page_get_size (Page *page,
@@ -383,7 +347,8 @@ extract_content (PDFDoc *document,
static void
write_pdf_data (PDFData data,
- TrackerSparqlBuilder *metadata)
+ TrackerSparqlBuilder *metadata,
+ GPtrArray *keywords)
{
if (!tracker_is_empty_string (data.title)) {
tracker_sparql_builder_predicate (metadata, "nie:title");
@@ -411,7 +376,7 @@ write_pdf_data (PDFData data,
}
if (!tracker_is_empty_string (data.keywords)) {
- insert_keywords (metadata, data.keywords);
+ tracker_keywords_parse (keywords, data.keywords);
}
}
@@ -510,6 +475,8 @@ extract_pdf (const gchar *uri,
gsize n_bytes;
Object obj;
Catalog *catalog;
+ GPtrArray *keywords;
+ guint i;
g_type_init ();
@@ -568,6 +535,7 @@ extract_pdf (const gchar *uri,
}
obj.free ();
+ keywords = g_ptr_array_new ();
catalog = document->getCatalog ();
if (catalog && catalog->isOk ()) {
@@ -590,14 +558,14 @@ extract_pdf (const gchar *uri,
md.date = (gchar *) tracker_coalesce_strip (3, pd.creation_date, xd->date, xd->time_original);
md.author = (gchar *) tracker_coalesce_strip (2, pd.author, xd->creator);
- write_pdf_data (md, metadata);
+ write_pdf_data (md, metadata, keywords);
if (xd->keywords) {
- insert_keywords (metadata, xd->keywords);
+ tracker_keywords_parse (keywords, xd->keywords);
}
if (xd->pdf_keywords) {
- insert_keywords (metadata, xd->pdf_keywords);
+ tracker_keywords_parse (keywords, xd->pdf_keywords);
}
if (xd->publisher) {
@@ -787,8 +755,25 @@ extract_pdf (const gchar *uri,
/* So if we are here we have NO XMP data and we just
* write what we know from Poppler.
*/
- write_pdf_data (pd, metadata);
+ write_pdf_data (pd, metadata, keywords);
+ }
+
+ for (i = 0; i < keywords->len; i++) {
+ gchar *p;
+
+ p = (gchar *) g_ptr_array_index (keywords, i);
+
+ tracker_sparql_builder_predicate (metadata, "nao:hasTag");
+
+ tracker_sparql_builder_object_blank_open (metadata);
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nao:Tag");
+ tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
+ tracker_sparql_builder_object_unvalidated (metadata, p);
+ tracker_sparql_builder_object_blank_close (metadata);
+ g_free (p);
}
+ g_ptr_array_free (keywords, TRUE);
tracker_sparql_builder_predicate (metadata, "nfo:pageCount");
tracker_sparql_builder_object_int64 (metadata, document->getNumPages());
diff --git a/src/tracker-extract/tracker-extract-png.c b/src/tracker-extract/tracker-extract-png.c
index b93180e..7ee717f 100644
--- a/src/tracker-extract/tracker-extract-png.c
+++ b/src/tracker-extract/tracker-extract-png.c
@@ -88,43 +88,6 @@ rfc1123_to_iso8601_date (const gchar *date)
}
static void
-insert_keywords (TrackerSparqlBuilder *metadata,
- const gchar *uri,
- gchar *keywords)
-{
- char *lasts, *keyw;
- size_t len;
-
- keyw = keywords;
- keywords = strchr (keywords, '"');
- if (keywords) {
- keywords++;
- } else {
- keywords = keyw;
- }
-
- len = strlen (keywords);
- if (keywords[len - 1] == '"') {
- keywords[len - 1] = '\0';
- }
-
- for (keyw = strtok_r (keywords, ",;", &lasts);
- keyw;
- keyw = strtok_r (NULL, ",;", &lasts)) {
- tracker_sparql_builder_predicate (metadata, "nao:hasTag");
-
- tracker_sparql_builder_object_blank_open (metadata);
- tracker_sparql_builder_predicate (metadata, "a");
- tracker_sparql_builder_object (metadata, "nao:Tag");
-
- tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
- tracker_sparql_builder_object_unvalidated (metadata, keyw);
-
- tracker_sparql_builder_object_blank_close (metadata);
- }
-}
-
-static void
read_metadata (TrackerSparqlBuilder *preupdate,
TrackerSparqlBuilder *metadata,
png_structp png_ptr,
@@ -139,6 +102,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
gint num_text;
gint i;
gint found;
+ GPtrArray *keywords;
if ((found = png_get_text (png_ptr, info_ptr, &text_ptr, &num_text)) < 1) {
g_debug ("Calling png_get_text() returned %d (< 1)", found);
@@ -260,6 +224,8 @@ read_metadata (TrackerSparqlBuilder *preupdate,
md.metering_mode = tracker_coalesce_strip (2, xd->metering_mode, ed->metering_mode);
md.white_balance = tracker_coalesce_strip (2, xd->white_balance, ed->white_balance);
+ keywords = g_ptr_array_new ();
+
if (md.comment) {
tracker_sparql_builder_predicate (metadata, "nie:comment");
tracker_sparql_builder_object_unvalidated (metadata, md.comment);
@@ -372,11 +338,11 @@ read_metadata (TrackerSparqlBuilder *preupdate,
if (xd->keywords) {
- insert_keywords (metadata, uri, xd->keywords);
+ tracker_keywords_parse (keywords, xd->keywords);
}
if (xd->pdf_keywords) {
- insert_keywords (metadata, uri, xd->pdf_keywords);
+ tracker_keywords_parse (keywords, xd->pdf_keywords);
}
if (xd->rating) {
@@ -385,7 +351,7 @@ read_metadata (TrackerSparqlBuilder *preupdate,
}
if (xd->subject) {
- insert_keywords (metadata, uri, xd->subject);
+ tracker_keywords_parse (keywords, xd->subject);
}
if (xd->publisher) {
@@ -485,6 +451,23 @@ read_metadata (TrackerSparqlBuilder *preupdate,
tracker_sparql_builder_object_double (metadata, value);
}
+ for (i = 0; i < keywords->len; i++) {
+ gchar *p;
+
+ p = g_ptr_array_index (keywords, i);
+
+ tracker_sparql_builder_predicate (metadata, "nao:hasTag");
+
+ tracker_sparql_builder_object_blank_open (metadata);
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nao:Tag");
+ tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
+ tracker_sparql_builder_object_unvalidated (metadata, p);
+ tracker_sparql_builder_object_blank_close (metadata);
+ g_free (p);
+ }
+ g_ptr_array_free (keywords, TRUE);
+
tracker_exif_free (ed);
tracker_xmp_free (xd);
g_free (pd.creation_time);
diff --git a/src/tracker-extract/tracker-extract-tiff.c b/src/tracker-extract/tracker-extract-tiff.c
index 7831c3c..14cd9e3 100644
--- a/src/tracker-extract/tracker-extract-tiff.c
+++ b/src/tracker-extract/tracker-extract-tiff.c
@@ -249,42 +249,6 @@ tag_to_string (TIFF *image,
}
static void
-insert_keywords (TrackerSparqlBuilder *metadata,
- const gchar *uri,
- gchar *keywords)
-{
- char *lasts, *keyw;
- size_t len;
-
- keyw = keywords;
- keywords = strchr (keywords, '"');
- if (keywords) {
- keywords++;
- } else {
- keywords = keyw;
- }
-
- len = strlen (keywords);
- if (keywords[len - 1] == '"')
- keywords[len - 1] = '\0';
-
- for (keyw = strtok_r (keywords, ",;", &lasts);
- keyw;
- keyw = strtok_r (NULL, ",;", &lasts)) {
- tracker_sparql_builder_predicate (metadata, "nao:hasTag");
-
- tracker_sparql_builder_object_blank_open (metadata);
- tracker_sparql_builder_predicate (metadata, "a");
- tracker_sparql_builder_object (metadata, "nao:Tag");
-
- tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
- tracker_sparql_builder_object_unvalidated (metadata, keyw);
-
- tracker_sparql_builder_object_blank_close (metadata);
- }
-}
-
-static void
extract_tiff (const gchar *uri,
TrackerSparqlBuilder *preupdate,
TrackerSparqlBuilder *metadata)
@@ -298,6 +262,8 @@ extract_tiff (const gchar *uri,
gchar *filename;
gchar *date;
glong exif_offset;
+ GPtrArray *keywords;
+ guint i;
#ifdef HAVE_LIBIPTCDATA
gchar *iptc_offset;
@@ -420,6 +386,8 @@ extract_tiff (const gchar *uri,
md.x_dimension = tracker_coalesce_strip (2, td.width, ed->x_dimension);
md.y_dimension = tracker_coalesce_strip (2, td.length, ed->y_dimension);
+ keywords = g_ptr_array_new ();
+
if (ed->user_comment) {
tracker_sparql_builder_predicate (metadata, "nie:comment");
tracker_sparql_builder_object_unvalidated (metadata, ed->user_comment);
@@ -436,15 +404,15 @@ extract_tiff (const gchar *uri,
}
if (xd->keywords) {
- insert_keywords (metadata, uri, xd->keywords);
+ tracker_keywords_parse (keywords, xd->keywords);
}
if (xd->pdf_keywords) {
- insert_keywords (metadata, uri, xd->pdf_keywords);
+ tracker_keywords_parse (keywords, xd->pdf_keywords);
}
if (xd->subject) {
- insert_keywords (metadata, uri, xd->subject);
+ tracker_keywords_parse (keywords, xd->subject);
}
if (xd->publisher) {
@@ -555,8 +523,25 @@ extract_tiff (const gchar *uri,
}
if (id->keywords) {
- insert_keywords (metadata, uri, id->keywords);
+ tracker_keywords_parse (keywords, id->keywords);
+ }
+
+ for (i = 0; i < keywords->len; i++) {
+ gchar *p;
+
+ p = g_ptr_array_index (keywords, i);
+
+ tracker_sparql_builder_predicate (metadata, "nao:hasTag");
+
+ tracker_sparql_builder_object_blank_open (metadata);
+ tracker_sparql_builder_predicate (metadata, "a");
+ tracker_sparql_builder_object (metadata, "nao:Tag");
+ tracker_sparql_builder_predicate (metadata, "nao:prefLabel");
+ tracker_sparql_builder_object_unvalidated (metadata, p);
+ tracker_sparql_builder_object_blank_close (metadata);
+ g_free (p);
}
+ g_ptr_array_free (keywords, TRUE);
if (md.camera) {
tracker_sparql_builder_predicate (metadata, "nmm:camera");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]