[tracker/tracker-1.2] tracker-extract-epub: Ensure we only have one nie:identifier



commit f092602575b95d2e1c358f6aa855fb0ed6d5b933
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Mar 18 14:18:06 2015 +0100

    tracker-extract-epub: Ensure we only have one nie:identifier
    
    This property has maxCardinality=1, we are however possibly adding
    multiple values there, either in both UUID/ISBN forms, or as multiple
    UUIDs in faulty epubs.
    
    ISBN should probably be its own rdf:Property, in the mean time, stick
    to the first nie:identifier found, and ignore the rest.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746401

 src/tracker-extract/tracker-extract-epub.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-epub.c b/src/tracker-extract/tracker-extract-epub.c
index 64b0859..5ac0301 100644
--- a/src/tracker-extract/tracker-extract-epub.c
+++ b/src/tracker-extract/tracker-extract-epub.c
@@ -54,6 +54,7 @@ typedef struct {
        GList *pages;
        guint in_metadata : 1;
        guint in_manifest : 1;
+       guint has_identifier : 1;
        gchar *savedstring;
 } OPFData;
 
@@ -472,12 +473,12 @@ opf_xml_text_handler (GMarkupParseContext   *context,
                tracker_sparql_builder_object_unvalidated (data->metadata, text);
                break;
        case OPF_TAG_TYPE_UUID:
-               tracker_sparql_builder_predicate (data->metadata, "nie:identifier");
-               tracker_sparql_builder_object_unvalidated (data->metadata, text);
-               break;
        case OPF_TAG_TYPE_ISBN:
-               tracker_sparql_builder_predicate (data->metadata, "nie:identifier");
-               tracker_sparql_builder_object_unvalidated (data->metadata, text);
+               if (!data->has_identifier) {
+                       data->has_identifier = TRUE;
+                       tracker_sparql_builder_predicate (data->metadata, "nie:identifier");
+                       tracker_sparql_builder_object_unvalidated (data->metadata, text);
+               }
                break;
        /* case OPF_TAG_TYPE_RATING: */
        case OPF_TAG_TYPE_UNKNOWN:


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