diff --git a/src/main/resources/alma/fix/otherFields.fix b/src/main/resources/alma/fix/otherFields.fix index 86ed031bc..848601406 100644 --- a/src/main/resources/alma/fix/otherFields.fix +++ b/src/main/resources/alma/fix/otherFields.fix @@ -6,19 +6,23 @@ substring("@008-lang", "35", "3") copy_field("@008-lang", "@language.$append") copy_field("041[ 01] .[adj]", "@language.$append") -uniq("@language") +flatten("@language") set_array("language[]") do list(path:"@language", "var":"$i") unless any_match("$i","zxx|mul|sgn|und|.*[\\|\\#].*|\\s*") - copy_field("$i", "language[].$append.id") - copy_field("$i", "language[].$last.label") + if any_match("$i","[A-Za-z]{3}") + copy_field("$i", "language[].$append.id") + copy_field("$i", "language[].$last.label") + end end end lookup("language[].*.label","ISO639-2-to-GND") prepend("language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") +uniq("language[]") + # 300 - Physical Description (R) # We reuse the introx transformation here. diff --git a/src/test/resources/alma-fix/990126426530206441.json b/src/test/resources/alma-fix/990126426530206441.json index cfbdf4a0d..a558f1aef 100644 --- a/src/test/resources/alma-fix/990126426530206441.json +++ b/src/test/resources/alma-fix/990126426530206441.json @@ -80,10 +80,6 @@ "label" : "hbz - Hochschulbibliothekszentrum des Landes Nordrhein-Westfalen, Netzwerkzone", "type" : [ "Collection" ] } ], - "language" : [ { - "id" : "http://id.loc.gov/vocabulary/iso639-2/deutsch", - "label" : "deutsch" - } ], "note" : [ "In: Energie Spektr.. - 11 (1996) Nr. 3 S. 18/21 : Abb.; 2 Lit." ], "bibliographicCitation" : "Energie Spektr.. - 11 (1996) Nr. 3 S. 18/21 : Abb.; 2 Lit.", "hasItem" : [ { diff --git a/src/test/resources/alma-fix/990173607780206441.json b/src/test/resources/alma-fix/990173607780206441.json index 86a16ea8a..adb9ab87d 100644 --- a/src/test/resources/alma-fix/990173607780206441.json +++ b/src/test/resources/alma-fix/990173607780206441.json @@ -79,9 +79,6 @@ "language" : [ { "id" : "http://id.loc.gov/vocabulary/iso639-2/eng", "label" : "Englisch" - }, { - "id" : "http://id.loc.gov/vocabulary/iso639-2/engl.", - "label" : "engl." } ], "extent" : "192 S. : zahlr. Ill., teils farb.", "natureOfContent" : [ {