From f604807d3edce88c666e493c1e787c5ddd52ddde Mon Sep 17 00:00:00 2001 From: TobiasNx Date: Wed, 25 Sep 2024 15:07:31 +0200 Subject: [PATCH] Adjusted the mapping to be more rigid #2062 The current mapping only tested if there are three values the new one tests if the value is in the languge map. --- src/main/resources/alma/fix/otherFields.fix | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/main/resources/alma/fix/otherFields.fix b/src/main/resources/alma/fix/otherFields.fix index e9a866dac..dc780d63a 100644 --- a/src/main/resources/alma/fix/otherFields.fix +++ b/src/main/resources/alma/fix/otherFields.fix @@ -1,27 +1,32 @@ # 008 - Fixed-Length Data Elements-General Information (NR) - No subfields +# 041 - 041 - Language Code (R) set_array("@language") copy_field("008", "@008-lang") substring("@008-lang", "35", "3") -copy_field("@008-lang", "@language.$append") -copy_field("041[ 01] .[adj]", "@language.$append") +copy_field("@008-lang", "@language.$append.id") +copy_field("@008-lang", "@language.$last.label") +do list(path: "041[ 01] ","var":"$i") + copy_field("$i.[adj]", "@language.$append.id") + copy_field("$i.[adj]", "@language.$last.label") +end -flatten("@language") +lookup("@language.*.label","ISO639-2-to-GND", delete:"true") set_array("language[]") do list(path:"@language", "var":"$i") - unless any_match("$i","zxx|mul|sgn|und|.*[\\|\\#].*|\\s*") - if any_match("$i","[A-Za-z]{3}") - copy_field("$i", "language[].$append.id") - copy_field("$i", "language[].$last.label") - elsif any_match("$i","[dD]eutsch") + unless any_match("$i.id","zxx|mul|sgn|und|.*[\\|\\#].*|\\s*") + if exists("$i.label") + copy_field("$i.id", "language[].$append.id") + copy_field("$i.label", "language[].$last.label") + elsif any_match("$i.id","[dD]eutsch") add_field("language[].$append.id","ger") - add_field("language[].$last.label","ger") + add_field("language[].$last.label","Deutsch") end end end -lookup("language[].*.label","ISO639-2-to-GND") + prepend("language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") uniq("language[]")