Skip to content

Commit

Permalink
Fix extent for repeated 300 with multiple Subfields
Browse files Browse the repository at this point in the history
Adjust replacement of brackets
  • Loading branch information
Petra Maier committed Mar 21, 2024
1 parent 6495b75 commit c39128c
Show file tree
Hide file tree
Showing 4 changed files with 449 additions and 12 deletions.
33 changes: 22 additions & 11 deletions src/main/resources/alma/fix/otherFields.fix
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,31 @@ prepend("language[].*.id", "http://id.loc.gov/vocabulary/iso639-2/")
# We reuse the introx transformation here.

set_array("@300a")
copy_field("300 .a", "@300a.$append")
set_array("@300c")
do list(path: "300 ", "var": "$i")
copy_field("$i.a", "@300a.$append")
do list(path: "$i.b", "var": "$j")
replace_all("$j", "\\s?[:;+(]?$", "")
copy_field("$j", "@300b")
end
copy_field("$i.c", "@300c.$append")
do list(path: "$i.e", "var": "$j")
replace_all("$j", "[.]?\\s?\\(?$", "")
copy_field("$j", "@300e")
end
end
if exists("@300a.1")
copy_field("@300a.1", "@300a1")
replace_all("@300a1", "\\s?[:;+(]?$", "")
end
if exists("@300a.2")
copy_field("@300a.2", "@300a2")
replace_all("@300a2", "\\s?[:;+)]?$", "")
replace_all("@300a2", "\\s?[:;+]?$", "")
end
do list(path: "300 .b", "var": "$i")
replace_all("$i", "\\s?[:;+(]?$", "")
copy_field("$i", "@300b")
if exists("@300a.3")
copy_field("@300a.3", "@300a3")
replace_all("@300a3", "\\s?[:;+]?$", "")
end
set_array("@300c")
copy_field("300 .c", "@300c.$append")
if exists("@300c.1")
copy_field("@300c.1", "@300c1")
replace_all("@300c1", "[.]?\\s?[:;+(]?$", "")
Expand All @@ -46,16 +56,15 @@ if exists("@300c.2")
copy_field("@300c.2", "@300c2")
replace_all("@300c2", "[.]?\\s?[:;+)]?$", "")
end
do list(path: "300 .e", "var": "$i")
replace_all("$i", "[.]?\\s?\\(?$", "")
copy_field("$i", "@300e")
end
if exists("@300a2")
if exists("@300c2")
paste("@300a2_punct", "@300a2", "~ ; ", join_char: "")
else
paste("@300a2_punct", "@300a2", "~)", join_char: "")
end
if exists("@300a3")
paste("@300a2_punct", "@300a2_punct", "~, (","@300a3", "~)", join_char: "")
end
end
if exists("@300b")
if exists("@300a1")
Expand Down Expand Up @@ -84,6 +93,8 @@ if exists("300 .e")
end
end
paste("extent", "@300a1", "@300b_punct", "@300c1_punct", "@300e_punct", "@300a2_punct", "@300c2_punct", join_char: "")
replace_all("extent", " ", " ")



# 500 - General Note (R) Subfield: $a (NR)
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/alma-fix/990198383780206441.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"id" : "http://id.loc.gov/vocabulary/iso639-2/ger",
"label" : "Deutsch"
} ],
"extent" : "1 CD : digital ; 12 cm, 100 gr ; 1 Booklet [(2)] S (1 CD (75 04 Min. ; 12 cm",
"extent" : "1 CD : digital ; 12 cm, 100 gr ; 1 Booklet [(2)] S (1 CD (75 04 Min.) ; 12 cm",
"hasItem" : [ {
"label" : "lobid Bestandsressource",
"type" : [ "Item", "PhysicalObject" ],
Expand Down
204 changes: 204 additions & 0 deletions src/test/resources/alma-fix/99371426239306441.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
{
"@context" : "http://lobid.org/resources/context.jsonld",
"almaMmsId" : "99371426239306441",
"isbn" : [ "3319599526", "9783319599526" ],
"doi" : [ "10.1007/978-3-319-59952-6" ],
"title" : "Pediatric Vaccines and Vaccinations",
"otherTitleInformation" : [ "A European Textbook" ],
"edition" : [ "1st ed. 2017" ],
"publication" : [ {
"startDate" : "2017",
"type" : [ "PublicationEvent" ],
"location" : [ "Cham" ],
"publishedBy" : [ "Springer International Publishing", "Imprint: Springer" ]
} ],
"describedBy" : {
"id" : "http://lobid.org/resources/99371426239306441",
"label" : "Webseite der hbz-Ressource 99371426239306441",
"type" : [ "BibliographicDescription" ],
"inDataset" : {
"id" : "http://lobid.org/resources/dataset#!",
"label" : "lobid-resources – Der hbz-Verbundkatalog als Linked Open Data"
},
"resultOf" : {
"type" : [ "CreateAction" ],
"endTime" : "0000-00-00T00:00:00",
"instrument" : {
"id" : "https://github.com/hbz/lobid-resources",
"type" : [ "SoftwareApplication" ],
"label" : "Software lobid-resources"
},
"object" : {
"id" : "https://lobid.org/marcxml/99371426239306441",
"dateCreated" : "2022-07-06",
"dateModified" : "2023-10-24",
"type" : [ "DataFeedItem" ],
"label" : "hbz-Ressource 99371426239306441 im Exportformat MARC21 XML",
"inDataset" : {
"id" : "https://datahub.io/dataset/hbz_unioncatalog",
"label" : "hbz_unioncatalog"
},
"sourceOrganization" : {
"id" : "http://lobid.org/organisations/DE-MiAaPQ#!",
"label" : "lobid Organisation"
},
"provider" : {
"id" : "http://lobid.org/organisations/DE-MiAaPQ#!",
"label" : "lobid Organisation"
},
"modifiedBy" : [ {
"id" : "http://lobid.org/organisations/DE-MiAaPQ#!",
"label" : "lobid Organisation"
} ]
}
},
"license" : [ {
"id" : "http://creativecommons.org/publicdomain/zero/1.0",
"label" : "Creative Commons-Lizenz CC0 1.0 Universal"
} ]
},
"sameAs" : [ {
"id" : "https://doi.org/10.1007/978-3-319-59952-6",
"label" : "978-3-319-59952-6"
} ],
"isPartOf" : [ {
"type" : [ "IsPartOfRelation" ],
"hasSuperordinate" : [ {
"label" : "Springer biomedical and life sciences ebooks."
} ]
} ],
"fulltextOnline" : [ {
"id" : "https://doi.org/10.1007/978-3-319-59952-6",
"label" : "DOI-Link"
} ],
"language" : [ {
"id" : "http://id.loc.gov/vocabulary/iso639-2/eng",
"label" : "Englisch"
} ],
"extent" : "1 v. : il. ; 26 cm ; (XIII, 264 p.), (1 online resource (XIII, 264 p. 61 illus., 57 illus. in color.))",
"note" : [ "Incluye índice" ],
"abstract" : [ "This graduate textbook serves as a highly readable guide on vaccines and vaccination in infants, children and adolescents from an European perspective. The first part of the book is dedicated to childhood and adolescent vaccine schedules, maternal and neonatal immunization and safety of vaccines. In a second part we focus on viral and bacterial vaccines. Further chapters discuss pediatric travel vaccines, vaccines in the pipeline and the European registration process. This book is intended to be a reference textbook and will help to standardize the information on vaccines and immunization program in the WHO European Region." ],
"subject" : [ {
"type" : [ "Concept" ],
"source" : {
"label" : "Freie Verschlagwortung",
"id" : "https://www.wikidata.org/wiki/Q47524318"
},
"label" : "Vaccine."
}, {
"type" : [ "Concept" ],
"source" : {
"label" : "Freie Verschlagwortung",
"id" : "https://www.wikidata.org/wiki/Q47524318"
},
"label" : "Immunology."
}, {
"type" : [ "Concept" ],
"source" : {
"label" : "Freie Verschlagwortung",
"id" : "https://www.wikidata.org/wiki/Q47524318"
},
"label" : "Pediatrics."
}, {
"type" : [ "Concept" ],
"source" : {
"label" : "Library of Congress Subject Headings",
"id" : "https://id.loc.gov/authorities/subjects.html"
},
"label" : "Vaccines."
}, {
"type" : [ "Concept" ],
"source" : {
"label" : "Library of Congress Subject Headings",
"id" : "https://id.loc.gov/authorities/subjects.html"
},
"label" : "Immunology."
}, {
"type" : [ "Concept" ],
"source" : {
"label" : "Library of Congress Subject Headings",
"id" : "https://id.loc.gov/authorities/subjects.html"
},
"label" : "Pediatrics."
} ],
"subjectslabels" : [ "Vaccine.", "Immunology.", "Pediatrics.", "Vaccines." ],
"hasItem" : [ {
"type" : [ "Item", "DigitalDocument" ],
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_HHL/openurl?u.ignore_date_coverage=true&portfolio_pid=5343924960006482&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_HHL/openurl?u.ignore_date_coverage=true&rft.mms_id=991001245702106482",
"heldBy" : {
"isil" : "DE-1871",
"id" : "http://lobid.org/organisations/DE-1871#!",
"label" : "Zentrum für Wissensmanagement, Bibliothek Hamm"
},
"id" : "http://lobid.org/items/99371426239306441:DE-1871:5343924960006482#!"
}, {
"type" : [ "Item", "DigitalDocument" ],
"label" : "Electronic Portfolio",
"electronicLocator" : "https://eu04.alma.exlibrisgroup.com/view/uresolver/49HBZ_PAD/openurl?u.ignore_date_coverage=true&portfolio_pid=53180977560006463&Force_direct=true",
"sublocation" : "https://hbz-network.userservices.exlibrisgroup.com/view/uresolver/49HBZ_PAD/openurl?u.ignore_date_coverage=true&rft.mms_id=9925035148406463",
"heldBy" : {
"isil" : "DE-466",
"id" : "http://lobid.org/organisations/DE-466#!",
"label" : "Universitätsbibliothek Paderborn"
},
"seeAlso" : [ "https://katalog.ub.uni-paderborn.de/local/s?sr%5Bq,any%5D=99371426239306441" ],
"id" : "http://lobid.org/items/99371426239306441:DE-466:53180977560006463#!"
} ],
"medium" : [ {
"label" : "Datenträger",
"id" : "http://rdaregistry.info/termList/RDAMediaType/1003"
}, {
"label" : "Online-Ressource",
"id" : "http://rdaregistry.info/termList/RDACarrierType/1018"
} ],
"bibliographicLevel" : {
"label" : "Monograph/Item",
"id" : "https://www.loc.gov/marc/bibliographic/bdleader.html#Monograph_Item"
},
"type" : [ "BibliographicResource", "Book" ],
"responsibilityStatement" : [ "edited by Timo Vesikari, Pierre Van Damme." ],
"contribution" : [ {
"agent" : {
"label" : "Vesikari, Timo",
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/edt",
"label" : "Herausgeber/in"
},
"type" : [ "Contribution" ]
}, {
"agent" : {
"label" : "Vesikari, Timo",
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/http://id.loc.gov/vocabulary/relators/edt",
"label" : "edt"
},
"type" : [ "Contribution" ]
}, {
"agent" : {
"label" : "Van Damme, Pierre",
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/edt",
"label" : "Herausgeber/in"
},
"type" : [ "Contribution" ]
}, {
"agent" : {
"label" : "Van Damme, Pierre",
"type" : [ "Person" ]
},
"role" : {
"id" : "http://id.loc.gov/vocabulary/relators/http://id.loc.gov/vocabulary/relators/edt",
"label" : "edt"
},
"type" : [ "Contribution" ]
} ],
"id" : "http://lobid.org/resources/99371426239306441#!"
}
Loading

0 comments on commit c39128c

Please sign in to comment.