Skip to content

Commit

Permalink
Prioritize AlmaMmsId for opac links #1888
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Oct 16, 2023
1 parent 7809673 commit 3266b50
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 58 deletions.
68 changes: 34 additions & 34 deletions src/main/resources/alma/fix/macros.fix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ do put_macro("alternateGraphicRepresationArrayOfObjects")
copy_field("$[variable].6","$[variable].linkageTest")
do list(path:"880??","var":"$880")
if in ("$[variable].linkageTest","$880.linkageTest")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
do list(path:"alternateGraphicRepresentation[]","var":"$AGR")
if in ("[email protected]","$AGR.script.id")
unless exists("$AGR.record.$[targetArray]")
Expand All @@ -13,9 +13,9 @@ do put_macro("alternateGraphicRepresationArrayOfObjects")
copy_field("$880.a","$AGR.record.$[targetArray].$append$[targetField].label")
end
end
else
else
copy_field("[email protected]","alternateGraphicRepresentation[].$append.script.id")
copy_field("[email protected]","alternateGraphicRepresentation[].$last.script.label")
copy_field("[email protected]","alternateGraphicRepresentation[].$last.script.label")
set_array("alternateGraphicRepresentation[].$last.record.$[targetArray]")
copy_field("$880.a","alternateGraphicRepresentation[].$last.record.$[targetArray].$append$[targetField].label")
end
Expand All @@ -29,21 +29,21 @@ do put_macro("alternateGraphicRepresationIsPartOf")
copy_field("$[variable].6","$[variable].linkageTest")
do list(path:"880??","var":"$880")
if in ("$[variable].linkageTest","$880.linkageTest")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
do list(path:"alternateGraphicRepresentation[]","var":"$AGR")
if in ("[email protected]","$AGR.script.id")
unless exists("$AGR.record.isPartOf[]")
set_array("$AGR.record.isPartOf[]")
end
set_array("$AGR.record.isPartOf[].$append.hasSuperordinate[]")
set_array("$AGR.record.isPartOf[].$append.hasSuperordinate[]")
copy_field("$880.a","$AGR.record.isPartOf[].$last.hasSuperordinate[].$append.label")
copy_field("$880.v", "$AGR.record.isPartOf[].$last.numbering")
end
end
else
else
copy_field("[email protected]","alternateGraphicRepresentation[].$append.script.id")
copy_field("[email protected]","alternateGraphicRepresentation[].$last.script.label")
set_array("alternateGraphicRepresentation[].$last.record.isPartOf[]")
set_array("alternateGraphicRepresentation[].$last.record.isPartOf[]")
set_array("alternateGraphicRepresentation[].$last.record.isPartOf[].$append.hasSuperordinate[]")
copy_field("$880.a","alternateGraphicRepresentation[].$last.record.isPartOf[].$last.hasSuperordinate[].$append.label")
copy_field("$880.v", "alternateGraphicRepresentation[].$last.record.isPartOf[].$last.numbering")
Expand All @@ -59,7 +59,7 @@ do put_macro("rolesFromSubfieldE")
unless is_array("$i.4")
move_field("$i.4","$i.@4")
set_array("$i.4")
move_field("$i.@4","$i.4.$append")
move_field("$i.@4","$i.4.$append")
end
do list(path:"$i.e","var":"$e")
if any_match("$e","(?i).*dars.*")
Expand Down Expand Up @@ -151,10 +151,10 @@ do put_macro("gndEventCombinedLabel")
copy_field("$[field].b","$[field].@combinedLabel.$append")
join_field("$[field].@combinedLabel", ". ") # This is the difference to gnd person
set_array("$[field].@combinedDetailsForEvents")
copy_field("$[field].n","$[field].@combinedDetailsForEvents.$append")
copy_field("$[field].n","$[field].@combinedDetailsForEvents.$append")
copy_field("$[field].g","$[field].@combinedDetailsForEvents.$append")
copy_field("$[field].d","$[field].@combinedDetailsForEvents.$append")
copy_field("$[field].c","$[field].@combinedDetailsForEvents.$append")
copy_field("$[field].c","$[field].@combinedDetailsForEvents.$append")
join_field("$[field].@combinedDetailsForEvents"," : ")
unless is_empty("$[field].@combinedDetailsForEvents.")
paste("$[field].@combinedLabel", "$[field].@combinedLabel", "~ (", "$[field].@combinedDetailsForEvents", "~)", join_char:"")
Expand Down Expand Up @@ -228,13 +228,13 @@ do put_macro("provenanceLinks")
elsif any_equal("$[field]", "BSZ")
replace_all("$[field]", "^.*$", "DE-576")
elsif any_equal("$[field]", "GBV")
replace_all("$[field]", "^.*$", "DE-601")
replace_all("$[field]", "^.*$", "DE-601")
elsif any_equal("$[field]", "KOBV")
replace_all("$[field]", "^.*$", "DE-602")
replace_all("$[field]", "^.*$", "DE-602")
elsif any_equal("$[field]", "HeBIS")
replace_all("$[field]", "^.*$", "DE-603")
replace_all("$[field]", "^.*$", "DE-603")
elsif any_equal("$[field]", "BVB")
replace_all("$[field]", "^.*$", "DE-604")
replace_all("$[field]", "^.*$", "DE-604")
elsif any_match("$[field]","^292$")
replace_all("$[field]", "^292$", "DE-101b")
elsif any_match("$[field]","(.*)\\/NWBib$")
Expand All @@ -261,7 +261,7 @@ do put_macro("holdingLibrary+opacLink")
lookup("$i.@iz", "alma-institution-code-to-isil")
copy_field("$[libraryCodeField]","$i.@sublibraryIsil")
lookup("$i.@sublibraryIsil", "hbzowner2sigel",delete:"true")
lookup("$i.@sublibraryIsil", "sigel2isilMap",delete:"true")
lookup("$i.@sublibraryIsil", "sigel2isilMap",delete:"true")
# following fix checks for sublibrary codes and if they map to provided sublocation Isil
unless exists("$i.@sublibraryIsil")
paste("$i.@sublibraryIsil","$i.M","~+","$[libraryCodeField]",join_char:"")
Expand Down Expand Up @@ -309,12 +309,12 @@ do put_macro("opacLink")
split_field("$i.@opacLinkZdbId","\\{isbn\\}")
end
set_array("hasItem[].$last.seeAlso[]")
if exists("[email protected]")
if exists("[email protected]")
paste("hasItem[].$last.seeAlso[].$append","[email protected]","almaMmsId","[email protected]",join_char:"")
elsif exists("[email protected]")
paste("hasItem[].$last.seeAlso[].$append","[email protected]","zdbId","[email protected]",join_char:"")
elsif exists("[email protected]")
paste("hasItem[].$last.seeAlso[].$append","[email protected]","hbzId","[email protected]",join_char:"")
elsif exists("[email protected]")
paste("hasItem[].$last.seeAlso[].$append","[email protected]","almaMmsId","[email protected]",join_char:"")
elsif exists("[email protected]")
paste("hasItem[].$last.seeAlso[].$append","[email protected]","isbn[].1","[email protected]",join_char:"")
elsif exists("[email protected]")
Expand All @@ -341,7 +341,7 @@ do put_macro("schlagwortfolge")
if any_equal("subject[].$last.componentList[].$last.type[]","p")
call_macro("gndPersonCombinedLabel",field:"$i")
elsif any_equal("subject[].$last.componentList[].$last.type[]","f")
call_macro("gndEventCombinedLabel",field:"$i")
call_macro("gndEventCombinedLabel",field:"$i")
else
call_macro("gndOtherCombinedLabel",field:"$i")
end
Expand Down Expand Up @@ -421,25 +421,25 @@ do put_macro("publication")
copy_field("$i.6","$i.linkageTest")
do list(path:"880??","var":"$880")
if in ("$i.linkageTest","$880.linkageTest")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
do list(path:"alternateGraphicRepresentation[]","var":"$AGR")
if in ("[email protected]","$AGR.script.id")
unless exists("$AGR.record.publication[]")
set_array("$AGR.record.publication[]")
end
add_field ("$AGR.record.publication[].$append.dummi","")
set_array("$AGR.record.publication[].$last.location[]")
end
add_field ("$AGR.record.publication[].$append.dummi","")
set_array("$AGR.record.publication[].$last.location[]")
copy_field("$880.a", "$AGR.record.publication[].$last.location[].$append")
set_array("$AGR.record.publication[].$last.publishedBy[]")
copy_field("$880.b", "$AGR.record.publication[].$last.publishedBy[].$append")
end
end
else
else
copy_field("[email protected]","alternateGraphicRepresentation[].$append.script.id")
copy_field("[email protected]","alternateGraphicRepresentation[].$last.script.label")
set_array("alternateGraphicRepresentation[].$last.publication[]")
add_field ("alternateGraphicRepresentation[].$last.publication[].$append.dummi","")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.location[]")
add_field ("alternateGraphicRepresentation[].$last.publication[].$append.dummi","")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.location[]")
copy_field("$880.a", "alternateGraphicRepresentation[].$last.publication[].$last.location[].$append")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.publishedBy[]")
copy_field("$880.b", "alternateGraphicRepresentation[].$last.publication[].$last.publishedBy[].$append")
Expand Down Expand Up @@ -475,25 +475,25 @@ do put_macro("manufacture")
copy_field("$i.6","$i.linkageTest")
do list(path:"880??","var":"$880")
if in ("$i.linkageTest","$880.linkageTest")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
if in ("[email protected]","alternateGraphicRepresentation[].*.script.id")
do list(path:"alternateGraphicRepresentation[]","var":"$AGR")
if in ("[email protected]","$AGR.script.id")
unless exists("$AGR.record.manufacture[]")
set_array("$AGR.record.manufacture[]")
end
add_field ("$AGR.record.manufacture[].$append.dummi","")
set_array("$AGR.record.manufacture[].$last.location[]")
end
add_field ("$AGR.record.manufacture[].$append.dummi","")
set_array("$AGR.record.manufacture[].$last.location[]")
copy_field("$880.a", "$AGR.record.manufacture[].$last.location[].$append")
set_array("$AGR.record.manufacture[].$last.manufacturedBy[]")
copy_field("$880.b", "$AGR.record.manufacture[].$last.manufacturedBy[].$append")
end
end
else
else
copy_field("[email protected]","alternateGraphicRepresentation[].$append.script.id")
copy_field("[email protected]","alternateGraphicRepresentation[].$last.script.label")
set_array("alternateGraphicRepresentation[].$last.manufacture[]")
add_field ("alternateGraphicRepresentation[].$last.manufacture[].$append.dummi","")
set_array("alternateGraphicRepresentation[].$last.manufacture[].$last.location[]")
add_field ("alternateGraphicRepresentation[].$last.manufacture[].$append.dummi","")
set_array("alternateGraphicRepresentation[].$last.manufacture[].$last.location[]")
copy_field("$880.a", "alternateGraphicRepresentation[].$last.manufacture[].$last.location[].$append")
set_array("alternateGraphicRepresentation[].$last.manufacture[].$last.publishedBy[]")
copy_field("$880.b", "alternateGraphicRepresentation[].$last.manufacture[].$last.publishedBy[].$append")
Expand All @@ -502,4 +502,4 @@ do put_macro("manufacture")
end
end
end
end
end
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990053976760206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@
"id" : "http://lobid.org/organisations/DE-290#!",
"label" : "Universitätsbibliothek Dortmund"
},
"seeAlso" : [ "https://www.ub.tu-dortmund.de/webOPACClient/start.do?Query=-1=%22123550-3%22" ],
"seeAlso" : [ "https://katalog.ub.tu-dortmund.de/id/ir01388a:ubd.lobid:990053976760206441" ],
"id" : "http://lobid.org/items/990053976760206441:DE-290:22189310720006445#!"
}, {
"label" : "lobid Bestandsressource",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990054215550206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
"id" : "http://lobid.org/organisations/DE-5#!",
"label" : "Universitäts- und Landesbibliothek Bonn"
},
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%221257-9%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990054215550206441" ],
"id" : "http://lobid.org/items/990054215550206441:DE-5:22235621980006467#!"
}, {
"label" : "lobid Bestandsressource",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990054301770206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "NurTitel" ],
"seeAlso" : [ "https://www.ub.tu-dortmund.de/webOPACClient/start.do?Query=-1=%22133469-4%22" ],
"seeAlso" : [ "https://katalog.ub.tu-dortmund.de/id/ir01388a:ubd.lobid:990054301770206441" ],
"heldBy" : {
"isil" : "DE-290",
"id" : "http://lobid.org/organisations/DE-290#!",
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990054345550206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
"id" : "http://lobid.org/organisations/DE-5#!",
"label" : "Universitäts- und Landesbibliothek Bonn"
},
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%22619424-2%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990054345550206441" ],
"id" : "http://lobid.org/items/990054345550206441:DE-5:22214232350006467#!"
}, {
"label" : "lobid Bestandsressource",
Expand All @@ -670,7 +670,7 @@
"id" : "http://lobid.org/organisations/DE-5#!",
"label" : "Universitäts- und Landesbibliothek Bonn"
},
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%22619424-2%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990054345550206441" ],
"id" : "http://lobid.org/items/990054345550206441:DE-5:22214232360006467#!"
}, {
"label" : "lobid Bestandsressource",
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/alma-fix/990109712970206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@
"id" : "http://lobid.org/organisations/DE-5#!",
"label" : "Universitäts- und Landesbibliothek Bonn"
},
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222000012-1%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990109712970206441" ],
"id" : "http://lobid.org/items/990109712970206441:DE-5:22316628570006467#!"
}, {
"label" : "lobid Bestandsressource",
Expand All @@ -654,7 +654,7 @@
"id" : "http://lobid.org/organisations/DE-Bo59#!",
"label" : "Beethoven-Haus Bonn, Bibliothek"
},
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222000012-1%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990109712970206441" ],
"id" : "http://lobid.org/items/990109712970206441:DE-Bo59:22316628560006467#!"
}, {
"label" : "lobid Bestandsressource",
Expand All @@ -667,7 +667,7 @@
"id" : "http://lobid.org/organisations/DE-Bo59#!",
"label" : "Beethoven-Haus Bonn, Bibliothek"
},
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222000012-1%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990109712970206441" ],
"id" : "http://lobid.org/items/990109712970206441:DE-Bo59:22316628550006467#!"
}, {
"label" : "lobid Bestandsressource",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990133067580206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&portfolio_pid=53804555180006441&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&rft.mms_id=990133067580206441",
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222163340-X%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990133067580206441" ],
"heldBy" : {
"isil" : "DE-5",
"id" : "http://lobid.org/organisations/DE-5#!",
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/alma-fix/990184127410206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&portfolio_pid=53738793900006441&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&rft.mms_id=990184127410206441",
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222594002-8%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990184127410206441" ],
"heldBy" : {
"isil" : "DE-5",
"id" : "http://lobid.org/organisations/DE-5#!",
Expand Down Expand Up @@ -240,7 +240,7 @@
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&portfolio_pid=53738793940006441&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&rft.mms_id=990184127410206441",
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222594002-8%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990184127410206441" ],
"heldBy" : {
"isil" : "DE-5",
"id" : "http://lobid.org/organisations/DE-5#!",
Expand Down Expand Up @@ -275,7 +275,7 @@
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&portfolio_pid=53804344220006441&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&rft.mms_id=990184127410206441",
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222594002-8%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990184127410206441" ],
"heldBy" : {
"isil" : "DE-5",
"id" : "http://lobid.org/organisations/DE-5#!",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990193229450206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&portfolio_pid=53807024380006441&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_ULB/openurl?u.ignore_date_coverage=true&rft.mms_id=990193229450206441",
"seeAlso" : [ "https://opac2.ulb.uni-bonn.de:8080/webOPACClient/start.do?Query=-1=%222685248-2%22" ],
"seeAlso" : [ "https://bonnus.ulb.uni-bonn.de/permalink/49HBZ_ULB/idtnkp/alma990193229450206441" ],
"heldBy" : {
"isil" : "DE-5",
"id" : "http://lobid.org/organisations/DE-5#!",
Expand Down
Loading

0 comments on commit 3266b50

Please sign in to comment.