Skip to content

Commit

Permalink
Skip all records with only suppressed holdings/items/portfolios.
Browse files Browse the repository at this point in the history
Mimics similar behaviour in DigiBib IntrOX (Limetrans; relevant Jira issues: DOX-1354, DOX-1568, DOX-1622).
  • Loading branch information
blackwinter committed Sep 25, 2024
1 parent ddcd72b commit a7fdbd9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 34 deletions.
7 changes: 7 additions & 0 deletions src/main/resources/alma/alma.fix
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
79 changes: 45 additions & 34 deletions src/main/resources/alma/fix/item.fix
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit a7fdbd9

Please sign in to comment.