Module: Kiba::Extend::Marc
- Extended by:
- Dry::Configurable
- Defined in:
- lib/kiba/extend/marc.rb
Overview
Configuration and shared methods for MARC data
Class Method Summary collapse
-
.field_tag_target ⇒ Symbol
Field in which the write the field tag value from which data was extracted when converting MARC data to Hash row.
-
.id_field_selector ⇒ Proc?
Code to perform any further selection from the Array of fields having the configured Marc.id_tag, after any given Marc.id_subfield and Marc.id_subfield_selector constraints have been met in the field selection.
-
.id_subfield ⇒ String
Subfield of :id_tag field from which to extract id.
-
.id_subfield_selector ⇒ Proc?
The Proc should take one argument, which is a String (usually derived by calling
MARC::Subfield.value
. -
.id_tag ⇒ String
The MARC field tag from which id value is extracted.
-
.id_target_field ⇒ Symbol
Field in which to write the MARC id value when converting MARC data to CSV row.
-
.id_value_formatter ⇒ Proc
The Proc should take one argument, which is an Array of Strings.
-
.linked_fields(record, tag) ⇒ Array<MARC::DataField>
880 fields linked to fields with given tag.
-
.meeting_data_tags ⇒ Array<String>
MARC field tags for fields that contain the structured meeting name data pattern documented at https://www.loc.gov/marc/bibliographic/bdx11.html.
-
.meeting_name_part_subfields ⇒ Array<String>
Subfields to be extracted as part of name values from Marc.meeting_data_tags.
-
.meeting_role_code_subfields ⇒ Array<String>
Subfields to be extracted as meeting role codes from Marc.meeting_data_tags.
-
.meeting_role_term_subfields ⇒ Array<String>
Subfields to be extracted as meeting role terms from Marc.meeting_data_tags.
-
.name_target ⇒ Symbol
Field in which to write the name value when converting MARC data to CSV row when extracting names.
-
.name_type_target ⇒ Symbol
Field in which to write the name type value when converting MARC data to CSV row when extracting names.
-
.org_data_tags ⇒ Array<String>
MARC field tags for fields that contain the structured org name data pattern documented at https://www.loc.gov/marc/bibliographic/bdx10.html.
-
.org_name_part_subfields ⇒ Array<String>
Subfields to be extracted as part of name values from Marc.org_data_tags.
-
.org_role_code_subfields ⇒ Array<String>
Subfields to be extracted as org role codes from Marc.org_data_tags.
-
.org_role_term_subfields ⇒ Array<String>
Subfields to be extracted as org role terms from Marc.org_data_tags.
-
.person_data_tags ⇒ Array<String>
MARC field tags for fields that contain the structured person name data pattern documented at https://www.loc.gov/marc/bibliographic/bdx00.html.
-
.person_name_part_subfields ⇒ Array<String>
Subfields to be extracted as part of name values from Marc.person_data_tags.
-
.person_role_code_subfields ⇒ Array<String>
Subfields to be extracted as person role codes from Marc.person_data_tags.
-
.person_role_term_subfields ⇒ Array<String>
Subfields to be extracted as person role terms from Marc.person_data_tags.
-
.prefer_vernacular ⇒ Boolean
If true, returns linked 880 field values instead of main field (transliterated values).
-
.role_code_target ⇒ Symbol
Field in which to write the role code value when converting MARC data to CSV row for name extraction.
-
.role_term_target ⇒ Symbol
Field in which to write the role term value when converting MARC data to CSV row for name extraction.
-
.title_part_subfields ⇒ Array<String>
Subfields to be extracted as part of title from 245 fields.
Class Method Details
.field_tag_target ⇒ Symbol
Returns field in which the write the field tag value from which data was extracted when converting MARC data to Hash row.
14 |
# File 'lib/kiba/extend/marc.rb', line 14 setting :field_tag_target, default: :sourcefield, reader: true |
.id_field_selector ⇒ Proc?
Returns Code to perform any further selection from the Array of fields having the configured id_tag, after any given id_subfield and id_subfield_selector constraints have been met in the field selection.
The Proc should take one argument, which is an Array of MARC::ControlField or MARC::DataField objects.
The Proc should return an Array of MARC::ControlField or MARC::DataField objects.
27 28 29 |
# File 'lib/kiba/extend/marc.rb', line 27 setting :id_field_selector, default: ->(fields) { [fields.first] }, reader: true |
.id_subfield ⇒ String
Returns subfield of :id_tag field from which to extract id.
32 |
# File 'lib/kiba/extend/marc.rb', line 32 setting :id_subfield, default: nil, reader: true |
.id_subfield_selector ⇒ Proc?
The Proc should take one argument, which is a String (usually derived by
calling MARC::Subfield.value
.
The Proc should return TrueClass
or FalseClass
41 |
# File 'lib/kiba/extend/marc.rb', line 41 setting :id_subfield_selector, default: nil, reader: true |
.id_tag ⇒ String
Returns the MARC field tag from which id value is extracted.
16 |
# File 'lib/kiba/extend/marc.rb', line 16 setting :id_tag, default: "001", reader: true |
.id_target_field ⇒ Symbol
Returns field in which to write the MARC id value when converting MARC data to CSV row.
53 |
# File 'lib/kiba/extend/marc.rb', line 53 setting :id_target_field, default: :marcid, reader: true |
.id_value_formatter ⇒ Proc
The Proc should take one argument, which is an Array of Strings.
The Proc should return a String.
48 49 50 |
# File 'lib/kiba/extend/marc.rb', line 48 setting :id_value_formatter, default: ->(values) { values.first }, reader: true |
.linked_fields(record, tag) ⇒ Array<MARC::DataField>
Returns 880 fields linked to fields with given tag.
143 144 145 146 147 |
# File 'lib/kiba/extend/marc.rb', line 143 def linked_fields(record, tag) record.find_all do |field| field.tag == "880" && field["6"].start_with?(tag) end end |
.meeting_data_tags ⇒ Array<String>
Returns MARC field tags for fields that contain the structured meeting name data pattern documented at https://www.loc.gov/marc/bibliographic/bdx11.html.
57 58 59 |
# File 'lib/kiba/extend/marc.rb', line 57 setting :meeting_data_tags, default: %w[111 611 711 811], reader: true |
.meeting_name_part_subfields ⇒ Array<String>
Returns subfields to be extracted as part of name values from meeting_data_tags.
62 63 64 |
# File 'lib/kiba/extend/marc.rb', line 62 setting :meeting_name_part_subfields, default: %w[a q b c e d g n u], reader: true |
.meeting_role_code_subfields ⇒ Array<String>
Returns subfields to be extracted as meeting role codes from meeting_data_tags.
67 68 69 |
# File 'lib/kiba/extend/marc.rb', line 67 setting :meeting_role_code_subfields, default: %w[4], reader: true |
.meeting_role_term_subfields ⇒ Array<String>
Returns subfields to be extracted as meeting role terms from meeting_data_tags.
72 73 74 |
# File 'lib/kiba/extend/marc.rb', line 72 setting :meeting_role_term_subfields, default: %w[j], reader: true |
.name_target ⇒ Symbol
Returns field in which to write the name value when converting MARC data to CSV row when extracting names.
77 |
# File 'lib/kiba/extend/marc.rb', line 77 setting :name_target, default: :name, reader: true |
.name_type_target ⇒ Symbol
Returns field in which to write the name type value when converting MARC data to CSV row when extracting names.
80 |
# File 'lib/kiba/extend/marc.rb', line 80 setting :name_type_target, default: :nametype, reader: true |
.org_data_tags ⇒ Array<String>
Returns MARC field tags for fields that contain the structured org name data pattern documented at https://www.loc.gov/marc/bibliographic/bdx10.html.
84 85 86 |
# File 'lib/kiba/extend/marc.rb', line 84 setting :org_data_tags, default: %w[110 610 710 810], reader: true |
.org_name_part_subfields ⇒ Array<String>
Returns subfields to be extracted as part of name values from org_data_tags.
89 90 91 |
# File 'lib/kiba/extend/marc.rb', line 89 setting :org_name_part_subfields, default: %w[a b c d g n u], reader: true |
.org_role_code_subfields ⇒ Array<String>
Returns subfields to be extracted as org role codes from org_data_tags.
94 95 96 |
# File 'lib/kiba/extend/marc.rb', line 94 setting :org_role_code_subfields, default: %w[4], reader: true |
.org_role_term_subfields ⇒ Array<String>
Returns subfields to be extracted as org role terms from org_data_tags.
99 100 101 |
# File 'lib/kiba/extend/marc.rb', line 99 setting :org_role_term_subfields, default: %w[e], reader: true |
.person_data_tags ⇒ Array<String>
Returns MARC field tags for fields that contain the structured person name data pattern documented at https://www.loc.gov/marc/bibliographic/bdx00.html.
105 106 107 |
# File 'lib/kiba/extend/marc.rb', line 105 setting :person_data_tags, default: %w[100 600 700 800], reader: true |
.person_name_part_subfields ⇒ Array<String>
Returns subfields to be extracted as part of name values from person_data_tags.
110 111 112 |
# File 'lib/kiba/extend/marc.rb', line 110 setting :person_name_part_subfields, default: %w[a b c d j q u], reader: true |
.person_role_code_subfields ⇒ Array<String>
Returns subfields to be extracted as person role codes from person_data_tags.
115 116 117 |
# File 'lib/kiba/extend/marc.rb', line 115 setting :person_role_code_subfields, default: %w[4], reader: true |
.person_role_term_subfields ⇒ Array<String>
Returns subfields to be extracted as person role terms from person_data_tags.
120 121 122 |
# File 'lib/kiba/extend/marc.rb', line 120 setting :person_role_term_subfields, default: %w[e], reader: true |
.prefer_vernacular ⇒ Boolean
Returns If true, returns linked 880 field values instead of main field (transliterated values). If false, returns main field value, followed by 880 field value.
126 |
# File 'lib/kiba/extend/marc.rb', line 126 setting :prefer_vernacular, default: true, reader: true |
.role_code_target ⇒ Symbol
Returns field in which to write the role code value when converting MARC data to CSV row for name extraction.
129 |
# File 'lib/kiba/extend/marc.rb', line 129 setting :role_code_target, default: :role_code, reader: true |
.role_term_target ⇒ Symbol
Returns field in which to write the role term value when converting MARC data to CSV row for name extraction.
132 |
# File 'lib/kiba/extend/marc.rb', line 132 setting :role_term_target, default: :role_term, reader: true |
.title_part_subfields ⇒ Array<String>
Returns subfields to be extracted as part of title from 245 fields.
135 136 137 |
# File 'lib/kiba/extend/marc.rb', line 135 setting :title_part_subfields, default: %w[a b f g k n p s], reader: true |