From 222579107092599ce0bcde3b3b7cd95e169a9156 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Tue, 4 Aug 2020 10:05:40 -0400 Subject: [PATCH 1/4] Update migration.csv --- data/migration.csv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/data/migration.csv b/data/migration.csv index e759770e..0dcbdafb 100644 --- a/data/migration.csv +++ b/data/migration.csv @@ -1,6 +1,6 @@ -file,title,subtitle,description,issued,subject,photographer,provider -/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nails Nails Nails.jpg,Nails Nails Nails,,A sign pointing towards a nail salon.,2018-01-01,Neon signs|Night,Clem Onojeghuo,Clawde|Clawbster -/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Free Smells.jpg,Free Smells,We're givin' 'em away,A sign on a restaurant front advertising free smells,2018-02-01,Neon signs|Night|Funny,The Collab,Clawde|Clawbster -/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nothing to See Here.jpg,Nothing To See Here,Move Along People,A sign above a building that says "Nothing to see here",2018-03-01,Neon signs|Night,Argelis Rebolledo,Clawde|Clawbster -/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Call For Champagne.jpg,Call For Champagne,,A neon sign above some rotary telephones telling customers to call for champagne.,2018-04-01,Drinking|Neon signs,Design Doctor,Clawde|Clawbster -/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/This Must Be The Place.jpg,This Must Be The Place,,A neon sign on a multi-colored wall that reads "This Must Be The Place",2018-05-01,Neon signs,Tim Mossholder,Clawde|Clawbster +ID,file,title,subtitle,description,issued,subject,photographer,provider +1,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nails Nails Nails.jpg,Nails Nails Nails,,A sign pointing towards a nail salon.,2018-01-01,Neon signs|Night,Clem Onojeghuo,Clawde|Clawbster +2,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Free Smells.jpg,Free Smells,We're givin' 'em away,A sign on a restaurant front advertising free smells,2018-02-01,Neon signs|Night|Funny,The Collab,Clawde|Clawbster +3,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nothing to See Here.jpg,Nothing To See Here,Move Along People,A sign above a building that says "Nothing to see here",2018-03-01,Neon signs|Night,Argelis Rebolledo,Clawde|Clawbster +4,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Call For Champagne.jpg,Call For Champagne,,A neon sign above some rotary telephones telling customers to call for champagne.,2018-04-01,Drinking|Neon signs,Design Doctor,Clawde|Clawbster +5,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/This Must Be The Place.jpg,This Must Be The Place,,A neon sign on a multi-colored wall that reads "This Must Be The Place",2018-05-01,Neon signs,Tim Mossholder,Clawde|Clawbster From 18f90b0c8ff355747f2c882df4a0513d5c044d04 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Wed, 5 Aug 2020 13:59:48 -0400 Subject: [PATCH 2/4] Add by ID Update migrate_plus.migration.example_migration_media.yml Update migrate_plus.migration.example_migration_node.yml Update migrate_plus.migration.example_migration_file.yml Update migration.csv Change file to filename & resolves naming conflict --- ...migrate_plus.migration.example_migration_file.yml | 12 ++++++------ ...igrate_plus.migration.example_migration_media.yml | 8 ++++---- ...migrate_plus.migration.example_migration_node.yml | 6 +++--- data/migration.csv | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/config/install/migrate_plus.migration.example_migration_file.yml b/config/install/migrate_plus.migration.example_migration_file.yml index fe814af3..22efa933 100644 --- a/config/install/migrate_plus.migration.example_migration_file.yml +++ b/config/install/migrate_plus.migration.example_migration_file.yml @@ -16,9 +16,9 @@ source: # 1 means you have a header row, 0 means you don't header_row_count: 1 - # Each migration needs a unique key per row in the csv. Here we're using the file path. + # Each migration needs a unique key per row in the csv. Here we're using the ID, it was an arbitrary selection but one that is unique to each CSV row. keys: - - file + - ID # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. constants: @@ -41,11 +41,11 @@ process: uid: constants/uid # Hack the file name out of the full path provided in the 'file' column. - filename: + filepath: - plugin: callback callable: pathinfo - source: file + source: filename - plugin: extract index: @@ -57,7 +57,7 @@ process: delimiter: / source: - constants/destination_dir - - '@filename' + - '@filepath' ## # Here's where we copy the file over and set the uri of the file entity. @@ -65,7 +65,7 @@ process: uri: plugin: file_copy source: - - file # The source column in the CSV + - filename # The source column in the CSV - '@destination' # The destination entry from above diff --git a/config/install/migrate_plus.migration.example_migration_media.yml b/config/install/migrate_plus.migration.example_migration_media.yml index f4bbe50f..c175bc87 100644 --- a/config/install/migrate_plus.migration.example_migration_media.yml +++ b/config/install/migrate_plus.migration.example_migration_media.yml @@ -15,9 +15,9 @@ source: # 1 means you have a header row, 0 means you don't header_row_count: 1 - # Each migration needs a unique key per row in the csv. Here we're using the file path. + # Each migration needs a unique key per row in the csv. Here we're using the ID, it was an arbitrary selection but one that is unique to each CSV row. keys: - - file + - ID # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. constants: @@ -44,14 +44,14 @@ process: # Lookup the migrated file in the file migration. field_media_image: plugin: migration_lookup - source: file + source: ID migration: example_migration_file no_stub: true # Lookup the migrated node in the node migration field_media_of: plugin: migration_lookup - source: file + source: ID migration: example_migration_node no_stub: true diff --git a/config/install/migrate_plus.migration.example_migration_node.yml b/config/install/migrate_plus.migration.example_migration_node.yml index d1366d99..1de451d1 100644 --- a/config/install/migrate_plus.migration.example_migration_node.yml +++ b/config/install/migrate_plus.migration.example_migration_node.yml @@ -4,7 +4,7 @@ dependencies: module: - migrate_islandora_csv -id: example_migration_node +id: example_migration_node label: Import Nodes from CSV migration_group: migrate_islandora_csv @@ -15,9 +15,9 @@ source: # 1 means you have a header row, 0 means you don't header_row_count: 1 - # Each migration needs a unique key per row in the csv. Here we're using the file path. + # Each migration needs a unique key per row in the csv. Here we're using the ID, it was an arbitrary selection but one that is unique to each CSV row. keys: - - file + - ID # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. constants: diff --git a/data/migration.csv b/data/migration.csv index 0dcbdafb..13c283d3 100644 --- a/data/migration.csv +++ b/data/migration.csv @@ -1,4 +1,4 @@ -ID,file,title,subtitle,description,issued,subject,photographer,provider +ID,filename,title,subtitle,description,issued,subject,photographer,provider 1,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nails Nails Nails.jpg,Nails Nails Nails,,A sign pointing towards a nail salon.,2018-01-01,Neon signs|Night,Clem Onojeghuo,Clawde|Clawbster 2,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Free Smells.jpg,Free Smells,We're givin' 'em away,A sign on a restaurant front advertising free smells,2018-02-01,Neon signs|Night|Funny,The Collab,Clawde|Clawbster 3,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nothing to See Here.jpg,Nothing To See Here,Move Along People,A sign above a building that says "Nothing to see here",2018-03-01,Neon signs|Night,Argelis Rebolledo,Clawde|Clawbster From 27df439d245b0d59e3a5cbcc69cfd91d17d3e65f Mon Sep 17 00:00:00 2001 From: Don Richards Date: Thu, 6 Aug 2020 11:20:45 -0400 Subject: [PATCH 3/4] Adding 2 lines Create collections.csv Create migrate_plus.migration.collections_file.yml Create migrate_plus.migration.collections_media.yml Rename migrate_plus.migration.collections_file.yml to migrate_plus.migration.example_collections_file.yml Update and rename migrate_plus.migration.collections_media.yml to migrate_plus.migration.example_collections_media.yml Create migrate_plus.migration.example_collections_node.yml Create migrate_plus.migration.collections_subjects.yml Create collection_subjects.csv Update and rename migrate_plus.migration.collections_subjects.yml to migrate_plus.migration.example_collections_subjects.yml Update collections.csv Update migrate_plus.migration.example_collections_node.yml Update migrate_plus.migration.example_collections_file.yml Update migrate_plus.migration.example_collections_file.yml Update migrate_plus.migration.example_collections_node.yml Update migrate_plus.migration.example_collections_media.yml Update migrate_plus.migration.example_collections_file.yml Update migrate_plus.migration.example_collections_node.yml Includes requested features to show --- ...lus.migration.example_collections_file.yml | 56 +++++++++ ...us.migration.example_collections_media.yml | 71 +++++++++++ ...lus.migration.example_collections_node.yml | 117 ++++++++++++++++++ ...migration.example_collections_subjects.yml | 42 +++++++ ..._plus.migration.example_migration_file.yml | 10 +- ...plus.migration.example_migration_media.yml | 20 +-- ..._plus.migration.example_migration_node.yml | 16 +-- data/collection_subjects.csv | 58 +++++++++ data/example_collections.csv | 5 + data/migration.csv | 4 +- 10 files changed, 375 insertions(+), 24 deletions(-) create mode 100644 config/install/migrate_plus.migration.example_collections_file.yml create mode 100644 config/install/migrate_plus.migration.example_collections_media.yml create mode 100644 config/install/migrate_plus.migration.example_collections_node.yml create mode 100644 config/install/migrate_plus.migration.example_collections_subjects.yml create mode 100644 data/collection_subjects.csv create mode 100644 data/example_collections.csv diff --git a/config/install/migrate_plus.migration.example_collections_file.yml b/config/install/migrate_plus.migration.example_collections_file.yml new file mode 100644 index 00000000..847a3b10 --- /dev/null +++ b/config/install/migrate_plus.migration.example_collections_file.yml @@ -0,0 +1,56 @@ +# Uninstall this config when the feature is uninstalled +dependencies: + enforced: + module: + - migrate_islandora_csv + +id: example_collections_file +label: Step 2 - Import Example Collection Thumbnail image Files +migration_group: example_collections_migrate_islandora_csv + +source: + plugin: csv + path: modules/contrib/migrate_islandora_csv/data/example_collections.csv + delimiter: ',' + enclosure: '"' + header_row_count: 1 + + keys: + - ID + + constants: + destination_dir: 'fedora://csv_migration' + filemime: image/jpeg + uid: 1 + +process: + filemime: constants/mimetype + uid: constants/uid + + filename: + - + plugin: callback + callable: pathinfo + source: TN + - + plugin: extract + index: + - basename + + destination: + - + plugin: concat + delimiter: / + source: + - constants/destination_dir + - '@filename' + + uri: + plugin: file_copy + source: + - TN + - '@destination' + +destination: + plugin: 'entity:file' + type: file diff --git a/config/install/migrate_plus.migration.example_collections_media.yml b/config/install/migrate_plus.migration.example_collections_media.yml new file mode 100644 index 00000000..af8050ce --- /dev/null +++ b/config/install/migrate_plus.migration.example_collections_media.yml @@ -0,0 +1,71 @@ +# Uninstall this config when the feature is uninstalled +dependencies: + enforced: + module: + - migrate_islandora_csv + +id: example_collections_media +label: Step 4 - Generate Example Collection Media +migration_group: example_collections_migrate_islandora_csv + +source: + plugin: csv + path: modules/contrib/migrate_islandora_csv/data/example_collections.csv + delimiter: ',' + enclosure: '"' + +# 1 means you have a header row, 0 means you don't + header_row_count: 1 + + # Each migration needs a unique key per row in the csv. Here we're using the file path. + keys: + - ID + + # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. + constants: + # We're tagging our media as Thumbnail Image + use: Thumbnail Image + + # Everything gets created as admin + uid: 1 + +process: + + name: title + uid: constants/uid + + # Make the media an 'Original File' + field_media_use: + plugin: entity_lookup + source: constants/use + entity_type: taxonomy_term + value_key: name + bundle_key: vid + bundle: islandora_media_use + + # Lookup the migrated file in the file migration. + field_media_image: + alt: title + plugin: migration_lookup + source: ID + migration: example_collections_file + no_stub: true + + # Lookup the migrated node in the node migration + field_media_of: + plugin: migration_lookup + source: ID + migration: example_collections_node + no_stub: true + +destination: + # These are 'image' media we're making. + plugin: 'entity:media' + default_bundle: image + +migration_dependencies: + required: + - migrate_plus.migration.example_collections_file + - migrate_plus.migration.example_collections_subjects + - migrate_plus.migration.example_collections_node + optional: { } diff --git a/config/install/migrate_plus.migration.example_collections_node.yml b/config/install/migrate_plus.migration.example_collections_node.yml new file mode 100644 index 00000000..2df7c0d9 --- /dev/null +++ b/config/install/migrate_plus.migration.example_collections_node.yml @@ -0,0 +1,117 @@ +# Uninstall this config when the feature is uninstalled +dependencies: + enforced: + module: + - migrate_islandora_csv + +id: example_collections_node +label: Step 3 - Import Example Collection Nodes +migration_group: example_collections_migrate_islandora_csv + +source: + plugin: csv + path: modules/contrib/migrate_islandora_csv/data/example_collections.csv + delimiter: ',' + enclosure: '"' + + # 1 means you have a header row, 0 means you don't + header_row_count: 1 + + # Each migration needs a unique key per row in the csv. Here we're using the file path. + keys: + - ID + + # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. + constants: + # Everything gets created as admin + uid: 1 + +# Set fields using values from the CSV +process: + title: title + uid: constants/uid + + promote: promote + + field_description: + plugin: skip_on_empty + source: description + method: process + + field_model: + plugin: entity_lookup + source: model + entity_type: taxonomy_term + value_key: name + bundle_key: vid + bundle: islandora_models + + # Split up our pipe-delimited string of + # subjects, and generate terms for each. + field_subject: + - + plugin: skip_on_empty + source: subject + method: process + - + plugin: explode + delimiter: '|' + - + plugin: entity_generate + entity_type: taxonomy_term + value_key: name + bundle_key: vid + bundle: subject + + field_member_of: + - + plugin: skip_on_empty + source: parent_id + method: process + - + plugin: migration_lookup + source: parent_id + migration: example_collections_node + no_stub: true + + languages: + - + source: languages + plugin: skip_on_empty + method: process + - + plugin: explode + delimiter: '|' + - + plugin: str_to_assoc + key: 'name' + + languages_creator: + plugin: sub_process + source: '@languages' + process: + target_id: + plugin: entity_generate + source: name + entity_type: taxonomy_term + value_key: name + bundle_key: vid + bundle: 'language' + + field_language: '@languages' + + # This is to keep track of the old PIDs + field_pid: + plugin: skip_on_empty + source: PID + method: process + +# We're making nodes +destination: + plugin: 'entity:node' + default_bundle: islandora_object + +migration_dependencies: + required: + - migrate_plus.migration.example_collections_subjects + optional: { } diff --git a/config/install/migrate_plus.migration.example_collections_subjects.yml b/config/install/migrate_plus.migration.example_collections_subjects.yml new file mode 100644 index 00000000..3d3b5606 --- /dev/null +++ b/config/install/migrate_plus.migration.example_collections_subjects.yml @@ -0,0 +1,42 @@ +# Uninstall this config when the feature is uninstalled +dependencies: + enforced: + module: + - migrate_islandora_csv + +id: example_collections_subjects +label: Step 1 - Import Example Collection Subjects +migration_group: example_collections_migrate_islandora_csv + +source: + plugin: csv + path: modules/contrib/migrate_islandora_csv/data/collection_subjects.csv + delimiter: ',' + enclosure: '"' + + # 1 means you have a header row, 0 means you don't + header_row_count: 1 + + # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. + constants: + # Everything gets created as admin + uid: 1 + + keys: + - subject + +# Set fields using values from the CSV +process: + # uid: constants/uid + uid: + plugin: default_value + default_value: 1 + + name: subject + field_authority_link/title: subject + field_authority_link/source: subject_authority + field_authority_link/uri: subject_uri + +destination: + plugin: entity:taxonomy_term + default_bundle: subject diff --git a/config/install/migrate_plus.migration.example_migration_file.yml b/config/install/migrate_plus.migration.example_migration_file.yml index 22efa933..dbf62143 100644 --- a/config/install/migrate_plus.migration.example_migration_file.yml +++ b/config/install/migrate_plus.migration.example_migration_file.yml @@ -2,11 +2,11 @@ dependencies: enforced: module: - - migrate_islandora_csv + - migrate_islandora_csv id: example_migration_file label: Import Image Files -migration_group: migrate_islandora_csv +migration_group: example_migrate_islandora_csv source: plugin: csv @@ -14,7 +14,7 @@ source: delimiter: ',' # 1 means you have a header row, 0 means you don't - header_row_count: 1 + header_row_count: 1 # Each migration needs a unique key per row in the csv. Here we're using the ID, it was an arbitrary selection but one that is unique to each CSV row. keys: @@ -25,7 +25,7 @@ source: # Islandora uses flysystem and stream wrappers to work with files. What we're really saying here is # to put these files in Fedora in a 'csv_migration' folder. It doesn't matter if the directory # doesn't exist yet, it will get created for you automatically. - destination_dir: 'fedora://csv_migration' + destination_dir: 'fedora://csv_migration' # Hard-code mime type to jpeg. This could easily come from a column in the CSV if you have # different mimetypes. @@ -66,7 +66,7 @@ process: plugin: file_copy source: - filename # The source column in the CSV - - '@destination' # The destination entry from above + - '@destination' # The destination entry from above destination: diff --git a/config/install/migrate_plus.migration.example_migration_media.yml b/config/install/migrate_plus.migration.example_migration_media.yml index c175bc87..619c4cdd 100644 --- a/config/install/migrate_plus.migration.example_migration_media.yml +++ b/config/install/migrate_plus.migration.example_migration_media.yml @@ -2,11 +2,11 @@ dependencies: enforced: module: - - migrate_islandora_csv + - migrate_islandora_csv -id: example_migration_media -label: Import Media from CSV -migration_group: migrate_islandora_csv +id: example_migration_media +label: Import Media from CSV +migration_group: example_migrate_islandora_csv source: plugin: csv @@ -21,8 +21,8 @@ source: # You can't enter string literals into a process plugin, but you can give it a constant as a 'source'. constants: - # We're tagging our media as Original Files - use: Original File + # We're tagging our media as Original Files + use: Original File # Everything gets created as admin uid: 1 @@ -39,7 +39,7 @@ process: entity_type: taxonomy_term value_key: name bundle_key: vid - bundle: islandora_media_use + bundle: islandora_media_use # Lookup the migrated file in the file migration. field_media_image: @@ -52,13 +52,13 @@ process: field_media_of: plugin: migration_lookup source: ID - migration: example_migration_node + migration: example_migration_node no_stub: true - + destination: # These are 'image' media we're making. plugin: 'entity:media' - default_bundle: image + default_bundle: image migration_dependencies: required: diff --git a/config/install/migrate_plus.migration.example_migration_node.yml b/config/install/migrate_plus.migration.example_migration_node.yml index 1de451d1..af080a5a 100644 --- a/config/install/migrate_plus.migration.example_migration_node.yml +++ b/config/install/migrate_plus.migration.example_migration_node.yml @@ -5,8 +5,8 @@ dependencies: - migrate_islandora_csv id: example_migration_node -label: Import Nodes from CSV -migration_group: migrate_islandora_csv +label: Import Nodes from CSV +migration_group: example_migrate_islandora_csv source: plugin: csv @@ -37,7 +37,7 @@ process: # in. field_alternative_title: plugin: skip_on_empty - source: subtitle + source: subtitle method: process field_description: description @@ -50,16 +50,16 @@ process: plugin: entity_lookup source: constants/model entity_type: taxonomy_term - value_key: name + value_key: name bundle_key: vid - bundle: islandora_models + bundle: islandora_models # Split up our pipe-delimited string of # subjects, and generate terms for each. field_subject: - plugin: skip_on_empty - source: subject + source: subject method: process - plugin: explode @@ -151,9 +151,9 @@ process: # Write to the linked agent field. In this case # we first want to merge the info from the - # photographer and provider columns. Since we + # photographer and provider columns. Since we # already prepared our structured array using - # the components of the typed_relation field as + # the components of the typed_relation field as # keys ('target_id' and 'rel_type'), we can just # pass this array into field_linked_agent. field_linked_agent: diff --git a/data/collection_subjects.csv b/data/collection_subjects.csv new file mode 100644 index 00000000..8eaf876a --- /dev/null +++ b/data/collection_subjects.csv @@ -0,0 +1,58 @@ +subject,subject_authority,subject_uri +"Gardens, American",lcsh,http://id.loc.gov/authorities/subjects/sh85053123 +Photography of gardens,lcsh,http://id.loc.gov/authorities/subjects/sh85101348 +"Plants, Ornamental",lcsh,http://id.loc.gov/authorities/subjects/sh85103022 +Flowers--United States,lcsh,http://id.loc.gov/authorities/subjects/sh2008120720 +Water gardens,lcsh,http://id.loc.gov/authorities/subjects/sh85145559 +Garden walks,lcsh,http://id.loc.gov/authorities/subjects/sh85053084 +Nature photography,lcsh,http://id.loc.gov/authorities/subjects/sh85090290 +Trellises,lcsh,http://id.loc.gov/authorities/subjects/sh85137269 +Water lilies,lcsh,http://id.loc.gov/authorities/subjects/sh85145576 +Dogwoods,lcsh,http://id.loc.gov/authorities/subjects/sh85038828 +Flowering trees,lcsh,http://id.loc.gov/authorities/subjects/sh85049328 +Great Smoky Mountains (N.C. and Tenn.),lcsh,http://id.loc.gov/authorities/subjects/sh85057008 +Scenic overlooks,lcsh,http://id.loc.gov/authorities/subjects/sh2008009411 +Christmas decorations,lcsh,http://id.loc.gov/authorities/subjects/sh85025309 +Courtyards,lcsh,http://id.loc.gov/authorities/subjects/sh85033602 +Mountains--Tennessee,lcsh,http://id.loc.gov/authorities/subjects/sh85087947 +Rhododendrons,lcsh,http://id.loc.gov/authorities/subjects/sh85113765 +Trees in winter,lcsh,http://id.loc.gov/authorities/subjects/sh85137265 +Arbors,lcsh,http://id.loc.gov/authorities/subjects/sh96007468 +Azaleas,lcsh,http://id.loc.gov/authorities/subjects/sh85010626 +Common snowdrop,lcsh,http://id.loc.gov/authorities/subjects/sh88022799 +Daffodils,lcsh,http://id.loc.gov/authorities/subjects/sh85035383 +Dogs,lcsh,http://id.loc.gov/authorities/subjects/sh85038796 +Driveways,lcsh,http://id.loc.gov/authorities/subjects/sh85039611 +Gates,lcsh,http://id.loc.gov/authorities/subjects/sh85053505 +Irises (Plants),lcsh,http://id.loc.gov/authorities/subjects/sh85068079 +Patio gardening,lcsh,http://id.loc.gov/authorities/subjects/sh85098713 +Patios,lcsh,http://id.loc.gov/authorities/subjects/sh85098714 +Wisteria,lcsh,http://id.loc.gov/authorities/subjects/sh85147122 +Wreaths,lcsh,http://id.loc.gov/authorities/subjects/sh85148599 +Alluvial streams,lcsh,http://id.loc.gov/authorities/subjects/sh85003734 +Asters,lcsh,http://id.loc.gov/authorities/subjects/sh85008854 +Caesalpinia,lcsh,http://id.loc.gov/authorities/subjects/sh88022614 +Christmas trees,lcsh,http://id.loc.gov/authorities/subjects/sh85025322 +Chrysanthemums,lcsh,http://id.loc.gov/authorities/subjects/sh85025424 +Clematis,lcsh,http://id.loc.gov/authorities/subjects/sh85026933 +Daylilies,lcsh,http://id.loc.gov/authorities/subjects/sh85035974 +Dwarf lilyturf,lcsh,http://id.loc.gov/authorities/subjects/sh2002004598 +Eupatorium,lcsh,http://id.loc.gov/authorities/subjects/sh88022788 +Ferns,lcsh,http://id.loc.gov/authorities/subjects/sh85047836 +Fountains,lcsh,http://id.loc.gov/authorities/subjects/sh85051067 +Galax,lcsh,http://id.loc.gov/authorities/subjects/sh2006020025 +Hydrangeas,lcsh,http://id.loc.gov/authorities/subjects/sh85063290 +Lemon balm,lcsh,http://id.loc.gov/authorities/subjects/sh00004645 +Liriodendron tulipifera,lcsh,http://id.loc.gov/authorities/subjects/sh85077428 +Lotus,lcsh,http://id.loc.gov/authorities/subjects/sh85078460 +Millstones,lcsh,http://id.loc.gov/authorities/subjects/sh85085428 +Mockingbirds,lcsh,http://id.loc.gov/authorities/subjects/sh85086407 +Mountain laurel,lcsh,http://id.loc.gov/authorities/subjects/sh85087782 +Passiflora,lcsh,http://id.loc.gov/authorities/subjects/sh85098513 +Primroses,lcsh,http://id.loc.gov/authorities/subjects/sh85106708 +Redbud,lcsh,http://id.loc.gov/authorities/subjects/sh85112106 +Rhododendron maximum,lcsh,http://id.loc.gov/authorities/subjects/sh2005008326 +State birds,lcsh,http://id.loc.gov/authorities/subjects/sh85127482 +Tennessee River,lcsh,http://id.loc.gov/authorities/subjects/sh85133887 +Trilliums,lcsh,http://id.loc.gov/authorities/subjects/sh96008268 +Weeping willow,lcsh,http://id.loc.gov/authorities/subjects/sh96001392 diff --git a/data/example_collections.csv b/data/example_collections.csv new file mode 100644 index 00000000..fc17c17a --- /dev/null +++ b/data/example_collections.csv @@ -0,0 +1,5 @@ +ID,parent_id,uuid,title,description,PID,model,promote,languages,subjects,TN +1,,,Migration Collection,This is the migration collection parent that holds other collections. Image from the public archive from http://www.powerhousemuseum.com/collection/database/collection=The_Tyrrell_Photographic,islandora:migrate,Collection,1,,Photography of gardens|Patio gardening,https://live.staticflickr.com/2001/2362677373_00ba9fed52_m_d.jpg +2,1,,Garden Slides,All gardens should include slide but this collection just has slide images. Image from the public archive from http://www.powerhousemuseum.com/collection/database/collection=The_Tyrrell_Photographic,islandora:gardens,Collection,0,,Millstones,https://live.staticflickr.com/3235/2363514272_b617c99d92_m_d.jpg +3,1,,Fluffy Clouds,PDFs PDFs everywhere. Image from the public archive from www.powerhousemuseum.com/collection/database/collection=The_Tyrrell_Photographic,islandora:pdfs,Collection,0,,Topic not in Subject migration,https://live.staticflickr.com/3139/2363525934_90a404bc77_m_d.jpg +4,1,,Hairy Books,Hairy can mean anything. Image from the public archive from http://www.powerhousemuseum.com/collection/database/collection=The_Tyrrell_Photographic,islandora:books,Collection,0,,,https://live.staticflickr.com/2164/2362682155_ebf258806b_m_d.jpg diff --git a/data/migration.csv b/data/migration.csv index 13c283d3..c3704ea3 100644 --- a/data/migration.csv +++ b/data/migration.csv @@ -3,4 +3,6 @@ ID,filename,title,subtitle,description,issued,subject,photographer,provider 2,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Free Smells.jpg,Free Smells,We're givin' 'em away,A sign on a restaurant front advertising free smells,2018-02-01,Neon signs|Night|Funny,The Collab,Clawde|Clawbster 3,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nothing to See Here.jpg,Nothing To See Here,Move Along People,A sign above a building that says "Nothing to see here",2018-03-01,Neon signs|Night,Argelis Rebolledo,Clawde|Clawbster 4,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Call For Champagne.jpg,Call For Champagne,,A neon sign above some rotary telephones telling customers to call for champagne.,2018-04-01,Drinking|Neon signs,Design Doctor,Clawde|Clawbster -5,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/This Must Be The Place.jpg,This Must Be The Place,,A neon sign on a multi-colored wall that reads "This Must Be The Place",2018-05-01,Neon signs,Tim Mossholder,Clawde|Clawbster +5,,Empty Test object,test,This is a test csv row to verify the migration can skip files,,test,photo, +6,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/This Must Be The Place.jpg,This Must Be The Place,,A neon sign on a multi-colored wall that reads "This Must Be The Place, if you want to use a comma in a cell",2018-05-01,Neon signs,Tim Mossholder,Clawde|Clawbster +7,https://user-images.githubusercontent.com/2371345/67424058-caac1a00-f5ab-11e9-99a2-c9360370391f.png,Little Red Guy,Demo image,Migrating to Islandora 8 using CSVs image,,,photo, From 484edfc718716e9a9095fc9170da84fddf4fec09 Mon Sep 17 00:00:00 2001 From: Don Richards Date: Wed, 12 Aug 2020 14:05:59 -0400 Subject: [PATCH 4/4] lots added --- ...e_plus.migration.example_migration_file.yml | 18 +++++++++++------- ..._plus.migration.example_migration_media.yml | 17 ++++++++++------- ...e_plus.migration.example_migration_node.yml | 2 ++ data/migration.csv | 15 +++++++-------- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/config/install/migrate_plus.migration.example_migration_file.yml b/config/install/migrate_plus.migration.example_migration_file.yml index dbf62143..cac7d8a6 100644 --- a/config/install/migrate_plus.migration.example_migration_file.yml +++ b/config/install/migrate_plus.migration.example_migration_file.yml @@ -12,6 +12,7 @@ source: plugin: csv path: 'modules/contrib/migrate_islandora_csv/data/migration.csv' delimiter: ',' + enclosure: '"' # 1 means you have a header row, 0 means you don't header_row_count: 1 @@ -29,7 +30,7 @@ source: # Hard-code mime type to jpeg. This could easily come from a column in the CSV if you have # different mimetypes. - mimetype: image/jpeg + # mimetype: image/jpeg # Everything gets created as admin uid: 1 @@ -37,7 +38,7 @@ source: process: # Set these properties from constants. - filemime: constants/mimetype + filemime: mimetype uid: constants/uid # Hack the file name out of the full path provided in the 'file' column. @@ -53,11 +54,14 @@ process: # Construct the destination URI using the file name. destination: - plugin: concat - delimiter: / - source: - - constants/destination_dir - - '@filepath' + - + plugin: concat + delimiter: / + source: + - constants/destination_dir + - '@filepath' + - + plugin: urlencode ## # Here's where we copy the file over and set the uri of the file entity. diff --git a/config/install/migrate_plus.migration.example_migration_media.yml b/config/install/migrate_plus.migration.example_migration_media.yml index 619c4cdd..ee5e6a3c 100644 --- a/config/install/migrate_plus.migration.example_migration_media.yml +++ b/config/install/migrate_plus.migration.example_migration_media.yml @@ -11,6 +11,8 @@ migration_group: example_migrate_islandora_csv source: plugin: csv path: modules/contrib/migrate_islandora_csv/data/migration.csv + delimiter: ',' + enclosure: '"' # 1 means you have a header row, 0 means you don't header_row_count: 1 @@ -42,12 +44,14 @@ process: bundle: islandora_media_use # Lookup the migrated file in the file migration. - field_media_image: + field_media_image/target_id: plugin: migration_lookup source: ID migration: example_migration_file no_stub: true + field_media_image/alt: title + # Lookup the migrated node in the node migration field_media_of: plugin: migration_lookup @@ -59,9 +63,8 @@ destination: # These are 'image' media we're making. plugin: 'entity:media' default_bundle: image - -migration_dependencies: - required: - - migrate_plus.migration.example_migration_file - - migrate_plus.migration.example_migration_node - optional: { } + migration_dependencies: + required: + - migrate_plus.migration.example_migration_file + - migrate_plus.migration.example_migration_node + optional: { } diff --git a/config/install/migrate_plus.migration.example_migration_node.yml b/config/install/migrate_plus.migration.example_migration_node.yml index af080a5a..8d2da252 100644 --- a/config/install/migrate_plus.migration.example_migration_node.yml +++ b/config/install/migrate_plus.migration.example_migration_node.yml @@ -11,6 +11,8 @@ migration_group: example_migrate_islandora_csv source: plugin: csv path: modules/contrib/migrate_islandora_csv/data/migration.csv + delimiter: ',' + enclosure: '"' # 1 means you have a header row, 0 means you don't header_row_count: 1 diff --git a/data/migration.csv b/data/migration.csv index c3704ea3..8ef8f608 100644 --- a/data/migration.csv +++ b/data/migration.csv @@ -1,8 +1,7 @@ -ID,filename,title,subtitle,description,issued,subject,photographer,provider -1,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nails Nails Nails.jpg,Nails Nails Nails,,A sign pointing towards a nail salon.,2018-01-01,Neon signs|Night,Clem Onojeghuo,Clawde|Clawbster -2,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Free Smells.jpg,Free Smells,We're givin' 'em away,A sign on a restaurant front advertising free smells,2018-02-01,Neon signs|Night|Funny,The Collab,Clawde|Clawbster -3,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nothing to See Here.jpg,Nothing To See Here,Move Along People,A sign above a building that says "Nothing to see here",2018-03-01,Neon signs|Night,Argelis Rebolledo,Clawde|Clawbster -4,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Call For Champagne.jpg,Call For Champagne,,A neon sign above some rotary telephones telling customers to call for champagne.,2018-04-01,Drinking|Neon signs,Design Doctor,Clawde|Clawbster -5,,Empty Test object,test,This is a test csv row to verify the migration can skip files,,test,photo, -6,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/This Must Be The Place.jpg,This Must Be The Place,,A neon sign on a multi-colored wall that reads "This Must Be The Place, if you want to use a comma in a cell",2018-05-01,Neon signs,Tim Mossholder,Clawde|Clawbster -7,https://user-images.githubusercontent.com/2371345/67424058-caac1a00-f5ab-11e9-99a2-c9360370391f.png,Little Red Guy,Demo image,Migrating to Islandora 8 using CSVs image,,,photo, +ID,filename,mimetype,title,subtitle,description,issued,subject,photographer,provider +1,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nails Nails Nails.jpg,image/jpeg,Nails Nails Nails,,A sign pointing towards a nail salon.,2018-01-01,Neon signs|Night,Clem Onojeghuo,Clawde|Clawbster +2,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Free Smells.jpg,image/jpeg,Free Smells,We're givin' 'em away,A sign on a restaurant front advertising free smells,2018-02-01,Neon signs|Night|Funny,The Collab,Clawde|Clawbster +3,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Nothing to See Here.jpg,image/jpeg,Nothing To See Here,Move Along People,"A sign above a building that says ""Nothing to see here""",2018-03-01,Neon signs|Night,Argelis Rebolledo,Clawde|Clawbster +4,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/Call For Champagne.jpg,image/jpeg,Call For Champagne,,A neon sign above some rotary telephones telling customers to call for champagne.,2018-04-01,Drinking|Neon signs,Design Doctor,Clawde|Clawbster +5,https://user-images.githubusercontent.com/2371345/67424058-caac1a00-f5ab-11e9-99a2-c9360370391f.png,image/png,Empty Test object,test,This is a test csv row to verify the migration can skip files,2018-01-01,test|photo,The Collab,Tim Mossholder +6,/var/www/html/drupal/web/modules/contrib/migrate_islandora_csv/data/images/This Must Be The Place.jpg,image/jpeg,This Must Be The Place,,"A neon sign on a multi-colored wall that reads ""This Must Be The Place"", watch out for commas",2018-08-20,,Neon signs,Tim Mossholder