Skip to content

Commit

Permalink
Add workaround if date in 008 is too long #2114
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiasNx committed Jan 6, 2025
1 parent 9f1528b commit 8562998
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/main/resources/alma/fix/describedBy.fix
Original file line number Diff line number Diff line change
Expand Up @@ -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*")
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/99374515437806441.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8562998

Please sign in to comment.