From a7fdbd9801ea2d27b727c1934da4f60f911de84c Mon Sep 17 00:00:00 2001 From: Jens Wille Date: Wed, 25 Sep 2024 17:26:09 +0200 Subject: [PATCH] Skip all records with only suppressed holdings/items/portfolios. Mimics similar behaviour in DigiBib IntrOX (Limetrans; relevant Jira issues: DOX-1354, DOX-1568, DOX-1622). --- src/main/resources/alma/alma.fix | 7 +++ src/main/resources/alma/fix/item.fix | 79 ++++++++++++++++------------ 2 files changed, 52 insertions(+), 34 deletions(-) diff --git a/src/main/resources/alma/alma.fix b/src/main/resources/alma/alma.fix index 79394bc33..41cc99579 100644 --- a/src/main/resources/alma/alma.fix +++ b/src/main/resources/alma/alma.fix @@ -52,6 +52,13 @@ include ("./fix/mediumAndType.fix") # mediumAndType.fix is needed ahead of contribution.fix because of dependencies include ("./fix/contribution.fix") +# Skip all records with only suppressed holdings/items/portfolios +if exists("@suppressed") + unless exists("@unsuppressed") + reject() + end +end + vacuum() retain( "@context", diff --git a/src/main/resources/alma/fix/item.fix b/src/main/resources/alma/fix/item.fix index 6ba64ce60..3e0b7bc32 100644 --- a/src/main/resources/alma/fix/item.fix +++ b/src/main/resources/alma/fix/item.fix @@ -19,6 +19,9 @@ do list(path:"ITM ", "var": "$i") copy_field("$i.w","hasItem[].$last.currentLibrary") copy_field("$i.x","hasItem[].$last.currentLocation") call_macro("holdingLibrary+opacLink", mmsIdField:"$i.a",libraryCodeField:"$i.w") + add_field("@unsuppressed", "true") + else + add_field("@suppressed", "true") end end @@ -47,6 +50,9 @@ do list(path: "HOL ", "var": "$i") else call_macro("holdingLibrary+opacLink", mmsIdField:"$i.8",libraryCodeField:"$H52.b") end + add_field("@unsuppressed", "true") + else + add_field("@suppressed", "true") end end end @@ -55,44 +61,49 @@ do list(path: "HOL ", "var": "$i") end do list(path:"POR ", "var": "$i") - copy_field("$i.M","@HOL-M_POR-M.$append") -# entity for every POR .a without POR .A - unless any_match("$i.a",".*6441$") # filter out hbz - set_hash( "hasItem[].$append") - set_array("hasItem[].$last.type[]", "Item", "DigitalDocument") - add_field("hasItem[].$last.label", "Electronic Portfolio") - copy_field("$i.D", "$i.@electronicLocator") - replace_all("$i.@electronicLocator","https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") - paste("hasItem[].$last.electronicLocator", "~https://eu04.alma.exlibrisgroup.com/view/uresolver/","$i.M","$i.@electronicLocator", join_char: "") - copy_field("$i.d", "$i.@sublocation") - replace_all("$i.@sublocation","https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") - paste("hasItem[].$last.sublocation", "~https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/","$i.M","$i.@sublocation", join_char: "") - call_macro("holdingLibrary+opacLink", mmsIdField:"$i.a",libraryCodeField:"$i.g") - end - # entity for every POR .A - if exists ("$i.A") - copy_field("$i.D", "$i.@electronicLocator") - replace_all("$i.@electronicLocator","https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") - copy_field("$i.d", "$i.@sublocation") - replace_all("$i.@sublocation","https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") - do list(path:"$i.A", "var": "$j") + if none_equal("$i.b", "Not Available") + copy_field("$i.M","@HOL-M_POR-M.$append") + # entity for every POR .a without POR .A + unless any_match("$i.a",".*6441$") # filter out hbz set_hash( "hasItem[].$append") set_array("hasItem[].$last.type[]", "Item", "DigitalDocument") add_field("hasItem[].$last.label", "Electronic Portfolio") - paste("hasItem[].$last.electronicLocator", "~https://eu04.alma.exlibrisgroup.com/view/uresolver/","$j","$i.@electronicLocator", join_char: "") - paste("hasItem[].$last.sublocation", "~https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/","$j","$i.@sublocation", join_char: "") - copy_field("$j", "$i.@iz") - lookup("$i.@iz", "alma-iz-code-to-isil") - call_macro("opacLink", field:"@iz") - copy_field("$i.@iz","hasItem[].$last.heldBy.isil") - paste("hasItem[].$last.heldBy.id", "~http://lobid.org/organisations/", "hasItem[].$last.heldBy.isil", "~#!", join_char:"") - copy_field("hasItem[].$last.heldBy.id", "hasItem[].$last.heldBy.label") - set_array("hasItem[].$last.inCollection[]") - paste("hasItem[].$last.inCollection[].$append.id", "~http://lobid.org/organisations/", "$i.@iz", "~#!", join_char:"") - copy_field("hasItem[].$last.inCollection[].$last.id", "hasItem[].$last.inCollection[].$last.label") - # item id is constructed "http://lobid.org/items/[almaMmsId of the record]:[isil of the Owner]:[almaMmsId of the holding]#!" - paste("hasItem[].$last.id", "~http://lobid.org/items/","almaMmsId", "~:", "hasItem[].$last.heldBy.isil","~:", "$i.a","~#!", join_char: "") + copy_field("$i.D", "$i.@electronicLocator") + replace_all("$i.@electronicLocator","https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") + paste("hasItem[].$last.electronicLocator", "~https://eu04.alma.exlibrisgroup.com/view/uresolver/","$i.M","$i.@electronicLocator", join_char: "") + copy_field("$i.d", "$i.@sublocation") + replace_all("$i.@sublocation","https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") + paste("hasItem[].$last.sublocation", "~https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/","$i.M","$i.@sublocation", join_char: "") + call_macro("holdingLibrary+opacLink", mmsIdField:"$i.a",libraryCodeField:"$i.g") + end + # entity for every POR .A + if exists ("$i.A") + copy_field("$i.D", "$i.@electronicLocator") + replace_all("$i.@electronicLocator","https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") + copy_field("$i.d", "$i.@sublocation") + replace_all("$i.@sublocation","https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_NETWORK","") + do list(path:"$i.A", "var": "$j") + set_hash( "hasItem[].$append") + set_array("hasItem[].$last.type[]", "Item", "DigitalDocument") + add_field("hasItem[].$last.label", "Electronic Portfolio") + paste("hasItem[].$last.electronicLocator", "~https://eu04.alma.exlibrisgroup.com/view/uresolver/","$j","$i.@electronicLocator", join_char: "") + paste("hasItem[].$last.sublocation", "~https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/","$j","$i.@sublocation", join_char: "") + copy_field("$j", "$i.@iz") + lookup("$i.@iz", "alma-iz-code-to-isil") + call_macro("opacLink", field:"@iz") + copy_field("$i.@iz","hasItem[].$last.heldBy.isil") + paste("hasItem[].$last.heldBy.id", "~http://lobid.org/organisations/", "hasItem[].$last.heldBy.isil", "~#!", join_char:"") + copy_field("hasItem[].$last.heldBy.id", "hasItem[].$last.heldBy.label") + set_array("hasItem[].$last.inCollection[]") + paste("hasItem[].$last.inCollection[].$append.id", "~http://lobid.org/organisations/", "$i.@iz", "~#!", join_char:"") + copy_field("hasItem[].$last.inCollection[].$last.id", "hasItem[].$last.inCollection[].$last.label") + # item id is constructed "http://lobid.org/items/[almaMmsId of the record]:[isil of the Owner]:[almaMmsId of the holding]#!" + paste("hasItem[].$last.id", "~http://lobid.org/items/","almaMmsId", "~:", "hasItem[].$last.heldBy.isil","~:", "$i.a","~#!", join_char: "") + end end + add_field("@unsuppressed", "true") + else + add_field("@suppressed", "true") end end