loc_mods 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +46 -1
  3. data/exe/loc-mods +7 -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 +26 -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 +153 -0
  14. data/lib/loc_mods/collection.rb +2 -2
  15. data/lib/loc_mods/comparable_mapper.rb +110 -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: 2b206d76220e77a18fd6609c3f7646eaf8fb836ac2d69a7d6da019db5820f24d
4
+ data.tar.gz: ffd23bb7508ad1fef1e0b165eb07620fc0a2420b6c436ac34cec8208affb6463
5
5
  SHA512:
6
- metadata.gz: bb267c94c7de7b895ccf168ca9b0a37133afce833981a332e43f3f82822aeec27ada4b4becedb1b7196ebcaab97bd5c90c68ee8fd23ab463b82500b0a72f7b7a
7
- data.tar.gz: 49f9d610121df295c904cede6245d4dd907bbba9c919879ccf8e44211b095bd23700452b4d4d6a670f2e5e579a6fc3e06ad70d1fa450f1c9de35ff1f01ff6144
6
+ metadata.gz: 9f56bbb4bfdab2dd2820ef67d94461ac5caa47d62937762a5cbeacbea8e70497c75968d92b3ce23f5d7e79f6a737c98c43058d6e11b774d0777340f040808fea
7
+ data.tar.gz: 0ac7feedcebe5df178f6ad313ba811004de126c82adc0f5289f44b43212a26ef2acfa3f09a45afa9cd4b158b7b4ef97976413ac357b4eb11749ab227c801a168
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,7 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require_relative "../lib/loc_mods/cli"
6
+
7
+ 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,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/loc_mods/base_mapper.rb
4
+ require "shale"
5
+ require_relative "comparable_mapper"
6
+
7
+ module LocMods
8
+ # Base class for all object definitions
9
+ class BaseMapper < Shale::Mapper
10
+ include ComparableMapper
11
+ end
12
+
13
+ # Nil class substitute for comparison
14
+ class ComparableNil < BaseMapper
15
+ end
16
+
17
+ # Comparison of two values for ComparableMapper
18
+ class Comparison
19
+ attr_accessor :original, :updated
20
+
21
+ def initialize(original:, updated:)
22
+ @original = original
23
+ @updated = updated
24
+ end
25
+ end
26
+ 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,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/loc_mods/cli.rb
4
+ require "thor"
5
+ require "loc_mods"
6
+
7
+ module LocMods
8
+ class Cli < Thor
9
+ desc "detect-duplicates PATH...", "Detect duplicate records in MODS XML files or directories"
10
+
11
+ def detect_duplicates(*paths)
12
+ all_records = []
13
+ paths.each do |path|
14
+ if File.directory?(path)
15
+ Dir.glob(File.join(path, "*.xml")).each do |file|
16
+ process_file(file, all_records)
17
+ end
18
+ elsif File.file?(path) && path.end_with?(".xml")
19
+ process_file(path, all_records)
20
+ else
21
+ puts "Warning: Skipping invalid path: #{path}"
22
+ end
23
+ end
24
+
25
+ records_by_url = {}
26
+ all_records.each do |record|
27
+ urls = record[:record].location.flat_map { |loc| loc.url.map(&:content) }.compact
28
+ unless urls.any?
29
+ puts "Warning: Record without URL found in file: #{record[:file]}"
30
+ next
31
+ end
32
+
33
+ urls.each do |url|
34
+ records_by_url[url] ||= []
35
+ records_by_url[url] << record
36
+ end
37
+ end
38
+
39
+ duplicate_count = 0
40
+ records_by_url.each do |url, records|
41
+ next unless records.size > 1
42
+
43
+ duplicate_count += 1
44
+ puts "Duplicate set ##{duplicate_count} found for URL: #{url}"
45
+ records.combination(2).each_with_index do |(record1, record2), index|
46
+ puts " Comparison #{index + 1}:"
47
+ puts " File 1: #{record1[:file]}"
48
+ puts " File 2: #{record2[:file]}"
49
+ differences = record1[:record].compare(record2[:record])
50
+ if differences
51
+ puts " ----"
52
+ print_differences(differences)
53
+ puts " ----"
54
+ end
55
+ puts "\n"
56
+ end
57
+ end
58
+ end
59
+
60
+ private
61
+
62
+ def process_file(file, all_records)
63
+ xml_content = File.read(file)
64
+ collection = LocMods::Collection.from_xml(xml_content)
65
+ collection.mods.each do |record|
66
+ all_records << { record: record, file: file }
67
+ end
68
+ end
69
+
70
+ def print_differences(differences, prefix = "", path = [])
71
+ if differences.is_a?(Comparison)
72
+ print_difference(differences, path)
73
+ return
74
+ end
75
+
76
+ # Differences is a Hash here
77
+ differences.each do |key, value|
78
+ # puts "key #{key}, value #{value}"
79
+ current_path = path + [key]
80
+ # This is a comparison
81
+ if value.is_a?(Comparison)
82
+ print_difference(value, path)
83
+ next
84
+ end
85
+
86
+ raise "Differences must be in form of a Hash" unless value.is_a?(Hash)
87
+
88
+ # This is not array, end here
89
+ next unless value.keys.any? do |k|
90
+ k.is_a?(Integer) || k == :_array_size_difference
91
+ end
92
+
93
+ # if value[:_array_size_difference]
94
+ # puts " #{format_path(current_path)} [_array_size_difference]:"
95
+ # puts " Record 1: #{format_value(value[:_array_size_difference].original)}"
96
+ # puts " Record 2: #{format_value(value[:_array_size_difference].updated)}"
97
+ # puts
98
+ # end
99
+
100
+ value.each do |subkey, subvalue|
101
+ # if [:self, :other].include?(subkey)
102
+ # raise "Subkey is self or other"
103
+ # end
104
+ # puts "subkey (#{subkey})"
105
+ # puts "subvalue #{subvalue}, prefix #{prefix}, current_path + [subkey] #{current_path + [subkey]}"
106
+
107
+ if subkey.is_a?(Integer)
108
+ print_differences(subvalue, prefix, current_path + [subkey])
109
+ else
110
+ if subvalue.is_a?(Comparison)
111
+ print_difference(subvalue, current_path + [subkey])
112
+ next
113
+ end
114
+
115
+ raise "In an array diff but not an Integer!"
116
+ end
117
+ end
118
+ end
119
+ end
120
+
121
+ def print_difference(value, current_path)
122
+ return unless value.original || value.updated
123
+
124
+ puts " #{format_path(current_path)}:"
125
+ puts " Record 1: #{format_value(value.original)}"
126
+ puts " Record 2: #{format_value(value.updated)}"
127
+ puts
128
+ end
129
+
130
+ def format_path(path)
131
+ path.map.with_index do |part, index|
132
+ if index.zero?
133
+ part.to_s
134
+ elsif part.is_a?(Integer)
135
+ "[#{part}]"
136
+ else
137
+ ".#{part}"
138
+ end
139
+ end.join
140
+ end
141
+
142
+ def format_value(value)
143
+ case value
144
+ when nil, ComparableNil
145
+ "(nil)"
146
+ when String
147
+ "\"#{value}\""
148
+ else
149
+ value.to_s
150
+ end
151
+ end
152
+ end
153
+ 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,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ # lib/loc_mods/comparable_mapper.rb
4
+
5
+ module LocMods
6
+ # Enable comparison of two class models solely based on attribute values in
7
+ # a recursive manner.
8
+ module ComparableMapper
9
+ # TODO: Implement Comparable
10
+ # include Comparable
11
+ # def <=>(other)
12
+ # attributes.foo <=> other.attributes.foo
13
+ # end
14
+ # def inspect
15
+ # @foo
16
+ # end
17
+
18
+ def eql?(other)
19
+ other.class == self.class &&
20
+ self.class.attributes.all? do |attr|
21
+ send(attr) == other.send(attr)
22
+ end
23
+ end
24
+
25
+ alias == eql?
26
+
27
+ def hash
28
+ ([self.class] + self.class.attributes.map(&:hash)).hash
29
+ end
30
+
31
+ def compare(other)
32
+ differences = {}
33
+
34
+ # puts "Debugging: Attributes for #{self.class.name}"
35
+ # pp self.class.attributes.keys
36
+
37
+ self.class.attributes.each_key do |attr|
38
+ self_value = respond_to?(attr) ? send(attr) : nil
39
+ other_value = other.respond_to?(attr) ? other.send(attr) : nil
40
+
41
+ # puts "Debugging: Comparing attribute '#{attr}'"
42
+ # puts " Self value: #{self_value.inspect}"
43
+ # puts " Other value: #{other_value.inspect}"
44
+
45
+ compared = compare_values(self_value, other_value)
46
+ if compared
47
+ # puts "DETECTED DIFFERENCE! #{compared.inspect}"
48
+ differences[attr] = compared
49
+ end
50
+ end
51
+
52
+ # unless differences.empty?
53
+ # puts "DIFFERENCES ARE"
54
+ # pp differences
55
+ # end
56
+
57
+ differences.empty? ? nil : differences
58
+ end
59
+
60
+ private
61
+
62
+ def compare_values(self_value, other_value)
63
+ # puts "compare_values (self_value: #{self_value}, other_value: #{other_value})"
64
+ case self_value
65
+ when Array
66
+ # puts "compare_values case 1"
67
+ compare_arrays(self_value, other_value || [])
68
+ when ComparableMapper
69
+ # puts "compare_values case 2"
70
+ self_value.compare(other_value)
71
+ else
72
+ if self_value != other_value
73
+ # puts "compare_values case 3"
74
+ Comparison.new(original: self_value, updated: other_value)
75
+ end
76
+ end
77
+ end
78
+
79
+ def compare_arrays(self_array, other_array)
80
+ differences = {}
81
+ max_length = [self_array.size, other_array.size].max
82
+
83
+ max_length.times do |index|
84
+ self_item = self_array[index] || ComparableNil.new
85
+ other_item = other_array[index] || ComparableNil.new
86
+
87
+ compared = compare_values(self_item, other_item)
88
+ differences[index] = compared if compared
89
+
90
+ # if index >= self_array.size
91
+ # puts "case 1 #{compared}"
92
+ # # differences[index] = compared
93
+ # elsif index >= other_array.size
94
+ # puts "case 2.1 #{self_item}"
95
+ # puts "case 2.2 #{compared}"
96
+ # # differences[index] = compared
97
+ # end
98
+ end
99
+
100
+ if self_array.size != other_array.size
101
+ differences[:_array_size_difference] = Comparison.new(
102
+ original: self_array.size,
103
+ updated: other_array.size
104
+ )
105
+ end
106
+
107
+ differences.empty? ? nil : differences
108
+ end
109
+ end
110
+ 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