diff --git a/.gitignore b/.gitignore index 758612b6a..f1282a77d 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,3 @@ # Ignore all files ending in "swp", vim swap files **/*.swp - -# Ingnore import directory -import/ diff --git a/lib/import.rb b/lib/import.rb index 6f631377b..b7353ed5e 100644 --- a/lib/import.rb +++ b/lib/import.rb @@ -23,7 +23,7 @@ module Import MONOGRAPH_FIELDS = [ { field_name: 'Publisher', metadata_name: 'publisher', multivalued: :yes }, - { field_name: 'Subject', metadata_name: 'subject', multivalued: :yes }, + { field_name: 'Subject', metadata_name: 'subject', multivalued: :yes_split }, { field_name: 'ISBN (hardcover)', metadata_name: 'isbn', multivalued: :yes }, { field_name: 'ISBN (paper)', metadata_name: 'isbn_paper', multivalued: :yes }, { field_name: 'ISBN (ebook)', metadata_name: 'isbn_ebook', multivalued: :yes }, diff --git a/spec/fixtures/csv/import_sections/tempest_sections.csv b/spec/fixtures/csv/import_sections/tempest_sections.csv index ff80272d5..ee4419950 100644 --- a/spec/fixtures/csv/import_sections/tempest_sections.csv +++ b/spec/fixtures/csv/import_sections/tempest_sections.csv @@ -1,18 +1,18 @@ -File Name,Title,Resource Type,Content Type,Language,Externally Hosted Resource,Book and Platform (BP) or Platform-only (P),Rights Granted - Creative Commons,Primary Creator Last Name,Primary Creator First Name,Additional Creator(s),Keywords,Section +File Name,Title,Resource Type,Content Type,Language,Externally Hosted Resource,Book and Platform (BP) or Platform-only (P),Rights Granted - Creative Commons,Primary Creator Last Name,Primary Creator First Name,Additional Creator(s),Keywords,Section,Subject ,"Title of the object A name given to the resource. Examples: title of a painting, photo, video.",,,,,,,"An entity primarily responsible for making the resource. Examples: Author/authors; artists; photographers; institutional authors or producers, such as university or federal agency. ",,,, -://:MONOGRAPH://:,The Tempest; A Subtitle,,,,,,, Shakespeare,William,Christopher Marlowe; Sir Francis Bacon,,://:MONOGRAPH://: -shipwreck.jpg,Monograph Shipwreck,image,portrait,English,No,BP,"Creative Commons Attribution-ShareAlike license, 3.0 Unported",Smith,Benjamin ,,, -miranda.jpg,Monograph Miranda, image,audience materials,English; German,no,P,Creative Commons Zero license (implies pd),Waterhouse,John William,,, -ファイル.txt,日本語のファイル ,text,portrait; illustration,Japanese,no,P,Creative Commons Zero license (implies pd),,,,, -shipwreck1.jpg,Section 1 Shipwreck,image,audience materials,Russian,No,P,Creative Commons Zero license (implies pd),Smith,,,keyword1; keyword2;,Act 1: Calm Waters -miranda1.jpg,Section 1 Miranda,image,portrait,Russian; German; French,no,P,Creative Commons Zero license (implies pd),Waterhouse,John William,,regular; _italicized_,Act 1: Calm Waters -shipwreck2.jpg,Section 2 Shipwreck,image,audience materials,French,No,P,Creative Commons Zero license (implies pd),Smith,,,,Act 2: Stirrin' Up -miranda2.jpg,Section 2 Miranda,image,illustration,English,no,P,Creative Commons Zero license (implies pd),Waterhouse,John William,,,Act 2: Stirrin' Up -shipwreck1.jpg,Previous Shipwreck File (Again),image,portrait; photograph,Latin,No,P,Creative Commons Zero license (implies pd),Smith,,,,Act 2: Stirrin' Up -,,,,,,,,,,,, -,,,,,,,,,,,, -,,,,,,,,,,,, -,,,,,,,,,,,, -,c,,,,,,,,,,, +://:MONOGRAPH://:,The Tempest; A Subtitle,,,,,,, Shakespeare,William,Christopher Marlowe; Sir Francis Bacon,,://:MONOGRAPH://:,Dog;Cat;Mouse +shipwreck.jpg,Monograph Shipwreck,image,portrait,English,No,BP,"Creative Commons Attribution-ShareAlike license, 3.0 Unported",Smith,Benjamin ,,,, +miranda.jpg,Monograph Miranda, image,audience materials,English; German,no,P,Creative Commons Zero license (implies pd),Waterhouse,John William,,,, +ファイル.txt,日本語のファイル ,text,portrait; illustration,Japanese,no,P,Creative Commons Zero license (implies pd),,,,,, +shipwreck1.jpg,Section 1 Shipwreck,image,audience materials,Russian,No,P,Creative Commons Zero license (implies pd),Smith,,,keyword1; keyword2;,Act 1: Calm Waters, +miranda1.jpg,Section 1 Miranda,image,portrait,Russian; German; French,no,P,Creative Commons Zero license (implies pd),Waterhouse,John William,,regular; _italicized_,Act 1: Calm Waters, +shipwreck2.jpg,Section 2 Shipwreck,image,audience materials,French,No,P,Creative Commons Zero license (implies pd),Smith,,,,Act 2: Stirrin' Up, +miranda2.jpg,Section 2 Miranda,image,illustration,English,no,P,Creative Commons Zero license (implies pd),Waterhouse,John William,,,Act 2: Stirrin' Up, +shipwreck1.jpg,Previous Shipwreck File (Again),image,portrait; photograph,Latin,No,P,Creative Commons Zero license (implies pd),Smith,,,,Act 2: Stirrin' Up, +,,,,,,,,,,,,, +,,,,,,,,,,,,, +,,,,,,,,,,,,, +,,,,,,,,,,,,, +,c,,,,,,,,,,,, diff --git a/spec/lib/import/csv_parser_spec.rb b/spec/lib/import/csv_parser_spec.rb index 39a25833a..e901415b4 100644 --- a/spec/lib/import/csv_parser_spec.rb +++ b/spec/lib/import/csv_parser_spec.rb @@ -25,6 +25,7 @@ expect(subject['monograph']['creator_family_name']).to eq 'Shakespeare' expect(subject['monograph']['creator_given_name']).to eq 'William' expect(subject['monograph']['contributor']).to eq ['Christopher Marlowe', 'Sir Francis Bacon'] + expect(subject['monograph']['subject']).to eq ['Dog', 'Cat', 'Mouse'] expect(subject['monograph']['files']).to eq ['shipwreck.jpg', 'miranda.jpg', 'ファイル.txt'] expect(subject['monograph']['files_metadata']).to eq [ { 'title' => ['Monograph Shipwreck'], diff --git a/spec/lib/import/monograph_builder_spec.rb b/spec/lib/import/monograph_builder_spec.rb index ba9998466..ca82f2d1c 100644 --- a/spec/lib/import/monograph_builder_spec.rb +++ b/spec/lib/import/monograph_builder_spec.rb @@ -9,7 +9,7 @@ 'press' => 'umich', 'visibility' => public_vis, 'publisher' => ['Blah Press'], - 'subject' => ['Stuff'], + 'subject' => ['Stuff', 'Things'], 'description' => ['The Right Stuff'], 'isbn' => ['555-7-5432-1234-9'], 'isbn_paper' => ['555-7-5432-1235-0'], @@ -52,6 +52,7 @@ expect(monograph.isbn_paper).to eq attrs['isbn_paper'] expect(monograph.isbn_ebook).to eq attrs['isbn_ebook'] expect(monograph.buy_url).to eq attrs['buy_url'] + expect(monograph.subject.count).to eq 2 expect(monograph.ordered_member_ids.count).to eq 2 shipwreck, miranda = monograph.ordered_members.to_a