loc_mods 0.2.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +46 -1
- data/exe/loc-mods +7 -0
- data/lib/loc_mods/abstract.rb +2 -2
- data/lib/loc_mods/access_condition.rb +2 -2
- data/lib/loc_mods/alternative_name.rb +2 -2
- data/lib/loc_mods/area.rb +2 -2
- data/lib/loc_mods/base_mapper.rb +26 -0
- data/lib/loc_mods/cartographic_extension.rb +2 -2
- data/lib/loc_mods/cartographics.rb +2 -2
- data/lib/loc_mods/city_section.rb +2 -2
- data/lib/loc_mods/classification.rb +2 -2
- data/lib/loc_mods/cli.rb +153 -0
- data/lib/loc_mods/collection.rb +2 -2
- data/lib/loc_mods/comparable_mapper.rb +110 -0
- data/lib/loc_mods/copy_information.rb +2 -2
- data/lib/loc_mods/date.rb +2 -2
- data/lib/loc_mods/date_other.rb +2 -2
- data/lib/loc_mods/detail.rb +2 -2
- data/lib/loc_mods/edition.rb +2 -2
- data/lib/loc_mods/enumeration_and_chronology.rb +2 -2
- data/lib/loc_mods/extent.rb +2 -2
- data/lib/loc_mods/extent_definition.rb +2 -2
- data/lib/loc_mods/form.rb +2 -2
- data/lib/loc_mods/genre.rb +2 -2
- data/lib/loc_mods/geographic_code.rb +2 -2
- data/lib/loc_mods/hierarchical_geographic.rb +2 -2
- data/lib/loc_mods/hierarchical_part.rb +2 -2
- data/lib/loc_mods/holding_simple.rb +2 -2
- data/lib/loc_mods/identifier.rb +2 -2
- data/lib/loc_mods/item_identifier.rb +2 -2
- data/lib/loc_mods/language.rb +2 -2
- data/lib/loc_mods/language_term.rb +2 -2
- data/lib/loc_mods/location.rb +2 -2
- data/lib/loc_mods/name.rb +2 -2
- data/lib/loc_mods/name_part.rb +2 -2
- data/lib/loc_mods/non_sort.rb +2 -2
- data/lib/loc_mods/note.rb +2 -2
- data/lib/loc_mods/occupation.rb +2 -2
- data/lib/loc_mods/origin_info.rb +2 -2
- data/lib/loc_mods/part.rb +2 -2
- data/lib/loc_mods/physical_description.rb +2 -2
- data/lib/loc_mods/physical_description_note.rb +2 -2
- data/lib/loc_mods/physical_location.rb +2 -2
- data/lib/loc_mods/place.rb +2 -2
- data/lib/loc_mods/place_term.rb +2 -2
- data/lib/loc_mods/publisher.rb +2 -2
- data/lib/loc_mods/record.rb +2 -2
- data/lib/loc_mods/record_content_source.rb +2 -2
- data/lib/loc_mods/record_identifier.rb +2 -2
- data/lib/loc_mods/record_info.rb +2 -2
- data/lib/loc_mods/record_info_note.rb +2 -2
- data/lib/loc_mods/region.rb +2 -2
- data/lib/loc_mods/related_item.rb +2 -2
- data/lib/loc_mods/role.rb +2 -2
- data/lib/loc_mods/role_term.rb +2 -2
- data/lib/loc_mods/script_term.rb +2 -2
- data/lib/loc_mods/string_plus_language.rb +2 -2
- data/lib/loc_mods/string_plus_language_plus_authority.rb +2 -2
- data/lib/loc_mods/string_plus_language_plus_supplied.rb +2 -2
- data/lib/loc_mods/subject.rb +2 -2
- data/lib/loc_mods/subject_name.rb +2 -2
- data/lib/loc_mods/subject_title_info.rb +2 -2
- data/lib/loc_mods/table_of_contents.rb +2 -2
- data/lib/loc_mods/target_audience.rb +2 -2
- data/lib/loc_mods/temporal.rb +2 -2
- data/lib/loc_mods/text.rb +2 -2
- data/lib/loc_mods/title_info.rb +2 -2
- data/lib/loc_mods/type_of_resource.rb +2 -2
- data/lib/loc_mods/url.rb +2 -2
- data/lib/loc_mods/version.rb +1 -1
- metadata +22 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b206d76220e77a18fd6609c3f7646eaf8fb836ac2d69a7d6da019db5820f24d
|
4
|
+
data.tar.gz: ffd23bb7508ad1fef1e0b165eb07620fc0a2420b6c436ac34cec8208affb6463
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/lib/loc_mods/abstract.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class Abstract <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class AccessCondition <
|
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
|
-
|
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 <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
require_relative "hierarchical_part"
|
6
6
|
|
7
7
|
module LocMods
|
8
|
-
class Area <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class CartographicExtension <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
require_relative "cartographic_extension"
|
6
6
|
|
7
7
|
module LocMods
|
8
|
-
class Cartographics <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
require_relative "hierarchical_part"
|
6
6
|
|
7
7
|
module LocMods
|
8
|
-
class CitySection <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class Classification <
|
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
|
data/lib/loc_mods/cli.rb
ADDED
@@ -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
|
data/lib/loc_mods/collection.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
require_relative "record"
|
6
6
|
|
7
7
|
module LocMods
|
8
|
-
class Collection <
|
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
|
-
|
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 <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class Date <
|
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
|
data/lib/loc_mods/date_other.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
require_relative "date"
|
6
6
|
|
7
7
|
module LocMods
|
8
|
-
class DateOther <
|
8
|
+
class DateOther < BaseMapper
|
9
9
|
attribute :content, Shale::Type::String
|
10
10
|
attribute :type, Shale::Type::String
|
11
11
|
|
data/lib/loc_mods/detail.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class Detail <
|
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
|
data/lib/loc_mods/edition.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
6
|
# LocMods::StringPlusLanguagePlusSupplied
|
7
|
-
class Edition <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class EnumerationAndChronology <
|
6
|
+
class EnumerationAndChronology < BaseMapper
|
7
7
|
attribute :content, Shale::Type::String
|
8
8
|
attribute :unit_type, Shale::Type::String
|
9
9
|
|
data/lib/loc_mods/extent.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class ExtentDefinition <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class Form <
|
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
|
data/lib/loc_mods/genre.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class Genre <
|
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
|
-
|
3
|
+
require_relative "base_mapper"
|
4
4
|
|
5
5
|
module LocMods
|
6
|
-
class GeographicCode <
|
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
|
-
|
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 <
|
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
|