Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1917 por g sublibrary location #1918

Merged
merged 5 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 3 additions & 59 deletions src/main/resources/alma/fix/item.fix
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,7 @@ do list(path:"ITM ", "var": "$i")
copy_field("$i.b", "hasItem[].$last.serialNumber")
copy_field("$i.w","hasItem[].$last.currentLibrary")
copy_field("$i.x","hasItem[].$last.currentLocation")
copy_field("$i.a", "$i.@iz")
replace_all("$i.@iz",".*(\\d{4})$","$1")
lookup("$i.@iz", "alma-institution-code-to-isil")
copy_field("$i.w","$i.@sublibraryIsil")
lookup("$i.@sublibraryIsil", "hbzowner2sigel",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","~+","$i.w",join_char:"")
lookup("$i.@sublibraryIsil", "sublibraryIsil",delete:"true")
end
if exists("$i.@sublibraryIsil")
copy_field("$i.@sublibraryIsil","hasItem[].$last.heldBy.isil")
# if no mapping for a sublocation code is provided or no sublocation code exists ($i.w) the main library ISIL is used.
else
copy_field("$i.@iz","hasItem[].$last.heldBy.isil")
end
call_macro("opacLink", field:"@sublibraryIsil")
unless exists("hasItem[].$last.seeAlso[].1")
call_macro("opacLink", field:"@iz")
end
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")
# 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: "")
call_macro("holdingLibrary+opacLink", mmsIdField:"$i.a",libraryCodeField:"$i.w")
end
end

Expand All @@ -61,31 +37,7 @@ do list(path: "HOL ", "var": "$i")
copy_field("$H52.b","hasItem[].$last.currentLibrary")
copy_field("$H52.c","hasItem[].$last.currentLocation")
copy_field("$H52.h", "hasItem[].$last.callNumber")
copy_field("$i.8", "$i.@iz")
replace_all("$i.@iz",".*(\\d{4})$","$1")
lookup("$i.@iz", "alma-institution-code-to-isil")
copy_field("$H52.b","$i.@sublibraryIsil")
lookup("$i.@sublibraryIsil", "hbzowner2sigel",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","~+","$H52.b",join_char:"")
lookup("$i.@sublibraryIsil", "sublibraryIsil",delete:"true")
end
if exists("$i.@sublibraryIsil")
copy_field("$i.@sublibraryIsil", "hasItem[].$last.heldBy.isil")
# if no mapping for a sublocation code is provided or no sublocation code exists ($i.w) the main library ISIL is used.
else
copy_field("$i.@iz", "hasItem[].$last.heldBy.isil")
end
call_macro("opacLink", field:"@sublibraryIsil")
unless exists("hasItem[].$last.seeAlso[].1")
call_macro("opacLink", field:"@iz")
end
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")
# 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.8","~#!", join_char: "")
call_macro("holdingLibrary+opacLink", mmsIdField:"$i.8",libraryCodeField:"$H52.b")
end
end
end
Expand All @@ -105,15 +57,7 @@ do list(path:"POR ", "var": "$i")
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: "")
copy_field("$i.a", "$i.@iz")
replace_all("$i.@iz",".*(\\d{4})$","$1")
lookup("$i.@iz", "alma-institution-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")
# 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: "")
call_macro("holdingLibrary+opacLink", mmsIdField:"$i.a",libraryCodeField:"$i.g")
end
# entity for every POR .A
if exists ("$i.A")
Expand Down
30 changes: 30 additions & 0 deletions src/main/resources/alma/fix/macros.fix
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,36 @@ do put_macro("provenanceLinks")
append("$[field]", "#!")
end

# holding institution differentiating between library and sublibrary (libraryCode) and adding opacLink

do put_macro("holdingLibrary+opacLink")
copy_field("$[mmsIdField]", "$i.@iz")
replace_all("$i.@iz",".*(\\d{4})$","$1")
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")
# 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:"")
lookup("$i.@sublibraryIsil", "sublibraryIsil",delete:"true")
end
if exists("$i.@sublibraryIsil")
copy_field("$i.@sublibraryIsil", "hasItem[].$last.heldBy.isil")
# if no mapping for a sublocation code is provided or no sublocation code exists ($i.w) the main library ISIL is used.
else
copy_field("$i.@iz", "hasItem[].$last.heldBy.isil")
end
call_macro("opacLink", field:"@sublibraryIsil")
unless exists("hasItem[].$last.seeAlso[].1")
call_macro("opacLink", field:"@iz")
end
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")
# 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","~:", "$[mmsIdField]","~#!", join_char: "")
end

# opacLink

do put_macro("opacLink")
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/alma-fix/990021974470206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@
"currentLibrary" : "HIS",
"currentLocation" : "HIS_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-11",
"id" : "http://lobid.org/organisations/DE-294-11#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Geschichtswissenschaft, Historische Bibliothek"
},
"id" : "http://lobid.org/items/990021974470206441:DE-294:23118570990006471#!"
"id" : "http://lobid.org/items/990021974470206441:DE-294-11:23118570990006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/alma-fix/990053976760206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -423,12 +423,12 @@
"currentLocation" : "PHYS_Z",
"callNumber" : "ohne Sign.",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-16",
"id" : "http://lobid.org/organisations/DE-294-16#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Physik und Astronomie, Bibliothek"
},
"seeAlso" : [ "https://suchen.ub.rub.de/zdbid/123550-3" ],
"id" : "http://lobid.org/items/990053976760206441:DE-294:22175660800006471#!"
"id" : "http://lobid.org/items/990053976760206441:DE-294-16:22175660800006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysikalischerTitel" ],
Expand Down
24 changes: 12 additions & 12 deletions src/test/resources/alma-fix/990058434730206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,11 @@
"currentLibrary" : "HIS",
"currentLocation" : "HIS_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-11",
"id" : "http://lobid.org/organisations/DE-294-11#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Geschichtswissenschaft, Historische Bibliothek"
},
"id" : "http://lobid.org/items/990058434730206441:DE-294:23169547890006471#!"
"id" : "http://lobid.org/items/990058434730206441:DE-294-11:23169547890006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand All @@ -345,11 +345,11 @@
"currentLibrary" : "EVTH",
"currentLocation" : "EVTH_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-21",
"id" : "http://lobid.org/organisations/DE-294-21#!",
"label" : "Ruhr-Universität Bochum, Evangelisch-theologisches Seminar, Bibliothek"
},
"id" : "http://lobid.org/items/990058434730206441:DE-294:23169547870006471#!"
"id" : "http://lobid.org/items/990058434730206441:DE-294-21:23169547870006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand All @@ -358,11 +358,11 @@
"currentLibrary" : "KTH",
"currentLocation" : "KTH_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-38",
"id" : "http://lobid.org/organisations/DE-294-38#!",
"label" : "Ruhr-Universität Bochum, Zentrales katholisch-theologisches Seminar, Bibliothek"
},
"id" : "http://lobid.org/items/990058434730206441:DE-294:23169547850006471#!"
"id" : "http://lobid.org/items/990058434730206441:DE-294-38:23169547850006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down
24 changes: 12 additions & 12 deletions src/test/resources/alma-fix/990058567920206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@
"currentLibrary" : "SOZ",
"currentLocation" : "SOZ_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-17",
"id" : "http://lobid.org/organisations/DE-294-17#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Sozialwissenschaft, Bibliothek"
},
"id" : "http://lobid.org/items/990058567920206441:DE-294:23163521090006471#!"
"id" : "http://lobid.org/items/990058567920206441:DE-294-17:23163521090006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand All @@ -456,11 +456,11 @@
"currentLibrary" : "HIS",
"currentLocation" : "HIS_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-11",
"id" : "http://lobid.org/organisations/DE-294-11#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Geschichtswissenschaft, Historische Bibliothek"
},
"id" : "http://lobid.org/items/990058567920206441:DE-294:23163521110006471#!"
"id" : "http://lobid.org/items/990058567920206441:DE-294-11:23163521110006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down Expand Up @@ -495,11 +495,11 @@
"currentLibrary" : "KTH",
"currentLocation" : "KTH_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-38",
"id" : "http://lobid.org/organisations/DE-294-38#!",
"label" : "Ruhr-Universität Bochum, Zentrales katholisch-theologisches Seminar, Bibliothek"
},
"id" : "http://lobid.org/items/990058567920206441:DE-294:23163521070006471#!"
"id" : "http://lobid.org/items/990058567920206441:DE-294-38:23163521070006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down
16 changes: 8 additions & 8 deletions src/test/resources/alma-fix/990075429930206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,11 @@
"currentLibrary" : "HIS",
"currentLocation" : "HIS_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-11",
"id" : "http://lobid.org/organisations/DE-294-11#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Geschichtswissenschaft, Historische Bibliothek"
},
"id" : "http://lobid.org/items/990075429930206441:DE-294:2399479480006471#!"
"id" : "http://lobid.org/items/990075429930206441:DE-294-11:2399479480006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand All @@ -220,11 +220,11 @@
"currentLibrary" : "GER",
"currentLocation" : "GER_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-23",
"id" : "http://lobid.org/organisations/DE-294-23#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Philologie, Germanistisches Institut, Bibliothek"
},
"id" : "http://lobid.org/items/990075429930206441:DE-294:2399479440006471#!"
"id" : "http://lobid.org/items/990075429930206441:DE-294-23:2399479440006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990156027740206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_UBD/openurl?u.ignore_date_coverage=true&portfolio_pid=53209607190006445&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_UBD/openurl?u.ignore_date_coverage=true&rft.mms_id=991010117289706445",
"seeAlso" : [ "https://katalog.ub.tu-dortmund.de/id/ir01388a:ubd.lobid:990156027740206441" ],
"heldBy" : {
"isil" : "DE-290",
"id" : "http://lobid.org/organisations/DE-290#!",
"label" : "Universitätsbibliothek Dortmund"
},
"seeAlso" : [ "https://katalog.ub.tu-dortmund.de/id/ir01388a:ubd.lobid:990156027740206441" ],
"id" : "http://lobid.org/items/990156027740206441:DE-290:53209607190006445#!"
} ],
"medium" : [ {
Expand Down
16 changes: 8 additions & 8 deletions src/test/resources/alma-fix/990156060190206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -516,11 +516,11 @@
"currentLibrary" : "SOZ",
"currentLocation" : "SOZ_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-17",
"id" : "http://lobid.org/organisations/DE-294-17#!",
"label" : "Ruhr-Universität Bochum, Fakultät für Sozialwissenschaft, Bibliothek"
},
"id" : "http://lobid.org/items/990156060190206441:DE-294:23181911570006471#!"
"id" : "http://lobid.org/items/990156060190206441:DE-294-17:23181911570006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand All @@ -529,11 +529,11 @@
"currentLibrary" : "PHILO",
"currentLocation" : "PHILO_BIB",
"heldBy" : {
"isil" : "DE-294",
"id" : "http://lobid.org/organisations/DE-294#!",
"label" : "Ruhr-Universität Bochum, Universitätsbibliothek"
"isil" : "DE-294-28",
"id" : "http://lobid.org/organisations/DE-294-28#!",
"label" : "Ruhr-Universität Bochum, Institut für Philosophie, Bibliothek"
},
"id" : "http://lobid.org/items/990156060190206441:DE-294:23181911550006471#!"
"id" : "http://lobid.org/items/990156060190206441:DE-294-28:23181911550006471#!"
}, {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down
Loading
Loading