loc_mods 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +46 -1
  3. data/exe/loc-mods +6 -0
  4. data/lib/loc_mods/abstract.rb +2 -2
  5. data/lib/loc_mods/access_condition.rb +2 -2
  6. data/lib/loc_mods/alternative_name.rb +2 -2
  7. data/lib/loc_mods/area.rb +2 -2
  8. data/lib/loc_mods/base_mapper.rb +9 -0
  9. data/lib/loc_mods/cartographic_extension.rb +2 -2
  10. data/lib/loc_mods/cartographics.rb +2 -2
  11. data/lib/loc_mods/city_section.rb +2 -2
  12. data/lib/loc_mods/classification.rb +2 -2
  13. data/lib/loc_mods/cli.rb +101 -0
  14. data/lib/loc_mods/collection.rb +2 -2
  15. data/lib/loc_mods/comparable_mapper.rb +96 -0
  16. data/lib/loc_mods/copy_information.rb +2 -2
  17. data/lib/loc_mods/date.rb +2 -2
  18. data/lib/loc_mods/date_other.rb +2 -2
  19. data/lib/loc_mods/detail.rb +2 -2
  20. data/lib/loc_mods/edition.rb +2 -2
  21. data/lib/loc_mods/enumeration_and_chronology.rb +2 -2
  22. data/lib/loc_mods/extent.rb +2 -2
  23. data/lib/loc_mods/extent_definition.rb +2 -2
  24. data/lib/loc_mods/form.rb +2 -2
  25. data/lib/loc_mods/genre.rb +2 -2
  26. data/lib/loc_mods/geographic_code.rb +2 -2
  27. data/lib/loc_mods/hierarchical_geographic.rb +2 -2
  28. data/lib/loc_mods/hierarchical_part.rb +2 -2
  29. data/lib/loc_mods/holding_simple.rb +2 -2
  30. data/lib/loc_mods/identifier.rb +2 -2
  31. data/lib/loc_mods/item_identifier.rb +2 -2
  32. data/lib/loc_mods/language.rb +2 -2
  33. data/lib/loc_mods/language_term.rb +2 -2
  34. data/lib/loc_mods/location.rb +2 -2
  35. data/lib/loc_mods/name.rb +2 -2
  36. data/lib/loc_mods/name_part.rb +2 -2
  37. data/lib/loc_mods/non_sort.rb +2 -2
  38. data/lib/loc_mods/note.rb +2 -2
  39. data/lib/loc_mods/occupation.rb +2 -2
  40. data/lib/loc_mods/origin_info.rb +2 -2
  41. data/lib/loc_mods/part.rb +2 -2
  42. data/lib/loc_mods/physical_description.rb +2 -2
  43. data/lib/loc_mods/physical_description_note.rb +2 -2
  44. data/lib/loc_mods/physical_location.rb +2 -2
  45. data/lib/loc_mods/place.rb +2 -2
  46. data/lib/loc_mods/place_term.rb +2 -2
  47. data/lib/loc_mods/publisher.rb +2 -2
  48. data/lib/loc_mods/record.rb +2 -2
  49. data/lib/loc_mods/record_content_source.rb +2 -2
  50. data/lib/loc_mods/record_identifier.rb +2 -2
  51. data/lib/loc_mods/record_info.rb +2 -2
  52. data/lib/loc_mods/record_info_note.rb +2 -2
  53. data/lib/loc_mods/region.rb +2 -2
  54. data/lib/loc_mods/related_item.rb +2 -2
  55. data/lib/loc_mods/role.rb +2 -2
  56. data/lib/loc_mods/role_term.rb +2 -2
  57. data/lib/loc_mods/script_term.rb +2 -2
  58. data/lib/loc_mods/string_plus_language.rb +2 -2
  59. data/lib/loc_mods/string_plus_language_plus_authority.rb +2 -2
  60. data/lib/loc_mods/string_plus_language_plus_supplied.rb +2 -2
  61. data/lib/loc_mods/subject.rb +2 -2
  62. data/lib/loc_mods/subject_name.rb +2 -2
  63. data/lib/loc_mods/subject_title_info.rb +2 -2
  64. data/lib/loc_mods/table_of_contents.rb +2 -2
  65. data/lib/loc_mods/target_audience.rb +2 -2
  66. data/lib/loc_mods/temporal.rb +2 -2
  67. data/lib/loc_mods/text.rb +2 -2
  68. data/lib/loc_mods/title_info.rb +2 -2
  69. data/lib/loc_mods/type_of_resource.rb +2 -2
  70. data/lib/loc_mods/url.rb +2 -2
  71. data/lib/loc_mods/version.rb +1 -1
  72. metadata +22 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b15a4efe6f5c0bf6287f01e8f3b9d14bf4611f0ec80c50a94eaf01aea0d27b0
4
- data.tar.gz: 7c1c47497f88abc231351b6a19703641e8b7f910a8c119222872208dc339fe97
3
+ metadata.gz: 66939abfdba314e93de07afbe306be58394fb4466de3d9203318e400b2a0f017
4
+ data.tar.gz: 5e9ffbdd0c405ac026e77138c5287c34d21cf93c84a7d98e94e5d6e987b015a0
5
5
  SHA512:
6
- metadata.gz: bb267c94c7de7b895ccf168ca9b0a37133afce833981a332e43f3f82822aeec27ada4b4becedb1b7196ebcaab97bd5c90c68ee8fd23ab463b82500b0a72f7b7a
7
- data.tar.gz: 49f9d610121df295c904cede6245d4dd907bbba9c919879ccf8e44211b095bd23700452b4d4d6a670f2e5e579a6fc3e06ad70d1fa450f1c9de35ff1f01ff6144
6
+ metadata.gz: 9e0cec87a093a33c3785376aaba4cbe7b05b3ee8e916c1fa238faa659668e01468b56ec08afc9478123a01adb0076e497e1f09a8dcdc4f330965aa6f82fddcc2
7
+ data.tar.gz: f5ed1dc6d38e5c6afec2edd7872963433e1cc699502686acd6045198b4b37fec1d27720f7777c2f08a1a5f2234c15d98ccf2beefe2babfca3cf897007b7ee6c5
data/README.adoc CHANGED
@@ -12,6 +12,8 @@ This gem is developed using the MODS 3.7 XSD schema.
12
12
 
13
13
  == Usage
14
14
 
15
+ === Ruby API
16
+
15
17
  [source,ruby]
16
18
  ----
17
19
  require 'loc_mods'
@@ -24,12 +26,55 @@ LocMods::Collection.from_xml(File.read("spec/fixtures/record_1.xml"))
24
26
  LocMods::Collection.from_xml(File.read("reference/allrecords-MODS.xml"))
25
27
  ----
26
28
 
29
+ === Command line interface
30
+
31
+ LocMods provides a command-line interface (CLI) for various operations. The main
32
+ executable is `loc-mods`.
33
+
34
+ ==== Detect duplicates
35
+
36
+ The `detect-duplicates` command allows you to find duplicate MODS records based
37
+ on using a "primary ID" that is their DOI (Digital Object Identifier).
38
+
39
+ Usage:
40
+
41
+ [source,shell]
42
+ ----
43
+ $ loc-mods detect-duplicates [OPTIONS] <file_or_directory_path>
44
+ ----
45
+
46
+ Options:
47
+
48
+ * `-r, --recursive`: Search for MODS files recursively in subdirectories.
49
+ * `-v, --verbose`: Display more detailed output.
50
+ * `-o, --output FILE`: Write the results to a file instead of stdout.
51
+
52
+ Example:
53
+
54
+ [source,shell]
55
+ ----
56
+ $ loc-mods detect-duplicates -r -v /path/to/mods/files
57
+ ----
58
+
59
+ This command will:
60
+
61
+ . Search for MODS XML files in the specified directory (and subdirectories if `-r` is used).
62
+ . Parse each MODS file and extract the DOI.
63
+ . Group records with the same DOI.
64
+ . For each group of duplicates:
65
+ .. Display the shared DOI.
66
+ .. List the filenames of the duplicate records.
67
+ .. Show a detailed comparison of the differences between the records.
68
+
69
+ The output will highlight differences, removed elements, and missing elements
70
+ between the duplicate records, helping you identify discrepancies in the
71
+ metadata.
72
+
27
73
  == Testing
28
74
 
29
75
  [source,sh]
30
76
  ----
31
77
  bin/update-nist-mods
32
-
33
78
  ----
34
79
 
35
80
  == License
data/exe/loc-mods ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require_relative "../lib/loc_mods/cli"
5
+
6
+ LocMods::Cli.start(ARGV)
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Abstract < Shale::Mapper
6
+ class Abstract < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :display_label, Shale::Type::String
9
9
  attribute :type, Shale::Type::String
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class AccessCondition < Shale::Mapper
6
+ class AccessCondition < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :display_label, Shale::Type::String
9
9
  attribute :lang, Shale::Type::String
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "identifier"
6
6
  require_relative "name_part"
7
7
  require_relative "role"
8
8
 
9
9
  module LocMods
10
- class AlternativeName < Shale::Mapper
10
+ class AlternativeName < BaseMapper
11
11
  attribute :lang, Shale::Type::String
12
12
  attribute :script, Shale::Type::String
13
13
  attribute :transliteration, Shale::Type::String
data/lib/loc_mods/area.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "hierarchical_part"
6
6
 
7
7
  module LocMods
8
- class Area < Shale::Mapper
8
+ class Area < BaseMapper
9
9
  attribute :content, HierarchicalPart
10
10
  attribute :area_type, Shale::Type::Value
11
11
 
@@ -0,0 +1,9 @@
1
+ # lib/loc_mods/base_mapper.rb
2
+ require "shale"
3
+ require_relative "comparable_mapper"
4
+
5
+ module LocMods
6
+ class BaseMapper < Shale::Mapper
7
+ include ComparableMapper
8
+ end
9
+ end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class CartographicExtension < Shale::Mapper
6
+ class CartographicExtension < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :display_label, Shale::Type::String
9
9
 
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "cartographic_extension"
6
6
 
7
7
  module LocMods
8
- class Cartographics < Shale::Mapper
8
+ class Cartographics < BaseMapper
9
9
  attribute :authority, Shale::Type::String
10
10
  attribute :authority_uri, Shale::Type::Value
11
11
  attribute :value_uri, Shale::Type::Value
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "hierarchical_part"
6
6
 
7
7
  module LocMods
8
- class CitySection < Shale::Mapper
8
+ class CitySection < BaseMapper
9
9
  attribute :content, HierarchicalPart
10
10
  attribute :city_section_type, Shale::Type::Value
11
11
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Classification < Shale::Mapper
6
+ class Classification < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :edition, Shale::Type::String
9
9
  attribute :display_label, Shale::Type::String
@@ -0,0 +1,101 @@
1
+ # lib/loc_mods/cli.rb
2
+ require "thor"
3
+ require "loc_mods"
4
+
5
+ module LocMods
6
+ class Cli < Thor
7
+ desc "detect-duplicates PATH...", "Detect duplicate records in MODS XML files or directories"
8
+
9
+ def detect_duplicates(*paths)
10
+ all_records = []
11
+ paths.each do |path|
12
+ if File.directory?(path)
13
+ Dir.glob(File.join(path, "*.xml")).each do |file|
14
+ process_file(file, all_records)
15
+ end
16
+ elsif File.file?(path) && path.end_with?(".xml")
17
+ process_file(path, all_records)
18
+ else
19
+ puts "Warning: Skipping invalid path: #{path}"
20
+ end
21
+ end
22
+
23
+ records_by_url = {}
24
+ all_records.each do |record|
25
+ urls = record[:record].location.flat_map { |loc| loc.url.map(&:content) }.compact
26
+ if urls.any?
27
+ urls.each do |url|
28
+ records_by_url[url] ||= []
29
+ records_by_url[url] << record
30
+ end
31
+ else
32
+ puts "Warning: Record without URL found in file: #{record[:file]}"
33
+ end
34
+ end
35
+
36
+ duplicate_count = 0
37
+ records_by_url.each do |url, records|
38
+ if records.size > 1
39
+ duplicate_count += 1
40
+ puts "Duplicate set ##{duplicate_count} found for URL: #{url}"
41
+ records.combination(2).each_with_index do |(record1, record2), index|
42
+ puts " Comparison #{index + 1}:"
43
+ puts " File 1: #{record1[:file]}"
44
+ puts " File 2: #{record2[:file]}"
45
+ differences = record1[:record].compare(record2[:record])
46
+ if differences
47
+ puts " ----"
48
+ print_differences(differences)
49
+ puts " ----"
50
+ end
51
+ puts "\n"
52
+ end
53
+ end
54
+ end
55
+ end
56
+
57
+ private
58
+
59
+ def process_file(file, all_records)
60
+ xml_content = File.read(file)
61
+ collection = LocMods::Collection.from_xml(xml_content)
62
+ collection.mods.each do |record|
63
+ all_records << { record: record, file: file }
64
+ end
65
+ end
66
+
67
+ def print_differences(differences, prefix = "", path = [])
68
+ differences.each do |key, value|
69
+ current_path = path + [key]
70
+ if value.is_a?(Hash) && value.keys.all? { |k| k.is_a?(Integer) }
71
+ value.each do |index, sub_value|
72
+ print_differences(sub_value, prefix, current_path + [index])
73
+ end
74
+ elsif value.is_a?(Hash) && (value[:self] || value[:other])
75
+ puts " #{format_path(current_path)}:"
76
+ puts " #{prefix} Record 1: #{format_value(value[:self])}"
77
+ puts " #{prefix} Record 2: #{format_value(value[:other])}"
78
+ puts
79
+ elsif value.is_a?(Hash)
80
+ print_differences(value, prefix, current_path)
81
+ end
82
+ end
83
+ end
84
+
85
+ def format_path(path)
86
+ path.map.with_index do |part, index|
87
+ if index == 0
88
+ part.to_s
89
+ elsif part.is_a?(Integer)
90
+ "[#{part}]"
91
+ else
92
+ ".#{part}"
93
+ end
94
+ end.join
95
+ end
96
+
97
+ def format_value(value)
98
+ value.nil? ? "(nil)" : "\"#{value}\""
99
+ end
100
+ end
101
+ end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "record"
6
6
 
7
7
  module LocMods
8
- class Collection < Shale::Mapper
8
+ class Collection < BaseMapper
9
9
  attribute :mods, Record, collection: true
10
10
  attribute :schema_location, Shale::Type::String
11
11
 
@@ -0,0 +1,96 @@
1
+ # lib/loc_mods/comparable_mapper.rb
2
+
3
+ module LocMods
4
+ module ComparableMapper
5
+ # def self.included(base)
6
+ # base.extend(ClassMethods)
7
+ # end
8
+
9
+ # module ClassMethods
10
+ # def attribute_mapping
11
+ # @attribute_mapping ||= attributes.to_h do |name, attribute|
12
+ # [name, attribute.type]
13
+ # end
14
+ # end
15
+ # end
16
+
17
+ def compare(other)
18
+ return {} unless other.is_a?(self.class)
19
+
20
+ differences = {}
21
+
22
+ # puts "Debugging: Attributes for #{self.class.name}"
23
+ # pp self.class.attributes.keys
24
+
25
+ self.class.attributes.each_key do |attr|
26
+ self_value = self.send(attr)
27
+ other_value = other.send(attr)
28
+
29
+ # puts "Debugging: Comparing attribute '#{attr}'"
30
+ # puts " Self value: #{self_value.inspect}"
31
+ # puts " Other value: #{other_value.inspect}"
32
+
33
+ compared = compare_values(self_value, other_value)
34
+ if compared
35
+ # puts "DETECTED DIFFERENCE! #{compared.inspect}"
36
+ differences[attr] = compared
37
+ end
38
+ end
39
+
40
+ # unless differences.empty?
41
+ # puts "DIFFERENCES ARE"
42
+ # pp differences
43
+ # end
44
+
45
+ differences.empty? ? nil : differences
46
+ end
47
+
48
+ private
49
+
50
+ def compare_values(self_value, other_value)
51
+ # puts "compare_values (self_value: #{self_value}, other_value: #{other_value})"
52
+ case self_value
53
+ when Array
54
+ # puts "compare_values case 1"
55
+ compare_arrays(self_value, other_value)
56
+ when Shale::Mapper
57
+ # puts "compare_values case 2"
58
+ self_value.compare(other_value)
59
+ else
60
+ if self_value != other_value
61
+ # puts "compare_values case 3"
62
+ { self: self_value, other: other_value }
63
+ end
64
+ end
65
+ end
66
+
67
+ def compare_arrays(self_array, other_array)
68
+ differences = {}
69
+ max_length = [self_array.size, other_array.size].max
70
+
71
+ max_length.times do |index|
72
+ self_item = self_array[index]
73
+ other_item = other_array[index]
74
+
75
+ if index >= self_array.size
76
+ compared = compare_values(other_item, nil)
77
+ differences[index] = { self: compared[:other], other: compared[:self] }
78
+ elsif index >= other_array.size
79
+ differences[index] = compare_values(self_item, nil)
80
+ else
81
+ compared = compare_values(self_item, other_item)
82
+ differences[index] = compared if compared
83
+ end
84
+ end
85
+
86
+ if self_array.size != other_array.size
87
+ differences[:array_size_difference] = {
88
+ self: self_array.size,
89
+ other: other_array.size,
90
+ }
91
+ end
92
+
93
+ differences.empty? ? nil : differences
94
+ end
95
+ end
96
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "enumeration_and_chronology"
6
6
  require_relative "form"
@@ -8,7 +8,7 @@ require_relative "item_identifier"
8
8
  require_relative "note"
9
9
 
10
10
  module LocMods
11
- class CopyInformation < Shale::Mapper
11
+ class CopyInformation < BaseMapper
12
12
  attribute :form, Form
13
13
  attribute :sub_location, Shale::Type::String, collection: true
14
14
  attribute :shelf_locator, Shale::Type::String, collection: true
data/lib/loc_mods/date.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Date < Shale::Mapper
6
+ class Date < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :encoding, Shale::Type::String
9
9
  attribute :qualifier, Shale::Type::String
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "date"
6
6
 
7
7
  module LocMods
8
- class DateOther < Shale::Mapper
8
+ class DateOther < BaseMapper
9
9
  attribute :content, Shale::Type::String
10
10
  attribute :type, Shale::Type::String
11
11
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Detail < Shale::Mapper
6
+ class Detail < BaseMapper
7
7
  attribute :type, Shale::Type::String
8
8
  attribute :level, Shale::Type::Integer
9
9
  attribute :number, Shale::Type::String, collection: true
@@ -1,10 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
6
  # LocMods::StringPlusLanguagePlusSupplied
7
- class Edition < Shale::Mapper
7
+ class Edition < BaseMapper
8
8
  attribute :content, Shale::Type::String
9
9
  attribute :supplied, Shale::Type::String
10
10
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class EnumerationAndChronology < Shale::Mapper
6
+ class EnumerationAndChronology < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :unit_type, Shale::Type::String
9
9
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Extent < Shale::Mapper
6
+ class Extent < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :unit, Shale::Type::Value
9
9
 
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class ExtentDefinition < Shale::Mapper
6
+ class ExtentDefinition < BaseMapper
7
7
  attribute :unit, Shale::Type::String
8
8
  attribute :start, Shale::Type::String
9
9
  attribute :end, Shale::Type::String
data/lib/loc_mods/form.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Form < Shale::Mapper
6
+ class Form < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :type, Shale::Type::String
9
9
  attribute :authority, Shale::Type::String
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Genre < Shale::Mapper
6
+ class Genre < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :type, Shale::Type::String
9
9
  attribute :display_label, Shale::Type::String
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class GeographicCode < Shale::Mapper
6
+ class GeographicCode < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :authority_uri, Shale::Type::Value
9
9
  attribute :value_uri, Shale::Type::Value
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "area"
6
6
  require_relative "city_section"
@@ -8,7 +8,7 @@ require_relative "hierarchical_part"
8
8
  require_relative "region"
9
9
 
10
10
  module LocMods
11
- class HierarchicalGeographic < Shale::Mapper
11
+ class HierarchicalGeographic < BaseMapper
12
12
  attribute :authority, Shale::Type::String
13
13
  attribute :authority_uri, Shale::Type::Value
14
14
  attribute :value_uri, Shale::Type::Value
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class HierarchicalPart < Shale::Mapper
6
+ class HierarchicalPart < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :level, Shale::Type::Value
9
9
  attribute :period, Shale::Type::Value
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "copy_information"
6
6
 
7
7
  module LocMods
8
- class HoldingSimple < Shale::Mapper
8
+ class HoldingSimple < BaseMapper
9
9
  attribute :copy_information, CopyInformation, collection: true
10
10
 
11
11
  xml do
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class Identifier < Shale::Mapper
6
+ class Identifier < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :display_label, Shale::Type::String
9
9
  attribute :type, Shale::Type::String
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  module LocMods
6
- class ItemIdentifier < Shale::Mapper
6
+ class ItemIdentifier < BaseMapper
7
7
  attribute :content, Shale::Type::String
8
8
  attribute :type, Shale::Type::String
9
9
 
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "shale"
3
+ require_relative "base_mapper"
4
4
 
5
5
  require_relative "language_term"
6
6
  require_relative "script_term"
7
7
 
8
8
  module LocMods
9
- class Language < Shale::Mapper
9
+ class Language < BaseMapper
10
10
  attribute :object_part, Shale::Type::String
11
11
  attribute :lang, Shale::Type::String
12
12
  attribute :script, Shale::Type::String