-
Notifications
You must be signed in to change notification settings - Fork 21
/
bulkrax.rb
88 lines (72 loc) · 4.6 KB
/
bulkrax.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# frozen_string_literal: true
Bulkrax.setup do |config|
# Add local parsers
# config.parsers += [
# { name: 'MODS - My Local MODS parser', class_name: 'Bulkrax::ModsXmlParser', partial: 'mods_fields' },
# ]
# WorkType to use as the default if none is specified in the import
# Default is the first returned by Hyrax.config.curation_concerns, stringified
# config.default_work_type = "MyWork"
# Factory Class to use when generating and saving objects
config.object_factory = Bulkrax::ObjectFactory
# Use this for a Postgres-backed Valkyrized Hyrax
# config.object_factory = Bulkrax::ValkyrieObjectFactory
# Path to store pending imports
# config.import_path = 'tmp/imports'
# Path to store exports before download
# config.export_path = 'tmp/exports'
# Server name for oai request header
# config.server_name = '[email protected]'
# NOTE: Creating Collections using the collection_field_mapping will no longer be supported as of Bulkrax version 3.0.
# Please configure Bulkrax to use related_parents_field_mapping and related_children_field_mapping instead.
# Field_mapping for establishing a collection relationship (FROM work TO collection)
# This value IS NOT used for OAI, so setting the OAI parser here will have no effect
# The mapping is supplied per Entry, provide the full class name as a string, eg. 'Bulkrax::CsvEntry'
# The default value for CSV is collection
# Add/replace parsers, for example:
# config.collection_field_mapping['Bulkrax::RdfEntry'] = 'http://opaquenamespace.org/ns/set'
# Field mappings
# Create a completely new set of mappings by replacing the whole set as follows
# config.field_mappings = {
# "Bulkrax::OaiDcParser" => { **individual field mappings go here*** }
# }
# Add to, or change existing mappings as follows
# e.g. to exclude date
# config.field_mappings["Bulkrax::OaiDcParser"]["date"] = { from: ["date"], excluded: true }
#
# e.g. to import parent-child relationships
# config.field_mappings['Bulkrax::CsvParser']['parents'] = { from: ['parents'], related_parents_field_mapping: true }
# config.field_mappings['Bulkrax::CsvParser']['children'] = { from: ['children'], related_children_field_mapping: true }
# (For more info on importing relationships, see Bulkrax Wiki: https://github.com/samvera-labs/bulkrax/wiki/Configuring-Bulkrax#parent-child-relationship-field-mappings)
#
# # e.g. to add the required source_identifier field
# # config.field_mappings["Bulkrax::CsvParser"]["source_id"] = { from: ["old_source_id"], source_identifier: true, search_field: 'source_id_sim' }
# If you want Bulkrax to fill in source_identifiers for you, see below
# To duplicate a set of mappings from one parser to another
# config.field_mappings["Bulkrax::OaiOmekaParser"] = {}
# config.field_mappings["Bulkrax::OaiDcParser"].each {|key,value| config.field_mappings["Bulkrax::OaiOmekaParser"][key] = value }
# Should Bulkrax make up source identifiers for you? This allow round tripping
# and download errored entries to still work, but does mean if you upload the
# same source record in two different files you WILL get duplicates.
# It is given two aruguments, self at the time of call and the index of the reocrd
# config.fill_in_blank_source_identifiers = ->(parser, index) { "b-#{parser.importer.id}-#{index}"}
# or use a uuid
# config.fill_in_blank_source_identifiers = ->(parser, index) { SecureRandom.uuid }
# Properties that should not be used in imports/exports. They are reserved for use by Hyrax.
# config.reserved_properties += ['my_field']
# List of Questioning Authority properties that are controlled via YAML files in
# the config/authorities/ directory. For example, the :rights_statement property
# is controlled by the active terms in config/authorities/rights_statements.yml
# Defaults: 'rights_statement' and 'license'
# config.qa_controlled_properties += ['my_field']
# Specify the delimiter regular expression for splitting an attribute's values into a multi-value array.
# config.multi_value_element_split_on = /\s*[:;|]\s*/.freeze
# Specify the delimiter for joining an attribute's multi-value array into a string. Note: the
# specific delimeter should likely be present in the multi_value_element_split_on expression.
# config.multi_value_element_join_on = ' | '
end
# Sidebar for hyrax 3+ support
# rubocop:disable Style/IfUnlessModifier
if Object.const_defined?(:Hyrax) && ::Hyrax::DashboardController&.respond_to?(:sidebar_partials)
Hyrax::DashboardController.sidebar_partials[:repository_content] << "hyrax/dashboard/sidebar/bulkrax_sidebar_additions"
end