From 8529f57b5ab442ffe56b3afebef1fe8de60a52b6 Mon Sep 17 00:00:00 2001 From: Petra Maier Date: Thu, 15 Feb 2024 07:21:54 +0100 Subject: [PATCH 1/3] Add language to ExampleOfWork (#1823) --- src/main/resources/alma/fix/otherFields.fix | 11 +++++++++++ .../alma/fix/relatedRessourcesAndLinks.fix | 13 +++++++++++++ src/test/resources/alma-fix/99371530278506441.json | 9 ++++++++- src/test/resources/alma-fix/99372423490706441.json | 6 ++++++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/main/resources/alma/fix/otherFields.fix b/src/main/resources/alma/fix/otherFields.fix index 7d5afcb91..4a0e436de 100644 --- a/src/main/resources/alma/fix/otherFields.fix +++ b/src/main/resources/alma/fix/otherFields.fix @@ -19,6 +19,17 @@ end lookup("language[].*.label","ISO639-2-to-GND") prepend("language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") +unless exists("130??|240??") + set_array("lang_temp") + copy_field("041[ 01] .[hk]", "lang_temp.$append") + set_array("exampleOfWork.language[]") + do list(path:"lang_temp", "var": "$i") + copy_field("$i","exampleOfWork.language[].$append.id") + copy_field("$i","exampleOfWork.language[].$last.label") + end +end +lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") +prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") # 300 - Physical Description (R) # We reuse the introx transformation here. diff --git a/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix b/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix index aa6c97570..f21854be5 100644 --- a/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix +++ b/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix @@ -611,6 +611,19 @@ end replace_all("exampleOfWork.label","<<|>>","") +# 041 h|k - Language code of original and/or intermediate translations of text +if exists("130??|240??") + set_array("lang_temp") + copy_field("041[ 01] .[hk]", "lang_temp.$append") + set_array("exampleOfWork.language[]") + do list(path:"lang_temp", "var": "$i") + copy_field("$i","exampleOfWork.language[].$append.id") + copy_field("$i","exampleOfWork.language[].$last.label") + end +end +lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") +prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") + # following only with second indicator 2 for analytical entries: # 700 - Added Entry-Personal Name (R) # 710 - Added Entry-Corporate Name (R) diff --git a/src/test/resources/alma-fix/99371530278506441.json b/src/test/resources/alma-fix/99371530278506441.json index 58eec176e..dda12a91a 100644 --- a/src/test/resources/alma-fix/99371530278506441.json +++ b/src/test/resources/alma-fix/99371530278506441.json @@ -101,7 +101,14 @@ "exampleOfWork" : { "label" : "De ente et essentia", "id" : "https://d-nb.info/gnd/4117209-7", - "type" : [ "Work" ] + "type" : [ "Work" ], + "language" : [ { + "id" : "http://id.loc.gov/vocabulary/iso639-2/http://id.loc.gov/vocabulary/iso639-2/lat", + "label" : "Latein" + }, { + "id" : "http://id.loc.gov/vocabulary/iso639-2/http://id.loc.gov/vocabulary/iso639-2/rom", + "label" : "Romani" + } ] }, "language" : [ { "id" : "http://id.loc.gov/vocabulary/iso639-2/kor", diff --git a/src/test/resources/alma-fix/99372423490706441.json b/src/test/resources/alma-fix/99372423490706441.json index a37b9d397..039cecb51 100644 --- a/src/test/resources/alma-fix/99372423490706441.json +++ b/src/test/resources/alma-fix/99372423490706441.json @@ -63,6 +63,12 @@ "label" : "hbz - Hochschulbibliothekszentrum des Landes Nordrhein-Westfalen, Netzwerkzone", "type" : [ "Collection" ] } ], + "exampleOfWork" : { + "language" : [ { + "id" : "http://id.loc.gov/vocabulary/iso639-2/eng", + "label" : "Englisch" + } ] + }, "language" : [ { "id" : "http://id.loc.gov/vocabulary/iso639-2/ger", "label" : "Deutsch" From d05f66ffc03ad758cf46ae63964a24cee8ea41cb Mon Sep 17 00:00:00 2001 From: Petra Maier Date: Thu, 15 Feb 2024 10:47:44 +0100 Subject: [PATCH 2/3] Reset manipulated xml-testfile to original state (#1823) Insert "prepend" into unless-clause --- src/main/resources/alma/fix/otherFields.fix | 5 +++-- src/main/resources/alma/fix/relatedRessourcesAndLinks.fix | 5 +++-- src/test/resources/alma-fix/99371530278506441.json | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/resources/alma/fix/otherFields.fix b/src/main/resources/alma/fix/otherFields.fix index 4a0e436de..45d1c5ca0 100644 --- a/src/main/resources/alma/fix/otherFields.fix +++ b/src/main/resources/alma/fix/otherFields.fix @@ -27,9 +27,10 @@ unless exists("130??|240??") copy_field("$i","exampleOfWork.language[].$append.id") copy_field("$i","exampleOfWork.language[].$last.label") end + lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") + prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") end -lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") -prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") + # 300 - Physical Description (R) # We reuse the introx transformation here. diff --git a/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix b/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix index f21854be5..da16ed67b 100644 --- a/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix +++ b/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix @@ -620,9 +620,10 @@ if exists("130??|240??") copy_field("$i","exampleOfWork.language[].$append.id") copy_field("$i","exampleOfWork.language[].$last.label") end + lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") + prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") end -lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") -prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") + # following only with second indicator 2 for analytical entries: # 700 - Added Entry-Personal Name (R) diff --git a/src/test/resources/alma-fix/99371530278506441.json b/src/test/resources/alma-fix/99371530278506441.json index dda12a91a..67bce9763 100644 --- a/src/test/resources/alma-fix/99371530278506441.json +++ b/src/test/resources/alma-fix/99371530278506441.json @@ -103,11 +103,8 @@ "id" : "https://d-nb.info/gnd/4117209-7", "type" : [ "Work" ], "language" : [ { - "id" : "http://id.loc.gov/vocabulary/iso639-2/http://id.loc.gov/vocabulary/iso639-2/lat", + "id" : "http://id.loc.gov/vocabulary/iso639-2/lat", "label" : "Latein" - }, { - "id" : "http://id.loc.gov/vocabulary/iso639-2/http://id.loc.gov/vocabulary/iso639-2/rom", - "label" : "Romani" } ] }, "language" : [ { From d3bcd0c3d5551bdc7f06f218a13c54bac83aac9e Mon Sep 17 00:00:00 2001 From: Petra Maier Date: Thu, 15 Feb 2024 15:15:37 +0100 Subject: [PATCH 3/3] Remove redundant code (#1823) --- src/main/resources/alma/fix/otherFields.fix | 13 ------------ .../alma/fix/relatedRessourcesAndLinks.fix | 20 +++++++++---------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/main/resources/alma/fix/otherFields.fix b/src/main/resources/alma/fix/otherFields.fix index 45d1c5ca0..46a8d92fb 100644 --- a/src/main/resources/alma/fix/otherFields.fix +++ b/src/main/resources/alma/fix/otherFields.fix @@ -19,19 +19,6 @@ end lookup("language[].*.label","ISO639-2-to-GND") prepend("language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") -unless exists("130??|240??") - set_array("lang_temp") - copy_field("041[ 01] .[hk]", "lang_temp.$append") - set_array("exampleOfWork.language[]") - do list(path:"lang_temp", "var": "$i") - copy_field("$i","exampleOfWork.language[].$append.id") - copy_field("$i","exampleOfWork.language[].$last.label") - end - lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") - prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") -end - - # 300 - Physical Description (R) # We reuse the introx transformation here. diff --git a/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix b/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix index da16ed67b..b9388b5cb 100644 --- a/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix +++ b/src/main/resources/alma/fix/relatedRessourcesAndLinks.fix @@ -612,17 +612,17 @@ end replace_all("exampleOfWork.label","<<|>>","") # 041 h|k - Language code of original and/or intermediate translations of text -if exists("130??|240??") - set_array("lang_temp") - copy_field("041[ 01] .[hk]", "lang_temp.$append") - set_array("exampleOfWork.language[]") - do list(path:"lang_temp", "var": "$i") - copy_field("$i","exampleOfWork.language[].$append.id") - copy_field("$i","exampleOfWork.language[].$last.label") - end - lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") - prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") + +set_array("lang_temp") +copy_field("041[ 01] .[hk]", "lang_temp.$append") +set_array("exampleOfWork.language[]") +do list(path:"lang_temp", "var": "$i") + copy_field("$i","exampleOfWork.language[].$append.id") + copy_field("$i","exampleOfWork.language[].$last.label") end +lookup("exampleOfWork.language[].*.label","ISO639-2-to-GND") +prepend("exampleOfWork.language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/") + # following only with second indicator 2 for analytical entries: