Skip to content

Commit

Permalink
Merge #1834 from remote-tracking branch 'origin/1830-publicationImpro…
Browse files Browse the repository at this point in the history
…vement' into updateTestsAfterEndOfWave3
  • Loading branch information
dr0i committed Sep 19, 2023
2 parents d6d7ae9 + 6f176fc commit cc4c380
Show file tree
Hide file tree
Showing 36 changed files with 180 additions and 170 deletions.
54 changes: 54 additions & 0 deletions src/main/resources/alma/fix/macros.fix
Original file line number Diff line number Diff line change
Expand Up @@ -324,4 +324,58 @@ do put_macro("subjectLabel")
copy_field("$i.z","subject[].$last.label.$append")
copy_field("$i.v","subject[].$last.label.$append")
join_field("subject[].$last.label"," / ")
end

do put_macro("publication")
do list(path:"$[field]", "var":"$i")
add_field("publication[].$append.test","")
do list(path: "$i.c", "var":"$j")
replace_all("$j", "\\[|\\]|ca. |c ", "")
unless exists("publication[].$last.startDate")
if any_match("$j",".*?([01]\\d{3}|20\\d{2}).*")
paste("publication[].$last.startDate", "$j")
end
end
unless exists("publication[].$last.endDate")
if any_match("$j",".*-[ ]?([01]\\d{3}|20\\d{2})$")
paste("publication[].$last.endDate", "$j")
end
end
end
set_array("publication[].$last.type[]","PublicationEvent")
set_array("publication[].$last.location[]")
copy_field("$i.a", "publication[].$last.location[].$append")
set_array("publication[].$last.publishedBy[]")
copy_field("$i.b", "publication[].$last.publishedBy[].$append")
if exists("$i.6")
copy_field("$i.6","$i.linkageTest")
do list(path:"880??","var":"$880")
if in ("$i.linkageTest","$880.linkageTest")
if in ("$880.@script.id","alternateGraphicRepresentation[].*.script.id")
do list(path:"alternateGraphicRepresentation[]","var":"$AGR")
if in ("$880.@script.id","$AGR.script.id")
unless exists("$AGR.record.publication[]")
set_array("$AGR.record.publication[]")
end
add_field ("$AGR.record.publication[].$append.dummi","")
set_array("$AGR.record.publication[].$last.location[]")
copy_field("$880.a", "$AGR.record.publication[].$last.location[].$append")
set_array("$AGR.record.publication[].$last.publishedBy[]")
copy_field("$880.b", "$AGR.record.publication[].$last.publishedBy[].$append")
end
end
else
copy_field("$880.@script.id","alternateGraphicRepresentation[].$append.script.id")
copy_field("$880.@script.label","alternateGraphicRepresentation[].$last.script.label")
set_array("alternateGraphicRepresentation[].$last.publication[]")
add_field ("alternateGraphicRepresentation[].$last.publication[].$append.dummi","")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.location[]")
copy_field("$880.a", "alternateGraphicRepresentation[].$last.publication[].$last.location[].$append")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.publishedBy[]")
copy_field("$880.b", "alternateGraphicRepresentation[].$last.publication[].$last.publishedBy[].$append")
end
end
end
end
end
end
135 changes: 67 additions & 68 deletions src/main/resources/alma/fix/titleRelatedFields.fix
Original file line number Diff line number Diff line change
Expand Up @@ -221,86 +221,85 @@ end
# 264 - Production, Publication, Distribution, Manufacture, and Copyright Notice (R) - Subfield: $a (R), $b (R), $c (R)
# 008,18 for frequency
# 515 - Numbering Peculiarities Note (R)
# Prefer 264 over 260 since it can create duplicate info and 260 is discontinued in RDA.

set_array("publication[]")
do list(path:"260[ 23] |264[ 23][ 1]", "var":"$i")
add_field("publication[].$append.test","")
copy_field("362??.a","publication[].$last.publicationHistory")
do list(path: "$i.c", "var":"$j")
replace_all("$j", "\\[|\\]|ca. |c ", "")
unless exists("publication[].$last.startDate")
if any_match("$j",".*?([01]\\d{3}|20\\d{2}).*")
paste("publication[].$last.startDate", "$j")
if exists("264[ 23][ 1]")
call_macro("publication",field:"2643[ 1]") # 3 - Current/Latest
call_macro("publication",field:"2642[ 1]") # 2 - Intervening
call_macro("publication",field:"264 [ 1]") # # - Not applicable/No information provided/Earliest
else
call_macro("publication",field:"2603[ 1]") # 3 - Current/Latest
call_macro("publication",field:"2602[ 1]") # 2 - Intervening
call_macro("publication",field:"260 [ 1]") # # - Not applicable/No information provided/Earliest
end

# Only add additional publication info to the first publication-object since it is the latest.

if exists("publication[].$first")
copy_field("362??.a","publication[].$first.publicationHistory")
set_array("publication[].$first.frequency[]")
if any_match("leader","^.{6}(a[bis]|m[bis]).*$") # checks if continous ressource
unless any_match("008","^.{18}[#\\| u].*$") # filters out not matching values and also the value unknown
copy_field("008","publication[].$first.frequency[].$append.id")
replace_all("publication[].$first.frequency[].$last.id", "^.{18}(.).*$", "http://marc21rdf.info/terms/continuingfre#$1")
end
end
unless exists("publication[].$last.endDate")
if any_match("$j",".*-[ ]?([01]\\d{3}|20\\d{2})$")
paste("publication[].$last.endDate", "$j")
elsif any_match("006","^s.*$")
do list(path: "006", "var":"$z")
if any_match("$z","^s.*$")
unless any_match("$z","^.[#\\| u].*$")
copy_field("$z","publication[].$first.frequency[].$append.id")
replace_all("publication[].$first.frequency[].$last.id", "^.(.).*$", "http://marc21rdf.info/terms/continuingfre#$1")
end
end
end
end
end
# TODO is there a way to distinguish PublicationEvent and SecondaryPublicationEvent?
set_array("publication[].$last.type[]","PublicationEvent")
set_array("publication[].$last.location[]")
copy_field("$i.a", "publication[].$last.location[].$append")
set_array("publication[].$last.publishedBy[]")
copy_field("$i.b", "publication[].$last.publishedBy[].$append")
set_array("publication[].$last.frequency[]")
if any_match("leader","^.{6}(a[bis]|m[bis]).*$") # checks if continous ressource
unless any_match("008","^.{18}[#\\| u].*$") # filters out not matching values and also the value unknown
copy_field("008","publication[].$last.frequency[].$append.id")
replace_all("publication[].$last.frequency[].$last.id", "^.{18}(.).*$", "http://marc21rdf.info/terms/continuingfre#$1")
set_array("publication[].$first.note[]")
copy_field("515??.a","publication[].$first.note[].$append")
do list(path:"500 ", "var":"$i")
if any_match("$i.a", "^.*saṃ. \\d{4}=(\\d{4}).*Chr.*")
remove_field("publication[].$first.startDate")
copy_field("$i.a","publication[].$first.startDate")
replace_all("publication[].$first.startDate","^.*saṃ. \\d{4}=(\\d{4}).*Chr.*","$1")
end
elsif any_match("006","^s.*$")
do list(path: "006", "var":"$z")
if any_match("$z","^s.*$")
unless any_match("$z","^.[#\\| u].*$")
copy_field("$z","publication[].$last.frequency[].$append.id")
replace_all("publication[].$last.frequency[].$last.id", "^.(.).*$", "http://marc21rdf.info/terms/continuingfre#$1")
end
# Add fallbacks for missing publication dates and other publication info.
do list(path:"260[ 3][ 1]", "var":"$i")
do list(path: "$i.c", "var":"$j")
replace_all("$j", "\\[|\\]|ca. |c ", "")
unless exists("publication[].$first.startDate")
if any_match("$j",".*?([01]\\d{3}|20\\d{2}).*")
paste("publication[].$first.startDate", "$j")
end
end
end
end
set_array("publication[].$last.note[]")
copy_field("515??.a","publication[].$last.note[].$append")
if exists("$i.6")
copy_field("$i.6","$i.linkageTest")
do list(path:"880??","var":"$880")
if in ("$i.linkageTest","$880.linkageTest")
if in ("$880.@script.id","alternateGraphicRepresentation[].*.script.id")
do list(path:"alternateGraphicRepresentation[]","var":"$AGR")
if in ("$880.@script.id","$AGR.script.id")
unless exists("$AGR.record.publication[]")
set_array("$AGR.record.publication[]")
end
add_field ("$AGR.record.publication[].$append.dummi","")
set_array("$AGR.record.publication[].$last.location[]")
copy_field("$880.a", "$AGR.record.publication[].$last.location[].$append")
set_array("$AGR.record.publication[].$last.publishedBy[]")
copy_field("$880.b", "$AGR.record.publication[].$last.publishedBy[].$append")
end
end
else
copy_field("$880.@script.id","alternateGraphicRepresentation[].$append.script.id")
copy_field("$880.@script.label","alternateGraphicRepresentation[].$last.script.label")
set_array("alternateGraphicRepresentation[].$last.publication[]")
add_field ("alternateGraphicRepresentation[].$last.publication[].$append.dummi","")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.location[]")
copy_field("$880.a", "alternateGraphicRepresentation[].$last.publication[].$last.location[].$append")
set_array("alternateGraphicRepresentation[].$last.publication[].$last.publishedBy[]")
copy_field("$880.b", "alternateGraphicRepresentation[].$last.publication[].$last.publishedBy[].$append")
unless exists("publication[].$first.endDate")
if any_match("$j",".*-[ ]?([01]\\d{3}|20\\d{2})$")
paste("publication[].$last.endDate", "$j")
end
end
unless exists("publication[].$first.location[].1")
copy_field("$i.a", "publication[].$first.location[].$append")
end
unless exists("publication[].$first.publishedBy[].1")
copy_field("$i.b", "publication[].$first.publishedBy[].$append")
end
end
end
end


do list(path:"500 ", "var":"$i")
if any_match("$i.a", "^.*saṃ. \\d{4}=(\\d{4}).*Chr.*")
remove_field("publication[].$last.startDate")
copy_field("$i.a","publication[].$last.startDate")
replace_all("publication[].$last.startDate","^.*saṃ. \\d{4}=(\\d{4}).*Chr.*","$1")
unless exists("publication[].$first.startDate[]")
if any_match("008","^.{6}[brestikm](\\d{4}).*$")
copy_field("008","@008startDate")
replace_all("@008startDate","^.{7}(\\d{4}).*$","$1")
copy_field("@008startDate","publication[].$first.startDate")
end
end
unless exists("publication[].$first.endDate[]")
if any_match("008","^.{6}[km]\\d{4}(\\d{4}).*$")
copy_field("008","@008endDate")
replace_all("@008endDate","^.{11}(\\d{4}).*$","$1")
unless any_equal("@008endDate","9999")
copy_field("@008endDate","publication[].$first.endDate")
end
end
end
end

Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990052965140206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"oclcNumber" : [ "183288969" ],
"title" : "Zweckverband Naturpark Kottenforst-Ville",
"publication" : [ {
"publicationHistory" : "1.1985 - 4.2001; damit Ersch. eingest.",
"type" : [ "PublicationEvent" ],
"location" : [ "Köln [i.e.] Pulheim" ],
"publishedBy" : [ "Rheinland-Verl." ]
"publishedBy" : [ "Rheinland-Verl." ],
"publicationHistory" : "1.1985 - 4.2001; damit Ersch. eingest."
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/990052965140206441",
Expand Down
9 changes: 2 additions & 7 deletions src/test/resources/alma-fix/990053976760206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,20 @@
"hbzId" : "HT000312236",
"title" : "Physik in der Schule",
"publication" : [ {
"publicationHistory" : "2.1964,7 - 38.2000",
"startDate" : "1964",
"endDate" : "2000",
"type" : [ "PublicationEvent" ],
"location" : [ "Berlin" ],
"publishedBy" : [ "Pädagogischer Zeitschriftenverl." ],
"publicationHistory" : "2.1964,7 - 38.2000",
"frequency" : [ {
"id" : "http://marc21rdf.info/terms/continuingfre#m",
"label" : "monatlich"
} ]
}, {
"publicationHistory" : "2.1964,7 - 38.2000",
"type" : [ "PublicationEvent" ],
"location" : [ "Berlin" ],
"publishedBy" : [ "Verl. Volk & Wissen" ],
"frequency" : [ {
"id" : "http://marc21rdf.info/terms/continuingfre#m",
"label" : "monatlich"
} ]
"publishedBy" : [ "Verl. Volk & Wissen" ]
} ],
"shortTitle" : [ "Phys. Sch." ],
"describedBy" : {
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990054215550206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"alternativeTitle" : [ "Bulletin annuel de statistiques des transports pour l'Europe et l'Amérique du Nord", "Ežegodnyj bjulleten' statistiki transporta dlja Evropy i Severnoj Ameriki", "Annual bulletin of transport statistics for Europe ( Hauptsacht. bis 44.1994 )", "Bulletin annuel de statistiques de transports européens ( Parallelsacht. bis 44.1994 )", "Ežegodnyj bjulleten' evropejskoj statistiki transporta ( Parallelsacht. bis 44.1994 )" ],
"otherTitleInformation" : [ "= Bulletin annuel de statistiques des transports pour l'Europe et l'Amérique du Nord = Ežegodnyj bjulleten' statistiki transporta dlja Evropy i Severnoj Ameriki" ],
"publication" : [ {
"publicationHistory" : "6.1954(1955) - 52.2004",
"startDate" : "1955",
"endDate" : "2004",
"type" : [ "PublicationEvent" ],
"location" : [ "Genève [u.a.]" ],
"publishedBy" : [ "UN" ]
"publishedBy" : [ "UN" ],
"publicationHistory" : "6.1954(1955) - 52.2004"
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/990054215550206441",
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990054301770206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"alternativeTitle" : [ "Reisen in Deutschland / 2", "Bayern ( Sachl. Benennung bis 25.1975 )" ],
"otherTitleInformation" : [ "deutsches Handbuch für Fremdenverkehr" ],
"publication" : [ {
"publicationHistory" : "19.[1966] - 34.1984",
"startDate" : "1966",
"endDate" : "1984",
"type" : [ "PublicationEvent" ],
"location" : [ "Darmstadt" ],
"publishedBy" : [ "Jaeger" ]
"publishedBy" : [ "Jaeger" ],
"publicationHistory" : "19.[1966] - 34.1984"
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/990054301770206441",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990054345550206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"title" : "Eilendorfer Heimatblätter",
"otherTitleInformation" : [ "Jahresschrift des Heimatvereins Eilendorf 1983 e.V" ],
"publication" : [ {
"publicationHistory" : "1.1983(1984) -",
"startDate" : "1984",
"type" : [ "PublicationEvent" ],
"location" : [ "Aachen-Eilendorf" ],
"publishedBy" : [ "Heimatverein" ],
"publicationHistory" : "1.1983(1984) -",
"frequency" : [ {
"id" : "http://marc21rdf.info/terms/continuingfre#z",
"label" : "unregelmäßig oder sonstige Erscheinungsfrequenz"
Expand Down
9 changes: 2 additions & 7 deletions src/test/resources/alma-fix/990055981810206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,20 @@
"title" : "Bochumer Zeitpunkte",
"otherTitleInformation" : [ "Beiträge zur Stadtgeschichte, Heimatkunde und Denkmalpflege" ],
"publication" : [ {
"publicationHistory" : "1.1991 -",
"startDate" : "1991",
"type" : [ "PublicationEvent" ],
"location" : [ "Bochum" ],
"publishedBy" : [ "Kortum-Gesellschaft Bochum" ],
"publicationHistory" : "1.1991 -",
"frequency" : [ {
"id" : "http://marc21rdf.info/terms/continuingfre#z",
"label" : "unregelmäßig oder sonstige Erscheinungsfrequenz"
} ]
}, {
"publicationHistory" : "1.1991 -",
"startDate" : "1991",
"type" : [ "PublicationEvent" ],
"location" : [ "Bochum" ],
"publishedBy" : [ "Kracht" ],
"frequency" : [ {
"id" : "http://marc21rdf.info/terms/continuingfre#z",
"label" : "unregelmäßig oder sonstige Erscheinungsfrequenz"
} ]
"publishedBy" : [ "Kracht" ]
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/990055981810206441",
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990103770440206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"hbzId" : "HT012224491",
"title" : "Wettersbacher Anzeiger",
"publication" : [ {
"publicationHistory" : "Nachgewiesen 1979 -",
"startDate" : "1972",
"type" : [ "PublicationEvent" ],
"location" : [ "Weil der Stadt" ],
"publishedBy" : [ "Nussbaum" ],
"publicationHistory" : "Nachgewiesen 1979 -",
"frequency" : [ {
"id" : "http://marc21rdf.info/terms/continuingfre#w",
"label" : "wöchentlich"
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990103899140206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"hbzId" : "HT012237361",
"title" : "Statistische Berichte des Statistischen Landesamtes Rheinland-Pfalz, L. IV. 6: Finanzen und Steuern. Einheitswerte des Grundvermögens nach der Hauptfeststellung : Gemeindeergebnisse",
"publication" : [ {
"publicationHistory" : "1964(1975); damit Ersch. eingest.",
"startDate" : "1975",
"endDate" : "1975",
"type" : [ "PublicationEvent" ],
"location" : [ "Bad Ems" ],
"publishedBy" : [ "Statist. Landesamt" ]
"publishedBy" : [ "Statist. Landesamt" ],
"publicationHistory" : "1964(1975); damit Ersch. eingest."
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/990103899140206441",
Expand Down
4 changes: 2 additions & 2 deletions src/test/resources/alma-fix/990104908070206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"alternativeTitle" : [ "Appropriation acts ( Nebent. d. Mikrofiche-Ausg. )" ],
"otherTitleInformation" : [ "passed at the session of ..." ],
"publication" : [ {
"publicationHistory" : "Nachgewiesen 1911 -",
"startDate" : "1911",
"type" : [ "PublicationEvent" ],
"location" : [ "Harrisburg, Pa." ],
"publishedBy" : [ "[Verlag nicht ermittelbar]" ]
"publishedBy" : [ "[Verlag nicht ermittelbar]" ],
"publicationHistory" : "Nachgewiesen 1911 -"
}, {
"type" : [ "SecondaryPublicationEvent" ],
"location" : [ "Buffalo, NY" ],
Expand Down
Loading

0 comments on commit cc4c380

Please sign in to comment.