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

Add workaround if cataloguing dates in 008 that are too long #2118

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add workaround if date in 008 is too long #2114
TobiasNx committed Jan 6, 2025
commit 85629981a62c8160c5dd802139f3b4af04bfef58
10 changes: 8 additions & 2 deletions src/main/resources/alma/fix/describedBy.fix
Original file line number Diff line number Diff line change
@@ -31,10 +31,16 @@ add_field("describedBy.resultOf.instrument.label","Software lobid-resources")
copy_field("almaMmsId","describedBy.resultOf.object.id")
prepend("describedBy.resultOf.object.id","https://lobid.org/marcxml/")

# MNG is a ALMA-specific element (MNG .b only states the indexing date into ALMA, while 008 is the initial cataloguing date.)
# 008/00-05 has the initial cataloguing date. We use MNG info as fallback.
# MNG is a ALMA-specific element (MNG .b only states the indexing date into ALMA.)

copy_field("008","@initialCataloguingDate")
substring("@initialCataloguingDate","0","6")
if any_match("@initialCataloguingDate", "^\\d{8}.*") # Due to cataloguing errors there seem to be year not represented by two but by four digits. The first step is a workaround.
substring("@initialCataloguingDate","2","6")
elsif any_match("@initialCataloguingDate", "^\\d{6}.*") # 008/00-05 is the correct form for the cataloguing date in MARC.
substring("@initialCataloguingDate","0","6")
end

if any_match("@initialCataloguingDate","^[0-4].*")
prepend("@initialCataloguingDate","20")
elsif any_match("@initialCataloguingDate","\\d*")
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/99374515437806441.json
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@
},
"object" : {
"id" : "https://lobid.org/marcxml/99374515437806441",
"dateCreated" : "2020-24-08",
"dateCreated" : "2024-08-16",
"dateModified" : "2024-10-30",
"type" : [ "DataFeedItem" ],
"label" : "hbz-Ressource 99374515437806441 im Exportformat MARC21 XML",