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

1888-opacLink #1906

Merged
merged 25 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
225091b
Intoduce a variable for the ALMA IZ #1888
TobiasNx Sep 25, 2023
ce0346b
Draft opac link lookup #1888
TobiasNx Sep 25, 2023
c2e348b
Adjust opac link lookup #1888
TobiasNx Sep 25, 2023
d0e3745
Call the macro later in item.fix #1888
TobiasNx Sep 25, 2023
b32844a
Merge remote-tracking branch 'origin/master' into 1888-opacLink
TobiasNx Sep 26, 2023
efd9ad1
Fix variables for opac link maps #1888
TobiasNx Sep 26, 2023
c34749e
Fix split_field sep_char #1888
TobiasNx Sep 26, 2023
94b2c6c
Test if zdbId exists before mapping opacLinkZdbId #1888
TobiasNx Sep 27, 2023
a6140b3
Only use hbzId opac link for non ZDB resources #1888
TobiasNx Sep 27, 2023
1a21c77
Introduce opac links for isbn and issn #1888
TobiasNx Sep 27, 2023
4f05f37
Update src/main/resources/alma/fix/macros.fix
TobiasNx Sep 27, 2023
ed40503
Update src/main/resources/alma/fix/macros.fix
TobiasNx Sep 27, 2023
43e21f4
Add field variable to macro and change position of call_macro #1888
TobiasNx Sep 27, 2023
cd3547b
Prefer sublibrary opac over IZ opac #1888
TobiasNx Sep 27, 2023
515d577
Refacture heldBy mapping #1888
TobiasNx Sep 27, 2023
27c7d49
Add opac links to all non-physical resources #1888
TobiasNx Sep 27, 2023
a415cd8
Change property name to seeAlso #1888
TobiasNx Sep 28, 2023
5599f3d
Update src/main/resources/alma/fix/item.fix
TobiasNx Sep 28, 2023
dca4580
Fix forgotten change in property name #1888
TobiasNx Sep 28, 2023
20c01d4
Use local maps in test and submodul in prod #1888
TobiasNx Sep 28, 2023
adbda88
Update opac maps #1888
TobiasNx Sep 28, 2023
fcd7604
Add lookup for opac links with almaMmsId #1888
TobiasNx Sep 28, 2023
3e4ea81
Fix almaMmsId Opac Link #1888
TobiasNx Sep 28, 2023
d553266
Merge remote-tracking branch 'origin/master' into 1888-opacLink
TobiasNx Sep 28, 2023
7c6fb57
Reset context.jsonld. (#1906)
blackwinter Sep 28, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,15 @@ public void run() {
fixVariables.put("almaMmsId2rpbId", "../../../../../../lookup-tables/data/almaMmsId2rpbId.tsv");
fixVariables.put("lobidOrganisationsMapping.tsv", "./maps/lobidOrganisationsMapping.tsv");
fixVariables.put("hbzowner2sigel.tsv", "./maps/hbzowner2sigel.tsv");
fixVariables.put("isilRedirect.tsv", "./maps/isilRedirect.tsv");
fixVariables.put("rpb2.ttl", "../../../../../../vocabs/rpb/rpb2.ttl");
fixVariables.put("rpb-spatial.ttl", "../../../../../../vocabs/rpb/rpb-spatial.ttl");
fixVariables.put("rpb.ttl", "../../../../../../vocabs/rpb/rpb.ttl");
fixVariables.put("hbzId2zdbId.tsv", "./maps/hbzId2zdbId.tsv.gz");
fixVariables.put("isil2opac_hbzId.tsv", "./maps/isil2opac_hbzId.tsv");
fixVariables.put("isil2opac_isbn.tsv", "./maps/isil2opac_isbn.tsv");
fixVariables.put("isil2opac_issn.tsv", "./maps/isil2opac_issn.tsv");
fixVariables.put("isil2opac_zdbId.tsv", "./maps/isil2opac_zdbId.tsv");


XmlElementSplitter xmlElementSplitter = new XmlElementSplitter();
xmlElementSplitter.setElementName("record");
Expand Down
70 changes: 37 additions & 33 deletions src/main/resources/alma/fix/item.fix
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,28 @@ 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")
lookup("$i.@sublibraryIsil", "isilRedirect")
# 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.id")
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.a", "hasItem[].$last.heldBy.id")
replace_all("hasItem[].$last.heldBy.id",".*(\\d{4})$","$1")
lookup("hasItem[].$last.heldBy.id", "alma-institution-code-to-isil")
copy_field("$i.@iz","hasItem[].$last.heldBy.isil")
end
copy_field("hasItem[].$last.heldBy.id","hasItem[].$last.heldBy.isil")
prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
append("hasItem[].$last.heldBy.id","#!")
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: "")
Expand All @@ -59,26 +61,28 @@ 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")
lookup("$i.@sublibraryIsil", "isilRedirect")
# 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.id")
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.8", "hasItem[].$last.heldBy.id")
replace_all("hasItem[].$last.heldBy.id",".*(\\d{4})$","$1")
lookup("hasItem[].$last.heldBy.id", "alma-institution-code-to-isil")
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
copy_field("hasItem[].$last.heldBy.id","hasItem[].$last.heldBy.isil")
prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
append("hasItem[].$last.heldBy.id","#!")
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: "")
Expand All @@ -101,12 +105,12 @@ 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", "hasItem[].$last.heldBy.id")
replace_all("hasItem[].$last.heldBy.id",".*(\\d{4})$","$1")
lookup("hasItem[].$last.heldBy.id", "alma-institution-code-to-isil")
copy_field("hasItem[].$last.heldBy.id","hasItem[].$last.heldBy.isil")
prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
append("hasItem[].$last.heldBy.id","#!")
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: "")
Expand All @@ -123,11 +127,11 @@ do list(path:"POR ", "var": "$i")
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", "hasItem[].$last.heldBy.id")
lookup("hasItem[].$last.heldBy.id", "alma-iz-code-to-isil")
copy_field("hasItem[].$last.heldBy.id","hasItem[].$last.heldBy.isil")
prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
append("hasItem[].$last.heldBy.id","#!")
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")
# 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: "")
Expand All @@ -141,12 +145,12 @@ do list(path: "MBD ", "var": "$i")
add_field( "hasItem[].$append.test","")
add_field("hasItem[].$last.label", "lobid Bestandsressource")
set_array("hasItem[].$last.type[]", "Item","NurTitel")
copy_field("$i.i", "hasItem[].$last.heldBy.id")
replace_all("hasItem[].$last.heldBy.id",".*(\\d{4})$","$1")
lookup("hasItem[].$last.heldBy.id", "alma-institution-code-to-isil")
copy_field("hasItem[].$last.heldBy.id","hasItem[].$last.heldBy.isil")
prepend("hasItem[].$last.heldBy.id", "http://lobid.org/organisations/")
append("hasItem[].$last.heldBy.id","#!")
copy_field("$i.i", "$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.i", "~#!", join_char: "")
Expand Down
34 changes: 34 additions & 0 deletions src/main/resources/alma/fix/macros.fix
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,40 @@ do put_macro("provenanceLinks")
append("$[field]", "#!")
end

# opacLink

do put_macro("opacLink")
if exists("zdbId")
copy_field("$i.$[field]", "$i.@opacLinkZdbId")
lookup("$i.@opacLinkZdbId","isil2opac_zdbId", delete:"true")
split_field("$i.@opacLinkZdbId","\\{zdbid\\}")
elsif exists("hbzId")
copy_field("$i.$[field]", "$i.@opacLinkHbzId")
lookup("$i.@opacLinkHbzId","isil2opac_hbzId", delete:"true")
split_field("$i.@opacLinkHbzId","\\{hbzid\\}")
end
if exists("issn[].1")
copy_field("$i.$[field]", "$i.@opacLinkIssn")
lookup("$i.@opacLinkIssn","isil2opac_issn", delete:"true")
split_field("$i.@opacLinkIssn","\\{issn\\}")
end
if exists("isbn[].1")
copy_field("$i.$[field]", "$i.@opacLinkIsbn")
lookup("$i.@opacLinkIsbn","isil2opac_isbn", delete:"true")
split_field("$i.@opacLinkZdbId","\\{isbn\\}")
end
set_array("hasItem[].$last.seeAlso[]")
blackwinter marked this conversation as resolved.
Show resolved Hide resolved
if exists("$i.@opacLinkZdbId.1")
paste("hasItem[].$last.seeAlso[].$append","$i.@opacLinkZdbId.1","zdbId","$i.@opacLinkZdbId.2",join_char:"")
elsif exists("$i.@opacLinkHbzId.1")
paste("hasItem[].$last.seeAlso[].$append","$i.@opacLinkHbzId.1","hbzId","$i.@opacLinkHbzId.2",join_char:"")
elsif exists("$i.@opacLinkIsbn.1")
paste("hasItem[].$last.seeAlso[].$append","$i.@opacLinkIsbn.1","isbn[].1","$i.@opacLinkIsbn.2",join_char:"")
elsif exists("$i.@opacLinkIssn.1")
paste("hasItem[].$last.seeAlso[].$append","$i.@opacLinkIssn.1","issn[].1","$i.@opacLinkIssn.2",join_char:"")
end
end

# for Schlagwortfolgen

do put_macro("schlagwortfolge")
Expand Down
8 changes: 7 additions & 1 deletion src/main/resources/alma/fix/maps.fix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ put_filemap("$[lobidOrganisationsMapping.tsv]","lobidOrgLabels", sep_char:"\t",k

put_filemap("$[lobidOrganisationsMapping.tsv]","sigel2isilMap", sep_char:"\t",key_column:"2",value_column:"1",expected_columns:"-1")
put_filemap("$[hbzowner2sigel.tsv]","hbzowner2sigel", sep_char:"\t",key_column:"0",value_column:"2",expected_columns:"-1")
put_filemap("$[isilRedirect.tsv]","isilRedirect", sep_char:"\t",key_column:"1",value_column:"0",expected_columns:"-1")

put_filemap("$[picaCreatorId2Isil.tsv]","picaCreatorId2Isil", sep_char:"\t", sep_char:"\t",key_column:"0",value_column:"2",expected_columns:"-1")

Expand Down Expand Up @@ -42,6 +41,13 @@ put_filemap("$[almaMmsId2rpbId]","almaMmsId2rpbId", sep_char:"\t",key_column:"0"
# map zdbId to old hbzId(HT Nummer) based on the last aleph transformation
put_filemap("$[hbzId2zdbId.tsv]","zdbId2oldHbzId", sep_char:"\t",key_column:"1",value_column:"0",expected_columns:"-1")

# opac links
put_filemap("$[isil2opac_hbzId.tsv]","isil2opac_hbzId", sep_char:"\t")
put_filemap("$[isil2opac_isbn.tsv]","isil2opac_isbn", sep_char:"\t")
put_filemap("$[isil2opac_issn.tsv]","isil2opac_issn", sep_char:"\t")
put_filemap("$[isil2opac_zdbId.tsv]","isil2opac_zdbId", sep_char:"\t")


put_map("rswk-indicator",
"p": "Person",
"b": "CorporateBody",
Expand Down
Loading
Loading