From a92ef73e8b2cdf2316d6b55144416b557367a616 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 24 Aug 2023 15:47:26 +0100 Subject: [PATCH 01/37] Omit 041 Language Code when only one language (i.e. already covered by 008) --- thoth-export-server/src/marc21/marc21record_thoth.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 7fb220be..f073be90 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -436,6 +436,11 @@ fn contributor_fields(contributions: &[WorkContributions]) -> ThothResult Option { + if languages.len() == 1 { + // 041 language fields are not needed when there is only one language + // (already represented in field 008 positions 35-37) + return None; + } let (original_codes, into_codes, from_codes): (Vec<_>, Vec<_>, Vec<_>) = languages.iter().fold( (Vec::new(), Vec::new(), Vec::new()), |(mut orig, mut into, mut from), l| { @@ -1090,10 +1095,7 @@ pub(crate) mod tests { language_relation: LanguageRelation::ORIGINAL, main_language: true, }]; - assert_eq!( - language_field(&languages).unwrap().get_data(), - b"0\\\x1faeng" - ); + assert_eq!(language_field(&languages), None); } #[test] From ece559f43483486cfcb0ee3d2654b10a3802c8eb Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:11:43 +0100 Subject: [PATCH 02/37] Don't capitalise relator terms in 100 and 700 fields --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 28 +++++++++---------- .../src/xml/marc21xml_thoth.rs | 4 +-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 1cf2b74d..ad1c74a7 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02384nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2oclc\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eAuthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$h[electronic resource] :$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eEditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$eTranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02384nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2oclc\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$h[electronic resource] :$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index f073be90..17d5e618 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -413,7 +413,7 @@ fn contributor_fields(contributions: &[WorkContributions]) -> ThothResult>() .join(", "); @@ -917,7 +917,7 @@ pub(crate) mod tests { let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap()]); assert_eq!(contributor_fields(&contributions), expected); } @@ -935,11 +935,11 @@ pub(crate) mod tests { let expected = Ok(vec![ FieldRepr::from((b"700", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Editor".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "editor".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) .add_subfield(b"a", "John Smith".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Translator".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "translator".as_bytes())) .unwrap(), ]); assert_eq!(contributor_fields(&contributions), expected); @@ -960,11 +960,11 @@ pub(crate) mod tests { let expected = Ok(vec![ FieldRepr::from((b"100", "1\\")) .add_subfield(b"a", "John Smith".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Editor, Translator".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "editor, translator".as_bytes())) .unwrap(), ]); assert_eq!(contributor_fields(&contributions), expected); @@ -992,19 +992,19 @@ pub(crate) mod tests { let expected = Ok(vec![ FieldRepr::from((b"100", "1\\")) .add_subfield(b"a", "John Smith".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) .add_subfield(b"a", "Bob Johnson".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Introduction By".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "introduction by".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) .add_subfield(b"a", "Juan García".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Translator".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "translator".as_bytes())) .unwrap(), ]); assert_eq!(contributor_fields(&contributions), expected); @@ -1028,7 +1028,7 @@ pub(crate) mod tests { let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .and_then(|f| f.add_subfield(b"u", "Thoth University".as_bytes())) .unwrap()]); assert_eq!(contributor_fields(&contributions), expected); @@ -1064,7 +1064,7 @@ pub(crate) mod tests { let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .and_then(|f| f.add_subfield(b"u", "Thoth University".as_bytes())) .unwrap()]); assert_eq!(contributor_fields(&contributions), expected); @@ -1082,7 +1082,7 @@ pub(crate) mod tests { let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) .add_subfield(b"a", "Jane Doe".as_bytes()) - .and_then(|f| f.add_subfield(b"e", "Author".as_bytes())) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .and_then(|f| f.add_subfield(b"1", "https://orcid.org/0000-0002-0000-0011".as_bytes())) .unwrap()]); assert_eq!(contributor_fields(&contributions), expected); @@ -1470,7 +1470,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02384nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002100280040002200301041001300323050000900336072001600345072002300361072001500384100008100399245011800480250001600598264003600614264001100650300002300661336002600684337002600710338003600736490003900772500008300811504005300894505006000947506004801007520003101055536006801086538003601154540022301190588005801413700006301471700003401534710002901568830003901597856005801636856005901694856007701753\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2oclc\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eAuthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}h[electronic resource] :\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eEditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}eTranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02384nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002100280040002200301041001300323050000900336072001600345072002300361072001500384100008100399245011800480250001600598264003600614264001100650300002300661336002600684337002600710338003600736490003900772500008300811504005300894505006000947506004801007520003101055536006801086538003601154540022301190588005801413700006301471700003401534710002901568830003901597856005801636856005901694856007701753\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2oclc\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}h[electronic resource] :\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 47a30778..ab3ff18c 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n Author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n Editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n Translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n Author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n Editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n Translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n Author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n Editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n Translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 14f227e09660308b9653b44b701128559e2ed09f Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 24 Aug 2023 16:35:54 +0100 Subject: [PATCH 03/37] Standard Identifier Source Code for OCLC in 024 is 'worldcat', not 'oclc' --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 4 ++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index ad1c74a7..fa2d309d 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02384nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2oclc\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$h[electronic resource] :$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02388nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$h[electronic resource] :$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 17d5e618..c72092d1 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -129,7 +129,7 @@ impl Marc21Entry for Work { if let Some(oclc) = &self.oclc { FieldRepr::from((b"024", "7\\")) .add_subfield(b"a", oclc.clone().as_bytes()) - .and_then(|f| f.add_subfield(b"2", "oclc")) + .and_then(|f| f.add_subfield(b"2", "worldcat")) .and_then(|f| builder.add_field(f))?; } @@ -1470,7 +1470,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02384nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002100280040002200301041001300323050000900336072001600345072002300361072001500384100008100399245011800480250001600598264003600614264001100650300002300661336002600684337002600710338003600736490003900772500008300811504005300894505006000947506004801007520003101055536006801086538003601154540022301190588005801413700006301471700003401534710002901568830003901597856005801636856005901694856007701753\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2oclc\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}h[electronic resource] :\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02388nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245011800484250001600602264003600618264001100654300002300665336002600688337002600714338003600740490003900776500008300815504005300898505006000951506004801011520003101059536006801090538003601158540022301194588005801417700006301475700003401538710002901572830003901601856005801640856005901698856007701757\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}h[electronic resource] :\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index ab3ff18c..6d7c38d4 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02388nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02384nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n oclc\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02388nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02388nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From bbb12e2d43ed2b7388e9df7c47a935df992d5328 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:42:48 +0100 Subject: [PATCH 04/37] Fix formatting --- thoth-export-server/src/marc21/marc21record_thoth.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index c0fe1fe3..81c8f055 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -413,7 +413,11 @@ fn contributor_fields(contributions: &[WorkContributions]) -> ThothResult>() .join(", "); From 448c6be04ede1c9acf2a1228a67005f13ce5645a Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 28 Aug 2023 15:43:43 +0100 Subject: [PATCH 05/37] 245 Title subfield h Medium is redundant in RDA (covered by 338) --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 3 +-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index fa2d309d..29c0ecb2 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02388nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$h[electronic resource] :$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02363nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 81c8f055..4cd25fe8 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -189,7 +189,6 @@ impl Marc21Entry for Work { // 245 – title FieldRepr::from((b"245", "00")) .add_subfield(b"a", self.title.clone().into_bytes()) - .and_then(|f| f.add_subfield(b"h", b"[electronic resource] :")) .and_then(|f| { if let Some(subtitle) = self.subtitle.clone() { f.add_subfield(b"b", subtitle.into_bytes()) @@ -1474,7 +1473,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02388nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245011800484250001600602264003600618264001100654300002300665336002600688337002600714338003600740490003900776500008300815504005300898505006000951506004801011520003101059536006801090538003601158540022301194588005801417700006301475700003401538710002901572830003901601856005801640856005901698856007701757\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}h[electronic resource] :\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02363nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009300484250001600577264003600593264001100629300002300640336002600663337002600689338003600715490003900751500008300790504005300873505006000926506004800986520003101034536006801065538003601133540022301169588005801392700006301450700003401513710002901547830003901576856005801615856005901673856007701732\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 6d7c38d4..b4948526 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02388nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02363nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02388nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02388nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n [electronic resource] :\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02363nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02363nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 63850582449c63a24ce9bc0014194309e0261ba5 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 29 Aug 2023 10:27:29 +0100 Subject: [PATCH 06/37] Fix 245 Title punctuation (colon before b subfield, slash before c subfield) --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 23 ++++++++++--------- .../src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 29c0ecb2..fcd4336a 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02363nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title$bBook Subtitle$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02367nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 4cd25fe8..86667c1e 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -187,16 +187,17 @@ impl Marc21Entry for Work { } // 245 – title - FieldRepr::from((b"245", "00")) - .add_subfield(b"a", self.title.clone().into_bytes()) - .and_then(|f| { - if let Some(subtitle) = self.subtitle.clone() { - f.add_subfield(b"b", subtitle.into_bytes()) - } else { - Ok(f) - } - }) - .and_then(|f| f.add_subfield(b"c", contributors_string(&self.contributions).as_bytes())) + let mut title_field = FieldRepr::from((b"245", "00")); + if let Some(subtitle) = self.subtitle.clone() { + title_field = title_field + .add_subfield(b"a", format!("{} :", self.title.clone()).as_bytes()) + .and_then(|f| f.add_subfield(b"b", format!("{} /", subtitle).as_bytes()))?; + } else { + title_field = + title_field.add_subfield(b"a", format!("{} /", self.title.clone()).as_bytes())?; + } + title_field + .add_subfield(b"c", contributors_string(&self.contributions).as_bytes()) .and_then(|f| builder.add_field(f))?; // 250 - edition statement @@ -1473,7 +1474,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02363nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009300484250001600577264003600593264001100629300002300640336002600663337002600689338003600715490003900751500008300790504005300873505006000926506004800986520003101034536006801065538003601133540022301169588005801392700006301450700003401513710002901547830003901576856005801615856005901673856007701732\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title\u{1f}bBook Subtitle\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02367nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264003600597264001100633300002300644336002600667337002600693338003600719490003900755500008300794504005300877505006000930506004800990520003101038536006801069538003601137540022301173588005801396700006301454700003401517710002901551830003901580856005801619856005901677856007701736\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index b4948526..6f13842d 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02363nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02367nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02363nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02363nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title\n Book Subtitle\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02367nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02367nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From abcb9bb1083afa1d8f5b79e8f5426753a063bda9 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 29 Aug 2023 10:38:21 +0100 Subject: [PATCH 07/37] Fix 264 Production punctuation (colon before b subfield, comma before c subfield, full stop at end) --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 8 ++++---- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index fcd4336a..acef1e4e 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02367nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain$bOA Editions$c2010\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 86667c1e..8e80110d 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -217,14 +217,14 @@ impl Marc21Entry for Work { let year = publication_date.year().to_string(); if let Some(place) = self.place.clone() { FieldRepr::from((b"264", "\\1")) - .add_subfield(b"a", place.into_bytes()) + .add_subfield(b"a", format!("{} :", place).into_bytes()) .and_then(|f| { f.add_subfield( b"b", - self.imprint.publisher.publisher_name.clone().into_bytes(), + format!("{},", self.imprint.publisher.publisher_name.clone()).into_bytes(), ) }) - .and_then(|f| f.add_subfield(b"c", year.clone().into_bytes())) + .and_then(|f| f.add_subfield(b"c", format!("{}.", year.clone()).into_bytes())) .and_then(|f| builder.add_field(f))?; } FieldRepr::from((b"264", "\\4")) @@ -1474,7 +1474,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02367nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264003600597264001100633300002300644336002600667337002600693338003600719490003900755500008300794504005300877505006000930506004800990520003101038536006801069538003601137540022301173588005801396700006301454700003401517710002901551830003901580856005801619856005901677856007701736\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain\u{1f}bOA Editions\u{1f}c2010\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 6f13842d..94f682cd 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02367nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02367nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02367nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain\n OA Editions\n 2010\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 8e676390ab9f56c63b2c66c9bd40418df15b11af Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 29 Aug 2023 11:38:35 +0100 Subject: [PATCH 08/37] 020 ISBNs Mark non-ebook ISBNs as z rather than a --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 8 ++++++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index acef1e4e..555b6524 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$a9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 8e80110d..ee0e108a 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -509,8 +509,12 @@ impl Marc21Field for WorkPublications { fn to_field(&self, builder: &mut RecordBuilder) -> ThothResult<()> { if let Some(isbn) = &self.isbn { let publication_type: PublicationType = self.publication_type.clone().into(); + let identifier = match publication_type { + PublicationType::Paperback | PublicationType::Hardback => b"z", + _ => b"a", + }; FieldRepr::from((b"020", "\\\\")) - .add_subfield(b"a", isbn.to_hyphenless_string().as_bytes()) + .add_subfield(identifier, isbn.to_hyphenless_string().as_bytes()) .and_then(|f| f.add_subfield(b"q", format!("({})", publication_type))) .and_then(|f| builder.add_field(f))?; } @@ -1474,7 +1478,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}a9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 94f682cd..ce544e0f 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 44621b0f7d82459471a58d743a2e4a92207e7966 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:00:14 +0100 Subject: [PATCH 09/37] 006 Additional: set position 06 (form of item) as o (online) --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 4 ++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 555b6524..e72d1db4 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\\\\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index ee0e108a..30e399f7 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -70,7 +70,7 @@ impl Marc21Entry for Work { builder.add_field((b"001", self.work_id.to_string()))?; // 006 - media type - builder.add_field((b"006", "m d "))?; + builder.add_field((b"006", "m o d "))?; // 007 - characteristics builder.add_field((b"007", "cr n "))?; @@ -1478,7 +1478,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index ce544e0f..8a3889d0 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From c99a281ff516a1549e398c9b28990bff67e3b29c Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 29 Aug 2023 12:02:59 +0100 Subject: [PATCH 10/37] 008 General: set position 23 (form of item) as o (online) rather than s (implies electronic storage device) --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 4 ++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index e72d1db4..9ca68339 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\sb\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 30e399f7..980e3115 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -92,7 +92,7 @@ impl Marc21Entry for Work { "Missing Main Language".to_string(), ) })?; - let data_field = format!("{date}t{pub_year}{pub_year} sb 000 0 {language} d"); + let data_field = format!("{date}t{pub_year}{pub_year} ob 000 0 {language} d"); builder.add_field((b"008", data_field.as_bytes()))?; // 010 - LCCN @@ -1478,7 +1478,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 sb 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 8a3889d0..4a9b28ac 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 sb 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 9a3cc604e0c523cb54d291ce2f2df80ddfc98e24 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 30 Aug 2023 13:35:03 +0100 Subject: [PATCH 11/37] 506 Access: Use standardised OA terminology and first indicator (xml tests fail due to rust-marc issue 16) --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 8 +++++--- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 9ca68339..2a31b359 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02371nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 \\\\$aOpen access resource providing free access.\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02373nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 980e3115..4acc762c 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -298,8 +298,10 @@ impl Marc21Entry for Work { } // 506 - restrictions on access - FieldRepr::from((b"506", "\\\\")) - .add_subfield(b"a", "Open access resource providing free access.") + FieldRepr::from((b"506", "0\\")) + .add_subfield(b"a", "Open Access") + .and_then(|f| f.add_subfield(b"f", "Unrestricted online access")) + .and_then(|f| f.add_subfield(b"2", "star")) .and_then(|f| builder.add_field(f))?; // 520 - abstract @@ -1478,7 +1480,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02371nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506004800994520003101042536006801073538003601141540022301177588005801400700006301458700003401521710002901555830003901584856005801623856005901681856007701740\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}\\\\\u{1f}aOpen access resource providing free access.\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02373nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506005000994520003101044536006801075538003601143540022301179588005801402700006301460700003401523710002901557830003901586856005801625856005901683856007701742\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 4a9b28ac..94e07730 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02371nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open access resource providing free access.\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 4fd8684f666720dd0369977581c79df91e14ecf6 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 30 Aug 2023 13:58:35 +0100 Subject: [PATCH 12/37] Correct xml tests to expect second indicator as defined in record builder, not duplicated from first indicator under rust-marc issue 16 bug (will fail until bug is fixed) --- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 94e07730..71ee9f57 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 5f0029a0e4ad42084b91195308b4e1660a6d0430 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:16:26 +0100 Subject: [PATCH 13/37] Remove 022 ISSN field: covered by 490/830, may cause false matches --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 14 +------------- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 2a31b359..82ce3f8c 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02373nam 2200553 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=022 \\\\$a8765-4321 (Online)\n=022 \\\\$a1234-5678 (Print)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02304nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 4acc762c..6c213eb1 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -107,18 +107,6 @@ impl Marc21Entry for Work { Marc21Field::::to_field(publication, &mut builder)?; } - // 022 - ISSN - for issue in &self.issues { - for issn in [ - format!("{} (Online)", issue.series.issn_digital.clone()), - format!("{} (Print)", issue.series.issn_print.clone()), - ] { - FieldRepr::from((b"022", "\\\\")) - .add_subfield(b"a", issn.as_bytes()) - .and_then(|f| builder.add_field(f))?; - } - } - // 024 - standard identifiers (DOI, OCLC) if let Some(doi) = &self.doi { FieldRepr::from((b"024", "7\\")) @@ -1480,7 +1468,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02373nam 2200553 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177022002300207022002200230024002800252024002500280040002200305041001300327050000900340072001600349072002300365072001500388100008100403245009700484250001600581264004000597264001100637300002300648336002600671337002600697338003600723490003900759500008300798504005300881505006000934506005000994520003101044536006801075538003601143540022301179588005801402700006301460700003401523710002901557830003901586856005801625856005901683856007701742\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}\\\\\u{1f}a8765-4321 (Online)\u{1e}\\\\\u{1f}a1234-5678 (Print)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02304nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008100358245009700439250001600536264004000552264001100592300002300603336002600626337002600652338003600678490003900714500008300753504005300836505006000889506005000949520003100999536006801030538003601098540022301134588005801357700006301415700003401478710002901512830003901541856005801580856005901638856007701697\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 71ee9f57..cdabf74d 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02304nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02373nam 2200553 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 8765-4321 (Online)\n \n \n 1234-5678 (Print)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02304nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02304nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 60e31ccba7713e41762f07061783fffe5d23dd68 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 30 Aug 2023 15:27:14 +0100 Subject: [PATCH 14/37] Add print ISSN to 490/830 (not explicit feedback but replaces data lost in removing 022; field is repeatable according to specs) --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 3 ++- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 82ce3f8c..689676a5 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02304nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02326nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 6c213eb1..7c72c889 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -522,6 +522,7 @@ impl Marc21Field for WorkIssues { f.add_subfield(b"v", format!("vol. {}", self.issue_ordinal).as_bytes()) }) .and_then(|f| f.add_subfield(b"x", self.series.issn_digital.as_bytes())) + .and_then(|f| f.add_subfield(b"x", self.series.issn_print.as_bytes())) .and_then(|f| builder.add_field(f))?; } Ok(()) @@ -1468,7 +1469,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02304nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008100358245009700439250001600536264004000552264001100592300002300603336002600626337002600652338003600678490003900714500008300753504005300836505006000889506005000949520003100999536006801030538003601098540022301134588005801357700006301415700003401478710002901512830003901541856005801580856005901638856007701697\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02326nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008100358245009700439250001600536264004000552264001100592300002300603336002600626337002600652338003600678490005000714500008300764504005300847505006000900506005000960520003101010536006801041538003601109540022301145588005801368700006301426700003401489710002901523830005001552856005801602856005901660856007701719\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index cdabf74d..727b2d79 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02304nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02304nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02304nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 5f8eaf40c1197c8b04c95a5f352388d317245d70 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 30 Aug 2023 17:07:04 +0100 Subject: [PATCH 15/37] Set correct 245 Title first indicator depending on whether or not 100 Main Entry is present --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 13 +++++++++---- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 689676a5..f2d85a1b 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02326nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 00$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02326nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 7c72c889..74b331e9 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -170,12 +170,17 @@ impl Marc21Entry for Work { } // 100 and 700 - contributors - for contributor_field in contributor_fields(&self.contributions)? { - builder.add_field(contributor_field)?; + let contributor_fields = contributor_fields(&self.contributions)?; + for contributor_field in &contributor_fields { + builder.add_field(contributor_field.clone())?; } // 245 – title - let mut title_field = FieldRepr::from((b"245", "00")); + let title_indicator = match contributor_fields.iter().any(|c| c.get_tag() == b"100") { + true => "10", + false => "00", + }; + let mut title_field = FieldRepr::from((b"245", title_indicator)); if let Some(subtitle) = self.subtitle.clone() { title_field = title_field .add_subfield(b"a", format!("{} :", self.title.clone()).as_bytes()) @@ -1469,7 +1474,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02326nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008100358245009700439250001600536264004000552264001100592300002300603336002600626337002600652338003600678490005000714500008300764504005300847505006000900506005000960520003101010536006801041538003601109540022301145588005801368700006301426700003401489710002901523830005001552856005801602856005901660856007701719\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}00\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02326nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008100358245009700439250001600536264004000552264001100592300002300603336002600626337002600652338003600678490005000714500008300764504005300847505006000900506005000960520003101010536006801041538003601109540022301145588005801368700006301426700003401489710002901523830005001552856005801602856005901660856007701719\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 727b2d79..c1bcdf5d 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From ac150276a08070fbb8f7830f2ba6d82f7efbb250 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 31 Aug 2023 11:29:32 +0100 Subject: [PATCH 16/37] Set 245 Title second indicator (nonfiling character count) to best approximation for English works --- .../src/marc21/marc21record_thoth.rs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 74b331e9..d93ed2a3 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -176,11 +176,23 @@ impl Marc21Entry for Work { } // 245 – title - let title_indicator = match contributor_fields.iter().any(|c| c.get_tag() == b"100") { - true => "10", - false => "00", + let added_entry = match contributor_fields.iter().any(|c| c.get_tag() == b"100") { + true => "1", + false => "0", }; - let mut title_field = FieldRepr::from((b"245", title_indicator)); + let mut nonfiling_char_count = "0"; + if language == "eng" { + // Ideally we would also do this for other languages + if self.title.to_lowercase().starts_with("a ") { + nonfiling_char_count = "2"; + } else if self.title.to_lowercase().starts_with("an ") { + nonfiling_char_count = "3"; + } else if self.title.to_lowercase().starts_with("the ") { + nonfiling_char_count = "4"; + } + } + let mut title_field = + FieldRepr::from((b"245", format!("{}{}", added_entry, nonfiling_char_count))); if let Some(subtitle) = self.subtitle.clone() { title_field = title_field .add_subfield(b"a", format!("{} :", self.title.clone()).as_bytes()) From 09b4a43c91b229c2a501d4126c46b268346b2234 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 31 Aug 2023 13:54:36 +0100 Subject: [PATCH 17/37] Present 100 and 700 fields in Surname, Forename order where possible, with correct indicators based on order --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 135 ++++++++++++++---- .../src/xml/marc21xml_thoth.rs | 4 +- 3 files changed, 107 insertions(+), 34 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index f2d85a1b..fe171de8 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02326nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aSole Author$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aOnly Editor$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 1\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02328nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index d93ed2a3..2f68cb2f 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -397,19 +397,24 @@ fn main_language(languages: &[WorkLanguages]) -> Option { fn contributor_fields(contributions: &[WorkContributions]) -> ThothResult> { // 100 and 700 - contributors - let mut contributions_by_name: Vec<(String, Vec<&WorkContributions>)> = vec![]; + let mut contributions_by_name: Vec<(String, Vec<&WorkContributions>, String)> = vec![]; for c in contributions { - let key = c.full_name.clone(); - match contributions_by_name.iter_mut().find(|(k, _)| *k == key) { + let mut key = c.full_name.clone(); + let mut name_indicator = "0\\".to_string(); + if let Some(first_name) = &c.first_name { + key = format!("{}, {}", &c.last_name, first_name); + name_indicator = "1\\".to_string(); + } + match contributions_by_name.iter_mut().find(|(k, _, _)| *k == key) { Some(entry) => entry.1.push(c), - None => contributions_by_name.push((key, vec![c])), + None => contributions_by_name.push((key, vec![c], name_indicator)), } } let mut contributor_fields: Vec = vec![]; // only one 100 field is allowed, first-come first-served let mut is_main_author_defined = false; - for (name, contributions) in contributions_by_name.iter() { + for (name, contributions, indicator) in contributions_by_name.iter() { let is_main = contributions .iter() .any(|c| c.contribution_type == thoth_client::ContributionType::AUTHOR); @@ -428,7 +433,7 @@ fn contributor_fields(contributions: &[WorkContributions]) -> ThothResult>() .join(", "); - let mut contributor_field = FieldRepr::from((field_code, "1\\")); + let mut contributor_field = FieldRepr::from((field_code, indicator.as_str())); contributor_field = contributor_field.add_subfield(b"a", name)?; contributor_field = contributor_field.add_subfield(b"e", roles)?; if let Some(affiliation) = &contributions.first().unwrap().affiliations.first() { @@ -928,11 +933,13 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_single_author() { let mut contribution = test_contribution(); + contribution.first_name = Some("Jane".to_string()); + contribution.last_name = "Doe".to_string(); contribution.full_name = "Jane Doe".to_string(); let contributions = [contribution]; let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap()]); assert_eq!(contributor_fields(&contributions), expected); @@ -941,20 +948,24 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_multiple_contributors_no_author() { let mut first_contribution = test_contribution(); + first_contribution.first_name = Some("Jane".to_string()); + first_contribution.last_name = "Doe".to_string(); first_contribution.full_name = "Jane Doe".to_string(); first_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let mut second_contribution = test_contribution(); + second_contribution.first_name = Some("John".to_string()); + second_contribution.last_name = "Smith".to_string(); second_contribution.full_name = "John Smith".to_string(); second_contribution.contribution_type = thoth_client::ContributionType::TRANSLATOR; let contributions = [first_contribution, second_contribution]; let expected = Ok(vec![ FieldRepr::from((b"700", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "editor".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) - .add_subfield(b"a", "John Smith".as_bytes()) + .add_subfield(b"a", "Smith, John".as_bytes()) .and_then(|f| f.add_subfield(b"e", "translator".as_bytes())) .unwrap(), ]); @@ -964,22 +975,28 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_multiple_contributions_one_author() { let mut first_contribution = test_contribution(); + first_contribution.first_name = Some("John".to_string()); + first_contribution.last_name = "Smith".to_string(); first_contribution.full_name = "John Smith".to_string(); let mut second_contribution = test_contribution(); + second_contribution.first_name = Some("Jane".to_string()); + second_contribution.last_name = "Doe".to_string(); second_contribution.full_name = "Jane Doe".to_string(); second_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let mut third_contribution = test_contribution(); + third_contribution.first_name = Some("Jane".to_string()); + third_contribution.last_name = "Doe".to_string(); third_contribution.full_name = "Jane Doe".to_string(); third_contribution.contribution_type = thoth_client::ContributionType::TRANSLATOR; let contributions = [first_contribution, second_contribution, third_contribution]; let expected = Ok(vec![ FieldRepr::from((b"100", "1\\")) - .add_subfield(b"a", "John Smith".as_bytes()) + .add_subfield(b"a", "Smith, John".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "editor, translator".as_bytes())) .unwrap(), ]); @@ -989,14 +1006,22 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_multiple_contributors_multiple_authors() { let mut first_contribution = test_contribution(); + first_contribution.first_name = Some("John".to_string()); + first_contribution.last_name = "Smith".to_string(); first_contribution.full_name = "John Smith".to_string(); let mut second_contribution = test_contribution(); + second_contribution.first_name = Some("Jane".to_string()); + second_contribution.last_name = "Doe".to_string(); second_contribution.full_name = "Jane Doe".to_string(); let mut third_contribution = test_contribution(); - third_contribution.full_name = "Bob Johnson".to_string(); + third_contribution.first_name = Some("Billy Bob".to_string()); + third_contribution.last_name = "Johnson".to_string(); + third_contribution.full_name = "Billy Bob Johnson".to_string(); third_contribution.contribution_type = thoth_client::ContributionType::INTRODUCTION_BY; let mut fourth_contribution = test_contribution(); - fourth_contribution.full_name = "Juan García".to_string(); + fourth_contribution.first_name = Some("Juan".to_string()); + fourth_contribution.last_name = "García Sánchez".to_string(); + fourth_contribution.full_name = "Juan García Sánchez".to_string(); fourth_contribution.contribution_type = thoth_client::ContributionType::TRANSLATOR; let contributions = [ first_contribution, @@ -1007,19 +1032,19 @@ pub(crate) mod tests { let expected = Ok(vec![ FieldRepr::from((b"100", "1\\")) - .add_subfield(b"a", "John Smith".as_bytes()) + .add_subfield(b"a", "Smith, John".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) - .add_subfield(b"a", "Bob Johnson".as_bytes()) + .add_subfield(b"a", "Johnson, Billy Bob".as_bytes()) .and_then(|f| f.add_subfield(b"e", "introduction by".as_bytes())) .unwrap(), FieldRepr::from((b"700", "1\\")) - .add_subfield(b"a", "Juan García".as_bytes()) + .add_subfield(b"a", "García Sánchez, Juan".as_bytes()) .and_then(|f| f.add_subfield(b"e", "translator".as_bytes())) .unwrap(), ]); @@ -1029,6 +1054,8 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_single_author_single_affiliation() { let mut contribution = test_contribution(); + contribution.first_name = Some("Jane".to_string()); + contribution.last_name = "Doe".to_string(); contribution.full_name = "Jane Doe".to_string(); contribution.affiliations = vec![WorkContributionsAffiliations { position: None, @@ -1043,7 +1070,7 @@ pub(crate) mod tests { let contributions = [contribution]; let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .and_then(|f| f.add_subfield(b"u", "Thoth University".as_bytes())) .unwrap()]); @@ -1053,6 +1080,8 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_single_author_multiple_affiliations() { let mut contribution = test_contribution(); + contribution.first_name = Some("Jane".to_string()); + contribution.last_name = "Doe".to_string(); contribution.full_name = "Jane Doe".to_string(); contribution.affiliations = vec![ WorkContributionsAffiliations { @@ -1079,7 +1108,7 @@ pub(crate) mod tests { let contributions = [contribution]; let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .and_then(|f| f.add_subfield(b"u", "Thoth University".as_bytes())) .unwrap()]); @@ -1089,6 +1118,8 @@ pub(crate) mod tests { #[test] fn test_contributor_fields_single_author_with_orcid() { let mut contribution = test_contribution(); + contribution.first_name = Some("Jane".to_string()); + contribution.last_name = "Doe".to_string(); contribution.full_name = "Jane Doe".to_string(); contribution.contributor = WorkContributionsContributor { orcid: Some(Orcid::from_str("https://orcid.org/0000-0002-0000-0011").unwrap()), @@ -1097,13 +1128,55 @@ pub(crate) mod tests { let contributions = [contribution]; let expected = Ok(vec![FieldRepr::from((b"100", "1\\")) - .add_subfield(b"a", "Jane Doe".as_bytes()) + .add_subfield(b"a", "Doe, Jane".as_bytes()) .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) .and_then(|f| f.add_subfield(b"1", "https://orcid.org/0000-0002-0000-0011".as_bytes())) .unwrap()]); assert_eq!(contributor_fields(&contributions), expected); } + #[test] + fn test_contributor_fields_multiple_contributors_no_first_names() { + let mut first_contribution = test_contribution(); + first_contribution.last_name = "Thoth Collective".to_string(); + first_contribution.full_name = "Thoth Collective".to_string(); + first_contribution.contribution_type = thoth_client::ContributionType::EDITOR; + let mut second_contribution = test_contribution(); + second_contribution.last_name = "Anonymous".to_string(); + second_contribution.full_name = "Anonymous".to_string(); + let mut third_contribution = test_contribution(); + third_contribution.last_name = "Thoth Collective".to_string(); + third_contribution.full_name = "Thoth Collective".to_string(); + third_contribution.contribution_type = thoth_client::ContributionType::INTRODUCTION_BY; + let mut fourth_contribution = test_contribution(); + fourth_contribution.first_name = Some("Thoth".to_string()); + fourth_contribution.last_name = "Collective".to_string(); + fourth_contribution.full_name = "Thoth Collective".to_string(); + fourth_contribution.contribution_type = thoth_client::ContributionType::RESEARCH_BY; + let contributions = [ + first_contribution, + second_contribution, + third_contribution, + fourth_contribution, + ]; + + let expected = Ok(vec![ + FieldRepr::from((b"700", "0\\")) + .add_subfield(b"a", "Thoth Collective".as_bytes()) + .and_then(|f| f.add_subfield(b"e", "editor, introduction by".as_bytes())) + .unwrap(), + FieldRepr::from((b"100", "0\\")) + .add_subfield(b"a", "Anonymous".as_bytes()) + .and_then(|f| f.add_subfield(b"e", "author".as_bytes())) + .unwrap(), + FieldRepr::from((b"700", "1\\")) + .add_subfield(b"a", "Collective, Thoth".as_bytes()) + .and_then(|f| f.add_subfield(b"e", "research by".as_bytes())) + .unwrap(), + ]); + assert_eq!(contributor_fields(&contributions), expected); + } + #[test] fn test_language_field_original_only() { let languages = vec![WorkLanguages { @@ -1399,11 +1472,11 @@ pub(crate) mod tests { #[test] fn test_contributors_string_single_translator() { let mut contribution = test_contribution(); - contribution.full_name = "Juan García".to_string(); + contribution.full_name = "Juan García Sánchez".to_string(); contribution.contribution_type = thoth_client::ContributionType::TRANSLATOR; let contributions = [contribution]; - let expected = "translated by Juan García."; + let expected = "translated by Juan García Sánchez."; assert_eq!(contributors_string(&contributions), expected); } @@ -1414,10 +1487,10 @@ pub(crate) mod tests { let mut second_contribution = test_contribution(); second_contribution.full_name = "Jane Smith".to_string(); let mut third_contribution = test_contribution(); - third_contribution.full_name = "Bob Johnson".to_string(); + third_contribution.full_name = "Billy Bob Johnson".to_string(); let contributions = [first_contribution, second_contribution, third_contribution]; - let expected = "John Doe, Jane Smith, Bob Johnson."; + let expected = "John Doe, Jane Smith, Billy Bob Johnson."; assert_eq!(contributors_string(&contributions), expected); } @@ -1427,11 +1500,11 @@ pub(crate) mod tests { first_contribution.full_name = "Jane Smith".to_string(); first_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let mut second_contribution = test_contribution(); - second_contribution.full_name = "Bob Johnson".to_string(); + second_contribution.full_name = "Billy Bob Johnson".to_string(); second_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let contributions = [first_contribution, second_contribution]; - let expected = "edited by Jane Smith, Bob Johnson."; + let expected = "edited by Jane Smith, Billy Bob Johnson."; assert_eq!(contributors_string(&contributions), expected); } @@ -1443,7 +1516,7 @@ pub(crate) mod tests { second_contribution.full_name = "Jane Smith".to_string(); second_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let mut third_contribution = test_contribution(); - third_contribution.full_name = "Bob Johnson".to_string(); + third_contribution.full_name = "Billy Bob Johnson".to_string(); third_contribution.contribution_type = thoth_client::ContributionType::TRANSLATOR; let mut fourth_contribution = test_contribution(); fourth_contribution.full_name = "Alice Brown".to_string(); @@ -1455,7 +1528,7 @@ pub(crate) mod tests { fourth_contribution, ]; - let expected = "John Doe; edited by Jane Smith; translated by Bob Johnson; introduction by Alice Brown."; + let expected = "John Doe; edited by Jane Smith; translated by Billy Bob Johnson; introduction by Alice Brown."; assert_eq!(contributors_string(&contributions), expected); } @@ -1467,7 +1540,7 @@ pub(crate) mod tests { second_contribution.full_name = "Jane Smith".to_string(); second_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let mut third_contribution = test_contribution(); - third_contribution.full_name = "Bob Johnson".to_string(); + third_contribution.full_name = "Billy Bob Johnson".to_string(); third_contribution.contribution_type = thoth_client::ContributionType::EDITOR; let mut fourth_contribution = test_contribution(); fourth_contribution.full_name = "Alice Brown".to_string(); @@ -1478,7 +1551,7 @@ pub(crate) mod tests { fourth_contribution, ]; - let expected = "John Doe, Alice Brown; edited by Jane Smith, Bob Johnson."; + let expected = "John Doe, Alice Brown; edited by Jane Smith, Billy Bob Johnson."; assert_eq!(contributors_string(&contributions), expected); } @@ -1486,7 +1559,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02326nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008100358245009700439250001600536264004000552264001100592300002300603336002600626337002600652338003600678490005000714500008300764504005300847505006000900506005000960520003101010536006801041538003601109540022301145588005801368700006301426700003401489710002901523830005001552856005801602856005901660856007701719\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aSole Author\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aOnly Editor\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}1\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02328nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008200358245009700440250001600537264004000553264001100593300002300604336002600627337002600653338003600679490005000715500008300765504005300848505006000901506005000961520003101011536006801042538003601110540022301146588005801369700006401427700003401491710002901525830005001554856005801604856005901662856007701721\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole\u{1f}eauthor\u{1f}uThoth University\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only\u{1f}eeditor\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator\u{1f}etranslator\u{1f}uCOPIM\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index c1bcdf5d..544370c8 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02328nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02326nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Sole Author\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Only Editor\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02328nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02328nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 3716386d5d69b55a04a7412248eb5cb76d63b226 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 31 Aug 2023 14:20:50 +0100 Subject: [PATCH 18/37] Improve punctuation for 100 and 700 subfields --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 74 ++++++++++--------- .../src/xml/marc21xml_thoth.rs | 4 +- 3 files changed, 41 insertions(+), 39 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index fe171de8..7c2a0b9e 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02328nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole$eauthor$uThoth University$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only$eeditor$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator$etranslator$uCOPIM\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02336nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 2f68cb2f..48628703 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -434,12 +434,14 @@ fn contributor_fields(contributions: &[WorkContributions]) -> ThothResult\n\n 02328nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02334nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02328nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02328nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole\n author\n Thoth University\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only\n editor\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator\n translator\n COPIM\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02334nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02334nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From c7ef4d85eb503082c43e29d549b7a73fa1862f21 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 5 Sep 2023 12:05:49 +0100 Subject: [PATCH 19/37] Upgrade marc --- Cargo.lock | 4 ++-- thoth-errors/Cargo.toml | 2 +- thoth-export-server/Cargo.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b6f8e789..7516715a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2107,9 +2107,9 @@ dependencies = [ [[package]] name = "marc" -version = "3.1.0" +version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de4eeed871ae1c896c6a8b3ff59a1fb5a5f20189948ffd730265bdb1b6dcf780" +checksum = "c7158861fa6320edf04e974b504ad3c3a69e1aa9500d2e4899e6dc41265c0a56" dependencies = [ "xml-rs", ] diff --git a/thoth-errors/Cargo.toml b/thoth-errors/Cargo.toml index a1d50718..c1918950 100644 --- a/thoth-errors/Cargo.toml +++ b/thoth-errors/Cargo.toml @@ -21,7 +21,7 @@ actix-web = "4.3.0" diesel = "2.0.2" csv = "1.1.6" juniper = "0.15.10" -marc = { version = "3.1.0", features = ["xml"] } +marc = { version = "3.1.1", features = ["xml"] } phf = { version = "0.11", features = ["macros"] } reqwest-middleware = "0.2.0" xml-rs = "0.8.0" diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index 10c266e4..a09a07f8 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -21,7 +21,7 @@ env_logger = "0.10.0" futures = "0.3.26" lazy_static = "1.4.0" log = "0.4.14" -marc = { version = "3.1.0", features = ["xml"] } +marc = { version = "3.1.1", features = ["xml"] } paperclip = { version = "0.8.0", features = ["actix-base", "actix4", "uuid0", "v2"] } serde = { version = "1.0.115", features = ["derive"] } serde_json = "1.0" From d18b5b94804426547974932d3d38fe81aa1a2e80 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 5 Sep 2023 12:06:30 +0100 Subject: [PATCH 20/37] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec6d1842..e7a2bc38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + - Upgrade `marc` to v3.1.1 ## [[0.11.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.4) - 2023-08-28 ### Security From edd8dbbaaf7ffcd49d65fa6749a869e1326627f0 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Tue, 5 Sep 2023 13:32:46 +0100 Subject: [PATCH 21/37] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7435fdec..8c20e4f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + - Upgrade `marc` to v3.1.1 ## [[0.11.5]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.5) - 2023-09-05 ### Security @@ -33,7 +34,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgrade `log` to v0.4.20 - Upgrade `clap` to v4.4.2 - Short version of host command is now `-H` instead of `-h` in CLI - - Upgrade `marc` to v3.1.1 ## [[0.11.4]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.4) - 2023-08-28 ### Security From d7e8a0f6bd6f01a1fbff7f9909f2bb57d74947cf Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 18 Sep 2023 08:59:46 +0100 Subject: [PATCH 22/37] Upgrade dependencies --- Cargo.lock | 14 +++++++------- thoth-api-server/Cargo.toml | 4 ++-- thoth-api/Cargo.toml | 2 +- thoth-app/Cargo.toml | 2 +- thoth-client/Cargo.toml | 2 +- thoth-export-server/Cargo.toml | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24293d6f..b1b95eaa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -75,15 +75,15 @@ dependencies = [ [[package]] name = "actix-identity" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1224c9f9593dc27c9077b233ce04adedc1d7febcfc35ee9f53ea3c24df180bec" +checksum = "36e1cc6f95e245b2f3c6995df4e1c0c697704c48c28ec325d135a3ca039d4952" dependencies = [ "actix-service", "actix-session", "actix-utils", "actix-web", - "anyhow", + "derive_more", "futures-core", "serde", "tracing", @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "actix-session" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43da8b818ae1f11049a4d218975345fe8e56ce5a5f92c11f972abcff5ff80e87" +checksum = "2e6a28f813a6671e1847d005cad0be36ae4d016287690f765c303379837c13d6" dependencies = [ "actix-service", "actix-utils", @@ -731,9 +731,9 @@ checksum = "8100e46ff92eb85bf6dc2930c73f2a4f7176393c84a9446b3d501e1b354e7b34" [[package]] name = "chrono" -version = "0.4.30" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd4e7873dbddba6c7c91e199c7fcb946abc4a6a4ac3195400bcfb01b5de877" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", diff --git a/thoth-api-server/Cargo.toml b/thoth-api-server/Cargo.toml index c696e5e3..5e891cea 100644 --- a/thoth-api-server/Cargo.toml +++ b/thoth-api-server/Cargo.toml @@ -13,8 +13,8 @@ thoth-api = { version = "0.11.6", path = "../thoth-api", features = ["backend"] thoth-errors = { version = "0.11.6", path = "../thoth-errors" } actix-web = "4.4.0" actix-cors = "0.6.4" -actix-identity = "0.5.2" -actix-session = { version = "0.7.2", features = ["cookie-session"] } +actix-identity = "0.6.0" +actix-session = { version = "0.8.0", features = ["cookie-session"] } env_logger = "0.10.0" juniper = "0.15.11" serde = { version = "1.0", features = ["derive"] } diff --git a/thoth-api/Cargo.toml b/thoth-api/Cargo.toml index 288039b9..8fc37883 100644 --- a/thoth-api/Cargo.toml +++ b/thoth-api/Cargo.toml @@ -20,7 +20,7 @@ thoth-errors = { version = "0.11.6", path = "../thoth-errors" } actix-web = { version = "4.4.0", optional = true } argon2rs = "0.2.5" isbn2 = "0.4.0" -chrono = { version = "0.4.30", features = ["serde"] } +chrono = { version = "0.4.31", features = ["serde"] } diesel = { version = "2.1.1", features = ["postgres", "uuid", "chrono", "r2d2", "64-column-tables", "serde_json"], optional = true } diesel-derive-enum = { version = "2.1.0", features = ["postgres"], optional = true } diesel-derive-newtype = "2.1.0" diff --git a/thoth-app/Cargo.toml b/thoth-app/Cargo.toml index ec325d23..8d1475eb 100644 --- a/thoth-app/Cargo.toml +++ b/thoth-app/Cargo.toml @@ -20,7 +20,7 @@ wasm-pack = "0.12.1" [dependencies] anyhow = "1.0.32" -chrono = { version = "0.4.30", features = ["serde"] } +chrono = { version = "0.4.31", features = ["serde"] } gloo-storage = "0.2.1" gloo-timers = "0.2.4" log = "0.4.20" diff --git a/thoth-client/Cargo.toml b/thoth-client/Cargo.toml index c98a2e83..1ce2ce29 100644 --- a/thoth-client/Cargo.toml +++ b/thoth-client/Cargo.toml @@ -12,7 +12,7 @@ readme = "README.md" thoth-api = {version = "0.11.6", path = "../thoth-api" } thoth-errors = {version = "0.11.6", path = "../thoth-errors" } graphql_client = "0.13.0" -chrono = { version = "0.4.30", features = ["serde"] } +chrono = { version = "0.4.31", features = ["serde"] } reqwest = { version = "0.11", features = ["json"] } reqwest-middleware = "0.2.3" reqwest-retry = "0.2.3" diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index c91d0c79..62a09e60 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -15,7 +15,7 @@ thoth-client = { version = "0.11.6", path = "../thoth-client" } actix-web = "4.4.0" actix-cors = "0.6.4" cc_license = "0.1.0" -chrono = { version = "0.4.30", features = ["serde"] } +chrono = { version = "0.4.31", features = ["serde"] } csv = "1.2.2" env_logger = "0.10.0" futures = "0.3.28" From e9f6114ba69ec7bdf8d516f25c23990b63e169e4 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 18 Sep 2023 09:00:44 +0100 Subject: [PATCH 23/37] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe64450e..46598362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed + - Upgrade `actix-identity` to v0.6.0 + - Upgrade `actix-session` to v0.8.0 + - Upgrade `chrono` to v0.4.31 ## [[0.11.6]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.6) - 2023-09-08 ### Security From 701a183c3c4d9070e10f95a6d6be2050af289aa7 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:29:06 +0100 Subject: [PATCH 24/37] Make missed second indicator corrections to xml tests --- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index b554210a..030a8075 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02334nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02336nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02334nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02334nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02336nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02336nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 9f165753b4b2e0c53b5f97fa4f042e62dabd0549 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 19 Sep 2023 14:46:03 +0100 Subject: [PATCH 25/37] Use more appropriate LDR encoding level (pos 17) and descriptive cataloguing form (pos 18) - can't guarantee completeness --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 8 ++++++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 7c2a0b9e..5465e78b 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02336nam 2200529 i 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02336nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 48628703..01e50add 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -1,7 +1,7 @@ use crate::marc21::{Marc21Field, MARC_ORGANIZATION_CODE}; use cc_license::License; use chrono::{Datelike, Utc}; -use marc::{FieldRepr, Record, RecordBuilder}; +use marc::{DescriptiveCatalogingForm, EncodingLevel, FieldRepr, Record, RecordBuilder}; use thoth_api::model::contribution::ContributionType; use thoth_api::model::publication::PublicationType; use thoth_api::model::IdentifierWithDomain; @@ -66,6 +66,10 @@ impl Marc21Entry for Work { let mut builder = RecordBuilder::new(); + // Leader values - can't guarantee record is complete or formatting is standard + builder.set_encoding_level(EncodingLevel::LessThanFullLevelMaterialNotExamined); + builder.set_descriptive_cataloging_form(DescriptiveCatalogingForm::NonIsbd); + // 001 - control number builder.add_field((b"001", self.work_id.to_string()))?; @@ -1561,7 +1565,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02336nam 2200529 i 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008500358245009700443250001600540264004000556264001100596300002300607336002600630337002600656338003600682490005000718500008300768504005300851505006000904506005000964520003101014536006801045538003601113540022301149588005801372700006601430700003701496710002901533830005001562856005801612856005901670856007701729\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02336nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008500358245009700443250001600540264004000556264001100596300002300607336002600630337002600656338003600682490005000718500008300768504005300851505006000904506005000964520003101014536006801045538003601113540022301149588005801372700006601430700003701496710002901533830005001562856005801612856005901670856007701729\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 030a8075..b0f962c4 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02336nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02336nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02336nam 2200529 i 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From bfcae839958637215907c45dedc636032607e8d5 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 19 Sep 2023 16:13:59 +0100 Subject: [PATCH 26/37] 008 General: check if bibliographic note states index present, and mark if so --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 11 +++++++++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 5465e78b..bd64e733 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02336nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\000\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02336nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 01e50add..cf5d199c 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -96,7 +96,14 @@ impl Marc21Entry for Work { "Missing Main Language".to_string(), ) })?; - let data_field = format!("{date}t{pub_year}{pub_year} ob 000 0 {language} d"); + let mut has_index = 0; + if let Some(bibliography_note) = &self.bibliography_note { + if bibliography_note.contains("index") { + has_index = 1; + } + } + let data_field = + format!("{date}t{pub_year}{pub_year} ob 00{has_index} 0 {language} d"); builder.add_field((b"008", data_field.as_bytes()))?; // 010 - LCCN @@ -1565,7 +1572,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02336nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008500358245009700443250001600540264004000556264001100596300002300607336002600630337002600656338003600682490005000718500008300768504005300851505006000904506005000964520003101014536006801045538003601113540022301149588005801372700006601430700003701496710002901533830005001562856005801612856005901670856007701729\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 000 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02336nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008500358245009700443250001600540264004000556264001100596300002300607336002600630337002600656338003600682490005000718500008300768504005300851505006000904506005000964520003101014536006801045538003601113540022301149588005801372700006601430700003701496710002901533830005001562856005801612856005901670856007701729\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index b0f962c4..6ee6bd58 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 000 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 793d21f118f983a06c1b208aa5013799107beba9 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Wed, 20 Sep 2023 15:48:15 +0100 Subject: [PATCH 27/37] Allow angle brackets in DOI validation --- CHANGELOG.md | 3 +++ thoth-api/migrations/0.11.7/down.sql | 11 +++++++++++ thoth-api/migrations/0.11.7/up.sql | 11 +++++++++++ thoth-api/src/model/mod.rs | 8 ++++++-- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 thoth-api/migrations/0.11.7/down.sql create mode 100644 thoth-api/migrations/0.11.7/up.sql diff --git a/CHANGELOG.md b/CHANGELOG.md index 46598362..82d7c3f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Upgrade `actix-session` to v0.8.0 - Upgrade `chrono` to v0.4.31 +### Fixed + - [#513](https://github.com/thoth-pub/thoth/issues/513) - Expand DOI regex to include angle brackets + ## [[0.11.6]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.6) - 2023-09-08 ### Security - Upgrade `chrono` to v0.4.30 diff --git a/thoth-api/migrations/0.11.7/down.sql b/thoth-api/migrations/0.11.7/down.sql new file mode 100644 index 00000000..b9297c0c --- /dev/null +++ b/thoth-api/migrations/0.11.7/down.sql @@ -0,0 +1,11 @@ +ALTER TABLE work DROP CONSTRAINT work_doi_check; +ALTER TABLE work ADD CONSTRAINT work_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]\/:a-zA-Z0-9]+$'); + +ALTER TABLE reference DROP CONSTRAINT reference_doi_check; +ALTER TABLE reference ADD CONSTRAINT reference_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]\/:a-zA-Z0-9]+$'); + +ALTER TABLE institution DROP CONSTRAINT institution_institution_doi_check; +ALTER TABLE institution ADD CONSTRAINT institution_institution_doi_check + CHECK (institution_doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]\/:a-zA-Z0-9]+$'); diff --git a/thoth-api/migrations/0.11.7/up.sql b/thoth-api/migrations/0.11.7/up.sql new file mode 100644 index 00000000..40680f44 --- /dev/null +++ b/thoth-api/migrations/0.11.7/up.sql @@ -0,0 +1,11 @@ +ALTER TABLE work DROP CONSTRAINT work_doi_check; +ALTER TABLE work ADD CONSTRAINT work_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$'); + +ALTER TABLE reference DROP CONSTRAINT reference_doi_check; +ALTER TABLE reference ADD CONSTRAINT reference_doi_check + CHECK (doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$'); + +ALTER TABLE institution DROP CONSTRAINT institution_institution_doi_check; +ALTER TABLE institution ADD CONSTRAINT institution_institution_doi_check + CHECK (institution_doi ~ '^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$'); diff --git a/thoth-api/src/model/mod.rs b/thoth-api/src/model/mod.rs index 1dfda3fd..c0a6aa7a 100644 --- a/thoth-api/src/model/mod.rs +++ b/thoth-api/src/model/mod.rs @@ -46,7 +46,7 @@ pub enum WeightUnit { feature = "backend", derive(DieselNewType, juniper::GraphQLScalarValue), graphql( - description = r#"Digital Object Identifier. Expressed as `^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]\/:a-zA-Z0-9]+$`"# + description = r#"Digital Object Identifier. Expressed as `^https:\/\/doi\.org\/10\.\d{4,9}\/[-._\;\(\)\[\]<>\/:a-zA-Z0-9]+$`"# ) )] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)] @@ -144,7 +144,7 @@ impl FromStr for Doi { // and captures the identifier segment starting with the "10." directory indicator // Corresponds to database constraints although regex syntax differs slightly // (e.g. `;()/` do not need to be escaped here) - r"^(?i:(?:https?://)?(?:www\.)?(?:dx\.)?doi\.org/)?(10\.\d{4,9}/[-._;()\[\]/:a-zA-Z0-9]+$)").unwrap(); + r"^(?i:(?:https?://)?(?:www\.)?(?:dx\.)?doi\.org/)?(10\.\d{4,9}/[-._;()\[\]<>/:a-zA-Z0-9]+$)").unwrap(); } if input.is_empty() { Err(ThothError::DoiEmptyError) @@ -703,6 +703,10 @@ fn test_doi_fromstr() { assert!(Doi::from_str("https://doi-org/10.12345/Test-Suffix.01").is_err()); assert!(Doi::from_str("10.https://doi.org/12345/Test-Suffix.01").is_err()); assert!(Doi::from_str("http://dx.doi.org/10.2990/1471-5457(2005)24[2:tmpwac]2.0.co;2").is_ok()); + assert!(Doi::from_str( + "https://doi.org/10.1002/(SICI)1098-2736(199908)36:6<637::AID-TEA4>3.0.CO;2-9" + ) + .is_ok()); } #[test] From 3672da577e7b08d5db0022cdcbbaf32aacc2877c Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Thu, 21 Sep 2023 11:49:05 +0100 Subject: [PATCH 28/37] Rename migration so that it runs after all existing migrations, to fix failing check (Diesel orders migrations strictly alphanumerically) --- thoth-api/migrations/{0.11.7 => v0.11.7}/down.sql | 0 thoth-api/migrations/{0.11.7 => v0.11.7}/up.sql | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename thoth-api/migrations/{0.11.7 => v0.11.7}/down.sql (100%) rename thoth-api/migrations/{0.11.7 => v0.11.7}/up.sql (100%) diff --git a/thoth-api/migrations/0.11.7/down.sql b/thoth-api/migrations/v0.11.7/down.sql similarity index 100% rename from thoth-api/migrations/0.11.7/down.sql rename to thoth-api/migrations/v0.11.7/down.sql diff --git a/thoth-api/migrations/0.11.7/up.sql b/thoth-api/migrations/v0.11.7/up.sql similarity index 100% rename from thoth-api/migrations/0.11.7/up.sql rename to thoth-api/migrations/v0.11.7/up.sql From 4dd6c800137affbe14f90c25eb517d3eb4f4c634 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Mon, 25 Sep 2023 12:03:36 +0100 Subject: [PATCH 29/37] 040 Cataloguing Source: use 'local' for description conventions subfield as can't guarantee full adherence to RDA, ISBD, etc --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 4 ++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index bd64e733..41c34a23 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02336nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$erda\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02338nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index cf5d199c..93358069 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -136,7 +136,7 @@ impl Marc21Entry for Work { FieldRepr::from((b"040", "\\\\")) .add_subfield(b"a", MARC_ORGANIZATION_CODE) .and_then(|f| f.add_subfield(b"b", "eng")) - .and_then(|f| f.add_subfield(b"e", "rda")) + .and_then(|f| f.add_subfield(b"e", "local")) .and_then(|f| builder.add_field(f))?; // 041 - language @@ -1572,7 +1572,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02336nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002200260041001300282050000900295072001600304072002300320072001500343100008500358245009700443250001600540264004000556264001100596300002300607336002600630337002600656338003600682490005000718500008300768504005300851505006000904506005000964520003101014536006801045538003601113540022301149588005801372700006601430700003701496710002901533830005001562856005801612856005901670856007701729\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}erda\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02338nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250001600542264004000558264001100598300002300609336002600632337002600658338003600684490005000720500008300770504005300853505006000906506005000966520003101016536006801047538003601115540022301151588005801374700006601432700003701498710002901535830005001564856005801614856005901672856007701731\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 6ee6bd58..c2c71e83 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02338nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02336nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n rda\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02338nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02338nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From e2fa60579b41bf362d0b915ef7ed6497b8ce1f08 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:15:27 +0100 Subject: [PATCH 30/37] Review markups: move 245 nonfiling char count logic into function and add unit test --- .../src/marc21/marc21record_thoth.rs | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 93358069..5c000541 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -191,17 +191,7 @@ impl Marc21Entry for Work { true => "1", false => "0", }; - let mut nonfiling_char_count = "0"; - if language == "eng" { - // Ideally we would also do this for other languages - if self.title.to_lowercase().starts_with("a ") { - nonfiling_char_count = "2"; - } else if self.title.to_lowercase().starts_with("an ") { - nonfiling_char_count = "3"; - } else if self.title.to_lowercase().starts_with("the ") { - nonfiling_char_count = "4"; - } - } + let nonfiling_char_count = nonfiling_char_count(&self.title, &language); let mut title_field = FieldRepr::from((b"245", format!("{}{}", added_entry, nonfiling_char_count))); if let Some(subtitle) = self.subtitle.clone() { @@ -674,6 +664,21 @@ fn contributors_string(contributions: &[WorkContributions]) -> String { result } +fn nonfiling_char_count(title: &str, language: &str) -> String { + let mut nonfiling_char_count = "0".to_string(); + if language == "eng" { + // Ideally we would also do this for other languages + if title.to_lowercase().starts_with("a ") { + nonfiling_char_count = "2".to_string(); + } else if title.to_lowercase().starts_with("an ") { + nonfiling_char_count = "3".to_string(); + } else if title.to_lowercase().starts_with("the ") { + nonfiling_char_count = "4".to_string(); + } + } + nonfiling_char_count +} + #[cfg(test)] pub(crate) mod tests { use super::*; @@ -1568,6 +1573,22 @@ pub(crate) mod tests { assert_eq!(contributors_string(&contributions), expected); } + #[test] + fn test_nonfiling_char_count() { + for (language, title, expected) in [ + ("eng", "A sample book", "2"), + ("eng", "An example book", "3"), + ("eng", "The next example book", "4"), + ("eng", "a lowercase book", "2"), + ("eng", "AAAAAA BOOK", "0"), + ("eng", "There's a book", "0"), + ("fre", "The et cafe", "0"), + ("fre", "A la gare", "0"), + ] { + assert_eq!(nonfiling_char_count(title, language), expected); + } + } + #[test] fn test_generate_marc() { let work = test_work(); From d335a485ba0eabe87569fa41663959f1b66f470c Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:27:50 +0100 Subject: [PATCH 31/37] Review markups: condense 245 nonfiling char count logic by iterating over a list --- thoth-export-server/src/marc21/marc21record_thoth.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 5c000541..cfe74eba 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -668,12 +668,11 @@ fn nonfiling_char_count(title: &str, language: &str) -> String { let mut nonfiling_char_count = "0".to_string(); if language == "eng" { // Ideally we would also do this for other languages - if title.to_lowercase().starts_with("a ") { - nonfiling_char_count = "2".to_string(); - } else if title.to_lowercase().starts_with("an ") { - nonfiling_char_count = "3".to_string(); - } else if title.to_lowercase().starts_with("the ") { - nonfiling_char_count = "4".to_string(); + if let Some(prefix) = ["a ", "an ", "the "] + .iter() + .find(|p| title.to_lowercase().starts_with(*p)) + { + nonfiling_char_count = prefix.len().to_string() } } nonfiling_char_count From 621426b099ac11569e041130e516685557c6d1c5 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 26 Sep 2023 10:51:53 +0100 Subject: [PATCH 32/37] 250 Edition: add correct punctuation --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 4 ++-- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 41c34a23..ef1107f7 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02338nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02339nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition.\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index cfe74eba..0da51057 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -215,7 +215,7 @@ impl Marc21Entry for Work { _ => "th", }; FieldRepr::from((b"250", "\\\\")) - .add_subfield(b"a", format!("{}{} edition", edition, suffix).as_bytes()) + .add_subfield(b"a", format!("{}{} edition.", edition, suffix).as_bytes()) .and_then(|f| builder.add_field(f))?; } @@ -1592,7 +1592,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02338nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250001600542264004000558264001100598300002300609336002600632337002600658338003600684490005000720500008300770504005300853505006000906506005000966520003101016536006801047538003601115540022301151588005801374700006601432700003701498710002901535830005001564856005801614856005901672856007701731\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02339nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250001700542264004000559264001100599300002300610336002600633337002600659338003600685490005000721500008300771504005300854505006000907506005000967520003101017536006801048538003601116540022301152588005801375700006601433700003701499710002901536830005001565856005801615856005901673856007701732\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition.\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index c2c71e83..8a93bfe8 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02338nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02339nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02338nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02338nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02339nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02339nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From 6a5e11fb19443d350530be7dd3d3c3a3b5f6f0c2 Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 26 Sep 2023 13:55:46 +0100 Subject: [PATCH 33/37] 250 Edition: omit for 1st as unnecessary, spell out commonest ordinals --- .../src/marc21/marc21markup_thoth.rs | 2 +- .../src/marc21/marc21record_thoth.rs | 34 +++++++++++++------ .../src/xml/marc21xml_thoth.rs | 4 +-- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index ef1107f7..5e65f448 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02339nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$a1st edition.\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02342nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$aSecond edition.\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 0da51057..68e7edb6 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -208,15 +208,27 @@ impl Marc21Entry for Work { // 250 - edition statement if let Some(edition) = &self.edition { - let suffix = match edition % 10 { - 1 if edition % 100 != 11 => "st", - 2 if edition % 100 != 12 => "nd", - 3 if edition % 100 != 13 => "rd", - _ => "th", - }; - FieldRepr::from((b"250", "\\\\")) - .add_subfield(b"a", format!("{}{} edition.", edition, suffix).as_bytes()) - .and_then(|f| builder.add_field(f))?; + if let Some(edition_statement) = match edition { + // Edition statement not required for first edition + 1 => None, + // RDA best practice is to spell out ordinals rather than abbreviate + // Implement this for the commonest ones, as a compromise + 2 => Some("Second edition.".to_string()), + 3 => Some("Third edition.".to_string()), + _ => { + let suffix = match edition % 10 { + 1 if edition % 100 != 11 => "st", + 2 if edition % 100 != 12 => "nd", + 3 if edition % 100 != 13 => "rd", + _ => "th", + }; + Some(format!("{}{} edition.", edition, suffix)) + } + } { + FieldRepr::from((b"250", "\\\\")) + .add_subfield(b"a", edition_statement) + .and_then(|f| builder.add_field(f))?; + } } // 264 - publication @@ -699,7 +711,7 @@ pub(crate) mod tests { subtitle: Some("Book Subtitle".to_string()), work_type: WorkType::MONOGRAPH, reference: None, - edition: Some(1), + edition: Some(2), doi: Some(Doi::from_str("https://doi.org/10.00001/BOOK.0001").unwrap()), publication_date: chrono::NaiveDate::from_ymd_opt(2010, 2, 1), license: Some("https://creativecommons.org/licenses/by/4.0/".to_string()), @@ -1592,7 +1604,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02339nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250001700542264004000559264001100599300002300610336002600633337002600659338003600685490005000721500008300771504005300854505006000907506005000967520003101017536006801048538003601116540022301152588005801375700006601433700003701499710002901536830005001565856005801615856005901673856007701732\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}a1st edition.\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02342nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250002000542264004000562264001100602300002300613336002600636337002600662338003600688490005000724500008300774504005300857505006000910506005000970520003101020536006801051538003601119540022301155588005801378700006601436700003701502710002901539830005001568856005801618856005901676856007701735\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}aSecond edition.\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 8a93bfe8..260014ee 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02339nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02342nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02339nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02339nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n 1st edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02342nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02342nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From a00ccdd9beb2ad7d007bae7de7ad28e71c294ace Mon Sep 17 00:00:00 2001 From: rhigman <73792779+rhigman@users.noreply.github.com> Date: Tue, 26 Sep 2023 14:02:18 +0100 Subject: [PATCH 34/37] Improve punctuation in 490/830 Series --- thoth-export-server/src/marc21/marc21markup_thoth.rs | 2 +- thoth-export-server/src/marc21/marc21record_thoth.rs | 6 +++--- thoth-export-server/src/xml/marc21xml_thoth.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/thoth-export-server/src/marc21/marc21markup_thoth.rs b/thoth-export-server/src/marc21/marc21markup_thoth.rs index 5e65f448..d7e76612 100644 --- a/thoth-export-server/src/marc21/marc21markup_thoth.rs +++ b/thoth-export-server/src/marc21/marc21markup_thoth.rs @@ -39,7 +39,7 @@ mod tests { fn test_generate_marc_markup() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("=LDR 02342nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$aSecond edition.\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series$vvol. 11$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series$vvol. 11$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); + let expected = format!("=LDR 02348nam 22005292 4500\n=001 00000000-0000-0000-aaaa-000000000001\n=006 m\\\\\\\\\\o\\\\d\\\\\\\\\\\\\\\\\n=007 cr\\\\n\\\\\\\\\\\\\\\\\\\n=008 {current_date}t20102010\\\\\\\\\\\\\\\\ob\\\\\\\\001\\0\\eng\\d\n=010 \\\\$aLCCN010101\n=020 \\\\$a9783161484100$q(PDF)\n=020 \\\\$a9789295055025$q(XML)\n=020 \\\\$z9781402894626$q(Hardback)\n=024 7\\$a10.00001/BOOK.0001$2doi\n=024 7\\$aOCLC010101$2worldcat\n=040 \\\\$aUkCbTOM$beng$elocal\n=041 1\\$aeng$hspa\n=050 00$aJA85\n=072 7$aAAB$2bicssc\n=072 7$aAAA000000$2bisacsh\n=072 7$aJWA$2thema\n=100 1\\$aAuthor, Sole,$eauthor.$uThoth University.$1https://orcid.org/0000-0002-0000-0001\n=245 10$aBook Title :$bBook Subtitle /$cSole Author; edited by Only Editor; translated by Translator.\n=250 \\\\$aSecond edition.\n=264 \\1$aLeón, Spain :$bOA Editions,$c2010.\n=264 \\4$c©2010\n=300 \\\\$a1 online resource.\n=336 \\\\$atext$btxt$2rdacontent\n=337 \\\\$acomputer$bc$2rdamedia\n=338 \\\\$aonline resource$bcr$2rdacarrier\n=490 1\\$aName of series ;$vvol. 11.$x8765-4321$x1234-5678\n=500 \\\\$aPlease note that in this book the mathematical formulas are encoded in MathML.\n=504 \\\\$aIncludes bibliography (pages 165-170) and index.\n=505 0\\$aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\n=506 0\\$aOpen Access$fUnrestricted online access$2star\n=520 \\\\$aLorem ipsum dolor sit amet\n=536 \\\\$aFunding Institution$cJA0001$eFunding Programme$fFunding Project\n=538 \\\\$aMode of access: World Wide Web.\n=540 \\\\$aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.$uhttps://creativecommons.org/licenses/by/4.0/\n=588 0\\$aMetadata licensed under CC0 Public Domain Dedication.\n=700 1\\$aEditor, Only,$eeditor.$1https://orcid.org/0000-0002-0000-0004\n=700 0\\$aTranslator,$etranslator.$uCOPIM.\n=710 2\\$aOA Editions,$epublisher.\n=830 \\0$aName of series ;$vvol. 11.$x8765-4321$x1234-5678\n=856 40$uhttps://doi.org/10.00001/book.0001$zConnect to e-book\n=856 42$uhttps://www.book.com/cover.jpg$zConnect to cover image\n=856 42$uhttps://creativecommons.org/publicdomain/zero/1.0/$zCC0 Metadata License\n"); assert_eq!(Marc21MarkupThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/marc21/marc21record_thoth.rs b/thoth-export-server/src/marc21/marc21record_thoth.rs index 68e7edb6..ab499f07 100644 --- a/thoth-export-server/src/marc21/marc21record_thoth.rs +++ b/thoth-export-server/src/marc21/marc21record_thoth.rs @@ -554,9 +554,9 @@ impl Marc21Field for WorkIssues { let fields = [(b"490", "1\\"), (b"830", "\\0")]; for (field, indicator) in fields { FieldRepr::from((field, indicator)) - .add_subfield(b"a", self.series.series_name.as_bytes()) + .add_subfield(b"a", format!("{} ;", self.series.series_name).as_bytes()) .and_then(|f| { - f.add_subfield(b"v", format!("vol. {}", self.issue_ordinal).as_bytes()) + f.add_subfield(b"v", format!("vol. {}.", self.issue_ordinal).as_bytes()) }) .and_then(|f| f.add_subfield(b"x", self.series.issn_digital.as_bytes())) .and_then(|f| f.add_subfield(b"x", self.series.issn_print.as_bytes())) @@ -1604,7 +1604,7 @@ pub(crate) mod tests { fn test_generate_marc() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("02342nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250002000542264004000562264001100602300002300613336002600636337002600662338003600688490005000724500008300774504005300857505006000910506005000970520003101020536006801051538003601119540022301155588005801378700006601436700003701502710002901539830005001568856005801618856005901676856007701735\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}aSecond edition.\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series\u{1f}vvol. 11\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); + let expected = format!("02348nam 22005292 4500001003700000006001900037007001500056008004100071010001500112020002500127020002500152020003000177024002800207024002500235040002400260041001300284050000900297072001600306072002300322072001500345100008500360245009700445250002000542264004000562264001100602300002300613336002600636337002600662338003600688490005300724500008300777504005300860505006000913506005000973520003101023536006801054538003601122540022301158588005801381700006601439700003701505710002901542830005301571856005801624856005901682856007701741\u{1e}00000000-0000-0000-aaaa-000000000001\u{1e}m o d \u{1e}cr n \u{1e}{current_date}t20102010 ob 001 0 eng d\u{1e}\\\\\u{1f}aLCCN010101\u{1e}\\\\\u{1f}a9783161484100\u{1f}q(PDF)\u{1e}\\\\\u{1f}a9789295055025\u{1f}q(XML)\u{1e}\\\\\u{1f}z9781402894626\u{1f}q(Hardback)\u{1e}7\\\u{1f}a10.00001/BOOK.0001\u{1f}2doi\u{1e}7\\\u{1f}aOCLC010101\u{1f}2worldcat\u{1e}\\\\\u{1f}aUkCbTOM\u{1f}beng\u{1f}elocal\u{1e}1\\\u{1f}aeng\u{1f}hspa\u{1e}00\u{1f}aJA85\u{1e} 7\u{1f}aAAB\u{1f}2bicssc\u{1e} 7\u{1f}aAAA000000\u{1f}2bisacsh\u{1e} 7\u{1f}aJWA\u{1f}2thema\u{1e}1\\\u{1f}aAuthor, Sole,\u{1f}eauthor.\u{1f}uThoth University.\u{1f}1https://orcid.org/0000-0002-0000-0001\u{1e}10\u{1f}aBook Title :\u{1f}bBook Subtitle /\u{1f}cSole Author; edited by Only Editor; translated by Translator.\u{1e}\\\\\u{1f}aSecond edition.\u{1e}\\1\u{1f}aLeón, Spain :\u{1f}bOA Editions,\u{1f}c2010.\u{1e}\\4\u{1f}c©2010\u{1e}\\\\\u{1f}a1 online resource.\u{1e}\\\\\u{1f}atext\u{1f}btxt\u{1f}2rdacontent\u{1e}\\\\\u{1f}acomputer\u{1f}bc\u{1f}2rdamedia\u{1e}\\\\\u{1f}aonline resource\u{1f}bcr\u{1f}2rdacarrier\u{1e}1\\\u{1f}aName of series ;\u{1f}vvol. 11.\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}\\\\\u{1f}aPlease note that in this book the mathematical formulas are encoded in MathML.\u{1e}\\\\\u{1f}aIncludes bibliography (pages 165-170) and index.\u{1e}0\\\u{1f}aIntroduction; Chapter 1; Chapter 2; Bibliography; Index\u{1e}0\\\u{1f}aOpen Access\u{1f}fUnrestricted online access\u{1f}2star\u{1e}\\\\\u{1f}aLorem ipsum dolor sit amet\u{1e}\\\\\u{1f}aFunding Institution\u{1f}cJA0001\u{1f}eFunding Programme\u{1f}fFunding Project\u{1e}\\\\\u{1f}aMode of access: World Wide Web.\u{1e}\\\\\u{1f}aThe text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\u{1f}uhttps://creativecommons.org/licenses/by/4.0/\u{1e}0\\\u{1f}aMetadata licensed under CC0 Public Domain Dedication.\u{1e}1\\\u{1f}aEditor, Only,\u{1f}eeditor.\u{1f}1https://orcid.org/0000-0002-0000-0004\u{1e}0\\\u{1f}aTranslator,\u{1f}etranslator.\u{1f}uCOPIM.\u{1e}2\\\u{1f}aOA Editions,\u{1f}epublisher.\u{1e}\\0\u{1f}aName of series ;\u{1f}vvol. 11.\u{1f}x8765-4321\u{1f}x1234-5678\u{1e}40\u{1f}uhttps://doi.org/10.00001/book.0001\u{1f}zConnect to e-book\u{1e}42\u{1f}uhttps://www.book.com/cover.jpg\u{1f}zConnect to cover image\u{1e}42\u{1f}uhttps://creativecommons.org/publicdomain/zero/1.0/\u{1f}zCC0 Metadata License\u{1e}\u{1d}"); assert_eq!(Marc21RecordThoth {}.generate(&[work]), Ok(expected)) } diff --git a/thoth-export-server/src/xml/marc21xml_thoth.rs b/thoth-export-server/src/xml/marc21xml_thoth.rs index 260014ee..dcad0d52 100644 --- a/thoth-export-server/src/xml/marc21xml_thoth.rs +++ b/thoth-export-server/src/xml/marc21xml_thoth.rs @@ -40,7 +40,7 @@ mod tests { fn test_generate_marc_xml_single_work() { let work = test_work(); let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n 02342nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); + let expected = format!("\n\n 02348nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series ;\n vol. 11.\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series ;\n vol. 11.\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n"); assert_eq!(Marc21XmlThoth {}.generate(&[work]), Ok(expected)) } @@ -49,7 +49,7 @@ mod tests { fn test_generate_marc_xml_multiple_works() { let works = &[test_work(), test_work()]; let current_date = Utc::now().format("%y%m%d").to_string(); - let expected = format!("\n\n \n 02342nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02342nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series\n vol. 11\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); + let expected = format!("\n\n \n 02348nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series ;\n vol. 11.\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series ;\n vol. 11.\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n \n 02348nam 22005292 4500\n 00000000-0000-0000-aaaa-000000000001\n m o d \n cr n \n {current_date}t20102010 ob 001 0 eng d\n \n LCCN010101\n \n \n 9783161484100\n (PDF)\n \n \n 9789295055025\n (XML)\n \n \n 9781402894626\n (Hardback)\n \n \n 10.00001/BOOK.0001\n doi\n \n \n OCLC010101\n worldcat\n \n \n UkCbTOM\n eng\n local\n \n \n eng\n spa\n \n \n JA85\n \n \n AAB\n bicssc\n \n \n AAA000000\n bisacsh\n \n \n JWA\n thema\n \n \n Author, Sole,\n author.\n Thoth University.\n https://orcid.org/0000-0002-0000-0001\n \n \n Book Title :\n Book Subtitle /\n Sole Author; edited by Only Editor; translated by Translator.\n \n \n Second edition.\n \n \n León, Spain :\n OA Editions,\n 2010.\n \n \n ©2010\n \n \n 1 online resource.\n \n \n text\n txt\n rdacontent\n \n \n computer\n c\n rdamedia\n \n \n online resource\n cr\n rdacarrier\n \n \n Name of series ;\n vol. 11.\n 8765-4321\n 1234-5678\n \n \n Please note that in this book the mathematical formulas are encoded in MathML.\n \n \n Includes bibliography (pages 165-170) and index.\n \n \n Introduction; Chapter 1; Chapter 2; Bibliography; Index\n \n \n Open Access\n Unrestricted online access\n star\n \n \n Lorem ipsum dolor sit amet\n \n \n Funding Institution\n JA0001\n Funding Programme\n Funding Project\n \n \n Mode of access: World Wide Web.\n \n \n The text of this book is licensed under a Creative Commons Attribution 4.0 International license (CC BY 4.0). For more detailed information consult the publisher's website.\n https://creativecommons.org/licenses/by/4.0/\n \n \n Metadata licensed under CC0 Public Domain Dedication.\n \n \n Editor, Only,\n editor.\n https://orcid.org/0000-0002-0000-0004\n \n \n Translator,\n translator.\n COPIM.\n \n \n OA Editions,\n publisher.\n \n \n Name of series ;\n vol. 11.\n 8765-4321\n 1234-5678\n \n \n https://doi.org/10.00001/book.0001\n Connect to e-book\n \n \n https://www.book.com/cover.jpg\n Connect to cover image\n \n \n https://creativecommons.org/publicdomain/zero/1.0/\n CC0 Metadata License\n \n \n"); assert_eq!(Marc21XmlThoth {}.generate(works), Ok(expected)) } From df7b7805eea4b9bdf50acb342059955bbc2558e0 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Fri, 29 Sep 2023 15:35:10 +0100 Subject: [PATCH 35/37] Update about page --- thoth-app/src/component/about.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/thoth-app/src/component/about.rs b/thoth-app/src/component/about.rs index 3a477aea..f8c685dc 100644 --- a/thoth-app/src/component/about.rs +++ b/thoth-app/src/component/about.rs @@ -34,6 +34,11 @@ impl Component for AboutComponent {
  • { "Toby Steiner (COO)" }
  • { "Javier Arias (CTO)" }
  • { "Ross Higman (Software Engineer)" }
  • +
  • { "Hannah Hillen (Metadata & Publisher Outreach Specialist)" }
  • + +

    { "Consultants" }

    +
      +
    • { "Amanda Ramalho (Thoth Representative, Latin America)" }

    { "Support us through the " }{ "Open Book Collective" }{ "." }

    { "Contact us at " }{ "info@thoth.pub" }{ "." }

    From eccad50cf74b58a61c59affbf68a0382eb3ef7d9 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 2 Oct 2023 10:29:06 +0100 Subject: [PATCH 36/37] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 590c6743..53a9c9bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [[0.11.7]](https://github.com/thoth-pub/thoth/releases/tag/v0.11.7) - 2023-10-02 ### Changed + - Improve MARC records with recommendations - Upgrade `actix-identity` to v0.6.0 - Upgrade `actix-session` to v0.8.0 - Upgrade `chrono` to v0.4.31 From 4370f3c11614a40075cac7fcfdffce062f49b866 Mon Sep 17 00:00:00 2001 From: Javier Arias Date: Mon, 2 Oct 2023 10:29:14 +0100 Subject: [PATCH 37/37] Bump v0.11.7 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 12 ++++++------ thoth-api-server/Cargo.toml | 6 +++--- thoth-api/Cargo.toml | 4 ++-- thoth-app-server/Cargo.toml | 2 +- thoth-app/Cargo.toml | 6 +++--- thoth-app/manifest.json | 2 +- thoth-client/Cargo.toml | 6 +++--- thoth-errors/Cargo.toml | 2 +- thoth-export-server/Cargo.toml | 8 ++++---- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ddf47112..fb6e10b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3398,7 +3398,7 @@ dependencies = [ [[package]] name = "thoth" -version = "0.11.6" +version = "0.11.7" dependencies = [ "cargo-husky", "clap", @@ -3413,7 +3413,7 @@ dependencies = [ [[package]] name = "thoth-api" -version = "0.11.6" +version = "0.11.7" dependencies = [ "actix-web", "argon2rs", @@ -3442,7 +3442,7 @@ dependencies = [ [[package]] name = "thoth-api-server" -version = "0.11.6" +version = "0.11.7" dependencies = [ "actix-cors", "actix-identity", @@ -3458,7 +3458,7 @@ dependencies = [ [[package]] name = "thoth-app" -version = "0.11.6" +version = "0.11.7" dependencies = [ "anyhow", "chrono", @@ -3487,7 +3487,7 @@ dependencies = [ [[package]] name = "thoth-app-server" -version = "0.11.6" +version = "0.11.7" dependencies = [ "actix-cors", "actix-web", @@ -3496,7 +3496,7 @@ dependencies = [ [[package]] name = "thoth-client" -version = "0.11.6" +version = "0.11.7" dependencies = [ "chrono", "graphql_client", @@ -3512,7 +3512,7 @@ dependencies = [ [[package]] name = "thoth-errors" -version = "0.11.6" +version = "0.11.7" dependencies = [ "actix-web", "csv", @@ -3532,7 +3532,7 @@ dependencies = [ [[package]] name = "thoth-export-server" -version = "0.11.6" +version = "0.11.7" dependencies = [ "actix-cors", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index 20d63491..8d79a5e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" @@ -16,11 +16,11 @@ maintenance = { status = "actively-developed" } members = ["thoth-api", "thoth-api-server", "thoth-app", "thoth-app-server", "thoth-client", "thoth-errors", "thoth-export-server"] [dependencies] -thoth-api = { version = "0.11.6", path = "thoth-api", features = ["backend"] } -thoth-api-server = { version = "0.11.6", path = "thoth-api-server" } -thoth-app-server = { version = "0.11.6", path = "thoth-app-server" } -thoth-errors = { version = "0.11.6", path = "thoth-errors" } -thoth-export-server = { version = "0.11.6", path = "thoth-export-server" } +thoth-api = { version = "0.11.7", path = "thoth-api", features = ["backend"] } +thoth-api-server = { version = "0.11.7", path = "thoth-api-server" } +thoth-app-server = { version = "0.11.7", path = "thoth-app-server" } +thoth-errors = { version = "0.11.7", path = "thoth-errors" } +thoth-export-server = { version = "0.11.7", path = "thoth-export-server" } clap = { version = "4.4.2", features = ["cargo", "env"] } dialoguer = { version = "0.10.4", features = ["password"] } dotenv = "0.15.0" diff --git a/thoth-api-server/Cargo.toml b/thoth-api-server/Cargo.toml index 5e891cea..4ddeb85f 100644 --- a/thoth-api-server/Cargo.toml +++ b/thoth-api-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api-server" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth" readme = "README.md" [dependencies] -thoth-api = { version = "0.11.6", path = "../thoth-api", features = ["backend"] } -thoth-errors = { version = "0.11.6", path = "../thoth-errors" } +thoth-api = { version = "0.11.7", path = "../thoth-api", features = ["backend"] } +thoth-errors = { version = "0.11.7", path = "../thoth-errors" } actix-web = "4.4.0" actix-cors = "0.6.4" actix-identity = "0.6.0" diff --git a/thoth-api/Cargo.toml b/thoth-api/Cargo.toml index 8fc37883..6484bd40 100644 --- a/thoth-api/Cargo.toml +++ b/thoth-api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-api" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" @@ -16,7 +16,7 @@ maintenance = { status = "actively-developed" } backend = ["diesel", "diesel-derive-enum", "diesel_migrations", "futures", "actix-web"] [dependencies] -thoth-errors = { version = "0.11.6", path = "../thoth-errors" } +thoth-errors = { version = "0.11.7", path = "../thoth-errors" } actix-web = { version = "4.4.0", optional = true } argon2rs = "0.2.5" isbn2 = "0.4.0" diff --git a/thoth-app-server/Cargo.toml b/thoth-app-server/Cargo.toml index 7f7aeb28..8165e873 100644 --- a/thoth-app-server/Cargo.toml +++ b/thoth-app-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app-server" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" diff --git a/thoth-app/Cargo.toml b/thoth-app/Cargo.toml index 8d1475eb..4950ce7e 100644 --- a/thoth-app/Cargo.toml +++ b/thoth-app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-app" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" @@ -41,5 +41,5 @@ uuid = { version = "0.8.2", features = ["serde", "v4"] } # `getrandom` is a dependency of `uuid`, we need to explicitly import and include the `js` feature to enable wasm # https://docs.rs/getrandom/latest/getrandom/#webassembly-support getrandom = { version = "0.2", features = ["js"] } -thoth-api = { version = "0.11.6", path = "../thoth-api" } -thoth-errors = { version = "0.11.6", path = "../thoth-errors" } +thoth-api = { version = "0.11.7", path = "../thoth-api" } +thoth-errors = { version = "0.11.7", path = "../thoth-errors" } diff --git a/thoth-app/manifest.json b/thoth-app/manifest.json index f3a254ec..47bc0e2e 100644 --- a/thoth-app/manifest.json +++ b/thoth-app/manifest.json @@ -9,7 +9,7 @@ "start_url": "/?homescreen=1", "background_color": "#ffffff", "theme_color": "#ffdd57", - "version": "0.11.6", + "version": "0.11.7", "icons": [ { "src": "\/android-icon-36x36.png", diff --git a/thoth-client/Cargo.toml b/thoth-client/Cargo.toml index 1ce2ce29..86e8b0cb 100644 --- a/thoth-client/Cargo.toml +++ b/thoth-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-client" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" @@ -9,8 +9,8 @@ repository = "https://github.com/thoth-pub/thoth" readme = "README.md" [dependencies] -thoth-api = {version = "0.11.6", path = "../thoth-api" } -thoth-errors = {version = "0.11.6", path = "../thoth-errors" } +thoth-api = {version = "0.11.7", path = "../thoth-api" } +thoth-errors = {version = "0.11.7", path = "../thoth-errors" } graphql_client = "0.13.0" chrono = { version = "0.4.31", features = ["serde"] } reqwest = { version = "0.11", features = ["json"] } diff --git a/thoth-errors/Cargo.toml b/thoth-errors/Cargo.toml index 5299eac3..e2742197 100644 --- a/thoth-errors/Cargo.toml +++ b/thoth-errors/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-errors" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" diff --git a/thoth-export-server/Cargo.toml b/thoth-export-server/Cargo.toml index 23b090ac..3801d70d 100644 --- a/thoth-export-server/Cargo.toml +++ b/thoth-export-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "thoth-export-server" -version = "0.11.6" +version = "0.11.7" authors = ["Javier Arias ", "Ross Higman "] edition = "2018" license = "Apache-2.0" @@ -9,9 +9,9 @@ repository = "https://github.com/thoth-pub/thoth" readme = "README.md" [dependencies] -thoth-api = { version = "0.11.6", path = "../thoth-api" } -thoth-errors = { version = "0.11.6", path = "../thoth-errors" } -thoth-client = { version = "0.11.6", path = "../thoth-client" } +thoth-api = { version = "0.11.7", path = "../thoth-api" } +thoth-errors = { version = "0.11.7", path = "../thoth-errors" } +thoth-client = { version = "0.11.7", path = "../thoth-client" } actix-web = "4.4.0" actix-cors = "0.6.4" cc_license = "0.1.0"