From 32f9666918be54d1292374b2f68f6d6faa13fe08 Mon Sep 17 00:00:00 2001 From: Damien Riehl Date: Mon, 16 Mar 2026 21:30:56 -0500 Subject: [PATCH 1/2] fix: Include lang-tagged altLabels in alternative_labels for search MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit altLabels with xml:lang attributes (90% of all altLabels — 52,238 of 57,510) were added to translations but excluded from alternative_labels, making them invisible to search_by_label(). Now always append to alternative_labels regardless of language tag, so searches like "Patent Prosecution" correctly match "Patent Registration Process". Co-Authored-By: Claude Opus 4.6 (1M context) --- folio/graph.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folio/graph.py b/folio/graph.py index 8e473a0..f452e6b 100644 --- a/folio/graph.py +++ b/folio/graph.py @@ -659,8 +659,8 @@ def parse_owl_class(self, node: lxml.etree._Element) -> None: lang = child.attrib.get(self.get_ns_tag("xml", "lang"), None) if lang: owl_class.translations[lang] = child.text - else: - owl_class.alternative_labels.append(child.text) + # Always add to alternative_labels for search indexing + owl_class.alternative_labels.append(child.text) # add triple self.triples.append((owl_class.iri, "skos:altLabel", child.text)) From 303eb54063148dcb1ad282d640694a21aedad829 Mon Sep 17 00:00:00 2001 From: Mike Bommarito Date: Mon, 16 Mar 2026 22:42:58 -0400 Subject: [PATCH 2/2] fix: Deduplicate alternative_labels when adding lang-tagged altLabels Prevent duplicate entries in alternative_labels when the same text appears as both a lang-tagged and non-lang-tagged altLabel. Co-Authored-By: Claude Opus 4.6 (1M context) --- folio/graph.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/folio/graph.py b/folio/graph.py index f452e6b..66320a1 100644 --- a/folio/graph.py +++ b/folio/graph.py @@ -660,7 +660,8 @@ def parse_owl_class(self, node: lxml.etree._Element) -> None: if lang: owl_class.translations[lang] = child.text # Always add to alternative_labels for search indexing - owl_class.alternative_labels.append(child.text) + if child.text not in owl_class.alternative_labels: + owl_class.alternative_labels.append(child.text) # add triple self.triples.append((owl_class.iri, "skos:altLabel", child.text))