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 40e7d98
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 52 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
83 changes: 47 additions & 36 deletions src/main/resources/alma/fix/item.fix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ set_array("@ITM-H") # Helper element for creating Holding from HOL ("Physikalisc
do list(path:"ITM ", "var": "$i")
paste("$i.supressedLocation", "$i.M", "~+", "$i.x",join_char:"")
lookup("$i.supressedLocation","suppressedLocations",delete:"true")
unless exists("$i.supressedLocation") # Test if location is suppressed with mapping provided by the libraries.
if exists("$i.supressedLocation") # Test if location is suppressed with mapping provided by the libraries.
add_field("@suppressed", "true")
else
add_field("@unsuppressed", "true")
set_hash( "hasItem[].$append")
add_field("hasItem[].$last.label", "lobid Bestandsressource")
set_array("hasItem[].$last.type[]", "Item","PhysicalObject")
Expand Down Expand Up @@ -31,7 +34,10 @@ do list(path: "HOL ", "var": "$i")
if exists("$H52.b")
paste("$H52.supressedLocation", "$i.M", "~+", "$H52.c",join_char:"")
lookup("$H52.supressedLocation","suppressedLocations",delete:"true")
unless exists("$H52.supressedLocation") # Test if location is suppressed with mapping provided by the libraries.
if exists("$H52.supressedLocation") # Test if location is suppressed with mapping provided by the libraries.
add_field("@suppressed", "true")
else
add_field("@unsuppressed", "true")
set_hash( "hasItem[].$append")
add_field("hasItem[].$last.label", "lobid Bestandsressource")
set_array("hasItem[].$last.type[]", "Item","PhysikalischerTitel")
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
16 changes: 0 additions & 16 deletions src/test/resources/alma-fix/99370678063606441.json
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,6 @@
"label" : "Fachhochschule Südwestfalen, Fachbibliothek Hagen, Zentralbibliothek"
} ],
"id" : "http://lobid.org/items/99370678063606441:DE-Hag4:5385225080006461#!"
}, {
"type" : [ "Item", "DigitalDocument" ],
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_FSW/openurl?u.ignore_date_coverage=true&portfolio_pid=5382132500006461&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_FSW/openurl?u.ignore_date_coverage=true&rft.mms_id=9916219546106461",
"heldBy" : {
"isil" : "DE-Hag4",
"id" : "http://lobid.org/organisations/DE-Hag4#!",
"label" : "Fachhochschule Südwestfalen, Fachbibliothek Hagen, Zentralbibliothek"
},
"seeAlso" : [ "https://kai.fh-swf.de/permalink/49HBZ_FSW/ou32r9/alma99370678063606441" ],
"inCollection" : [ {
"id" : "http://lobid.org/organisations/DE-Hag4#!",
"label" : "Fachhochschule Südwestfalen, Fachbibliothek Hagen, Zentralbibliothek"
} ],
"id" : "http://lobid.org/items/99370678063606441:DE-Hag4:5382132500006461#!"
}, {
"type" : [ "Item", "DigitalDocument" ],
"label" : "Electronic Portfolio",
Expand Down

0 comments on commit 40e7d98

Please sign in to comment.