loc_mods 0.2.7 → 0.3.0

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +16 -7
  3. data/.rubocop_todo.yml +38 -37
  4. data/README.adoc +16 -0
  5. data/lib/loc_mods/abstract.rb +2 -2
  6. data/lib/loc_mods/access_condition.rb +2 -2
  7. data/lib/loc_mods/alternative_name.rb +2 -2
  8. data/lib/loc_mods/area.rb +2 -2
  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 +15 -9
  14. data/lib/loc_mods/collection.rb +2 -2
  15. data/lib/loc_mods/copy_information.rb +2 -2
  16. data/lib/loc_mods/date.rb +4 -4
  17. data/lib/loc_mods/date_other.rb +2 -2
  18. data/lib/loc_mods/detail.rb +2 -2
  19. data/lib/loc_mods/edition.rb +2 -2
  20. data/lib/loc_mods/enumeration_and_chronology.rb +2 -2
  21. data/lib/loc_mods/extent.rb +2 -2
  22. data/lib/loc_mods/extent_definition.rb +2 -2
  23. data/lib/loc_mods/form.rb +2 -2
  24. data/lib/loc_mods/genre.rb +2 -2
  25. data/lib/loc_mods/geographic_code.rb +2 -2
  26. data/lib/loc_mods/hierarchical_geographic.rb +2 -2
  27. data/lib/loc_mods/hierarchical_part.rb +2 -2
  28. data/lib/loc_mods/holding_simple.rb +2 -2
  29. data/lib/loc_mods/identifier.rb +2 -2
  30. data/lib/loc_mods/item_identifier.rb +2 -2
  31. data/lib/loc_mods/language.rb +2 -2
  32. data/lib/loc_mods/language_term.rb +2 -2
  33. data/lib/loc_mods/location.rb +2 -2
  34. data/lib/loc_mods/name.rb +4 -6
  35. data/lib/loc_mods/name_part.rb +2 -2
  36. data/lib/loc_mods/namespace.rb +10 -0
  37. data/lib/loc_mods/non_sort.rb +4 -5
  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 +3 -2
  41. data/lib/loc_mods/part.rb +2 -2
  42. data/lib/loc_mods/physical_description.rb +3 -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 +3 -2
  49. data/lib/loc_mods/record_content_source.rb +1 -1
  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 +4 -6
  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/subject.rb +6 -7
  60. data/lib/loc_mods/subject_name.rb +2 -2
  61. data/lib/loc_mods/subject_title_info.rb +2 -2
  62. data/lib/loc_mods/table_of_contents.rb +2 -2
  63. data/lib/loc_mods/target_audience.rb +2 -2
  64. data/lib/loc_mods/temporal.rb +2 -2
  65. data/lib/loc_mods/text.rb +2 -2
  66. data/lib/loc_mods/title_info.rb +2 -2
  67. data/lib/loc_mods/type_of_resource.rb +2 -2
  68. data/lib/loc_mods/url.rb +2 -2
  69. data/lib/loc_mods/version.rb +1 -1
  70. data/lib/loc_mods/xlink_href.rb +9 -0
  71. data/lib/loc_mods/xlink_namespace.rb +8 -0
  72. data/lib/loc_mods/xml_space.rb +9 -0
  73. data/lib/loc_mods.rb +71 -8
  74. metadata +10 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 024d52ee3ab202df40aacd38b5e6a9cf91a199a64fe7021d38c09dd1054e7321
4
- data.tar.gz: 29d07b4f6b1f1fb00491610033047039079e814316136286e880662bab2c94e0
3
+ metadata.gz: 169bec73df0640577af6a10da45138fa11502b00d8cb4f2d1152c2f360c02999
4
+ data.tar.gz: cf3045ea76530e0caba326d6ee326f5afc94e7f2022d00f850aa3800a58fa33b
5
5
  SHA512:
6
- metadata.gz: 17fe60875e1e45382111972d8ace84fee39b86ff0326c4f08617de5dbcd66ffd12f65c674ebf513062df891019bac012248a0d41e9dac8804f3d25ca1e0c80fb
7
- data.tar.gz: ceb304d8b6124c4982c1492b2c4b7d1af4d862379ae5b5f3c240b68701f6aee086c46713215884aa9953f50ebe87be7c287ea9aa3eb3466d2e8d9a299a82ca60
6
+ metadata.gz: c68a2d4981a688b61af9a329b7d0393d6f0f3f3f4ca56e4fca7ce1b5958227a5180d66be34de64ad34871dec37a341fde55e75581f7039706ba17f69936d7ed1
7
+ data.tar.gz: b3e6b998a759d09eec487fcc01ab4b3f1fb44c6df5457231c1fddde76f3c078676e5898bcd05bee6e46c0281ebb2f18c102df3d78feb0671ed79cf95d7f11494
data/.rubocop.yml CHANGED
@@ -1,10 +1,19 @@
1
- inherit_from: .rubocop_todo.yml
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ inherit_from:
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
+ - .rubocop_todo.yml
2
6
 
3
- AllCops:
4
- TargetRubyVersion: 3.0
7
+ inherit_mode:
8
+ merge:
9
+ - Exclude
5
10
 
6
- Style/StringLiterals:
7
- EnforcedStyle: double_quotes
11
+ # local repo-specific modifications
12
+ # ...
13
+ plugins:
14
+ - rubocop-rspec
15
+ - rubocop-performance
16
+ - rubocop-rake
8
17
 
9
- Style/StringLiteralsInInterpolation:
10
- EnforcedStyle: double_quotes
18
+ AllCops:
19
+ TargetRubyVersion: 3.0
data/.rubocop_todo.yml CHANGED
@@ -1,18 +1,27 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-01-14 08:30:09 UTC using RuboCop version 1.70.0.
3
+ # on 2026-03-24 02:27:27 UTC using RuboCop version 1.86.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
9
  # Offense count: 1
10
- # Configuration parameters: Severity, Include.
11
- # Include: **/*.gemspec
12
10
  Gemspec/RequiredRubyVersion:
13
11
  Exclude:
14
12
  - 'loc_mods.gemspec'
15
13
 
14
+ # Offense count: 5
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
17
+ # URISchemes: http, https
18
+ Layout/LineLength:
19
+ Exclude:
20
+ - 'bin/update-nist-mods'
21
+ - 'lib/loc_mods/cli.rb'
22
+ - 'loc_mods.gemspec'
23
+ - 'spec/loc_mods/collection_spec.rb'
24
+
16
25
  # Offense count: 1
17
26
  # Configuration parameters: AllowedMethods.
18
27
  # AllowedMethods: enums
@@ -20,31 +29,34 @@ Lint/ConstantDefinitionInBlock:
20
29
  Exclude:
21
30
  - 'spec/loc_mods/collection_spec.rb'
22
31
 
23
- # Offense count: 1
24
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
32
+ # Offense count: 2
33
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
25
34
  Metrics/AbcSize:
26
- Max: 50
35
+ Exclude:
36
+ - 'lib/loc_mods/cli.rb'
27
37
 
28
38
  # Offense count: 1
29
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
39
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
30
40
  # AllowedMethods: refine
31
41
  Metrics/BlockLength:
32
- Max: 32
42
+ Max: 30
33
43
 
34
44
  # Offense count: 2
35
- # Configuration parameters: AllowedMethods, AllowedPatterns.
45
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
36
46
  Metrics/CyclomaticComplexity:
37
- Max: 15
47
+ Exclude:
48
+ - 'lib/loc_mods/cli.rb'
38
49
 
39
50
  # Offense count: 3
40
51
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
41
52
  Metrics/MethodLength:
42
- Max: 43
53
+ Max: 45
43
54
 
44
55
  # Offense count: 2
45
- # Configuration parameters: AllowedMethods, AllowedPatterns.
56
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
46
57
  Metrics/PerceivedComplexity:
47
- Max: 16
58
+ Exclude:
59
+ - 'lib/loc_mods/cli.rb'
48
60
 
49
61
  # Offense count: 1
50
62
  # Configuration parameters: ForbiddenDelimiters.
@@ -54,34 +66,23 @@ Naming/HeredocDelimiterNaming:
54
66
  - 'bin/update-nist-mods'
55
67
 
56
68
  # Offense count: 1
57
- Security/Open:
58
- Exclude:
59
- - 'bin/update-nist-mods'
60
-
61
- # Offense count: 63
62
- # Configuration parameters: AllowedConstants.
63
- Style/Documentation:
64
- Enabled: false
69
+ # Configuration parameters: CountAsOne.
70
+ RSpec/ExampleLength:
71
+ Max: 7
65
72
 
66
73
  # Offense count: 1
67
- # This cop supports safe autocorrection (--autocorrect).
68
- # Configuration parameters: Strict, AllowedNumbers, AllowedPatterns.
69
- Style/NumericLiterals:
70
- MinDigits: 6
71
-
72
- # Offense count: 2
73
- # This cop supports safe autocorrection (--autocorrect).
74
- # Configuration parameters: EnforcedStyleForMultiline.
75
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
76
- Style/TrailingCommaInArguments:
74
+ RSpec/LeakyConstantDeclaration:
77
75
  Exclude:
78
- - 'lib/loc_mods/cli.rb'
79
76
  - 'spec/loc_mods/collection_spec.rb'
80
77
 
81
78
  # Offense count: 1
82
- # This cop supports safe autocorrection (--autocorrect).
83
- # Configuration parameters: EnforcedStyleForMultiline.
84
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
85
- Style/TrailingCommaInArrayLiteral:
79
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata, InflectorPath, EnforcedInflector.
80
+ # SupportedInflectors: default, active_support
81
+ RSpec/SpecFilePathFormat:
86
82
  Exclude:
87
- - 'spec/loc_mods/collection_spec.rb'
83
+ - 'spec/loc_mods_spec.rb'
84
+
85
+ # Offense count: 1
86
+ Security/Open:
87
+ Exclude:
88
+ - 'bin/update-nist-mods'
data/README.adoc CHANGED
@@ -119,6 +119,22 @@ metadata.
119
119
  bin/update-nist-mods
120
120
  ----
121
121
 
122
+ === Running tests
123
+
124
+ Run all tests:
125
+
126
+ [source,sh]
127
+ ----
128
+ bundle exec rake spec
129
+ ----
130
+
131
+ Run a single test by description:
132
+
133
+ [source,sh]
134
+ ----
135
+ bundle exec rspec spec/loc_mods/collection_spec.rb --example "991000197019708106"
136
+ ----
137
+
122
138
  == License
123
139
 
124
140
  Copyright Ribose.
@@ -13,8 +13,8 @@ module LocMods
13
13
  attribute :content_type, :string
14
14
 
15
15
  xml do
16
- root "abstract"
17
- namespace "http://www.loc.gov/mods/v3", nil
16
+ element "abstract"
17
+ namespace Namespace
18
18
 
19
19
  map_content to: :content
20
20
  map_attribute "displayLabel", to: :display_label
@@ -15,8 +15,8 @@ module LocMods
15
15
  attribute :content_type, :string
16
16
 
17
17
  xml do
18
- root "accessCondition"
19
- namespace "http://www.loc.gov/mods/v3", nil
18
+ element "accessCondition"
19
+ namespace Namespace
20
20
 
21
21
  map_content to: :content
22
22
  map_attribute "displayLabel", to: :display_label
@@ -21,8 +21,8 @@ module LocMods
21
21
  attribute :name_identifier, Identifier, collection: true
22
22
 
23
23
  xml do
24
- root "alternativeName"
25
- namespace "http://www.loc.gov/mods/v3", nil
24
+ element "alternativeName"
25
+ namespace Namespace
26
26
 
27
27
  map_attribute "lang", to: :lang
28
28
  map_attribute "script", to: :script
data/lib/loc_mods/area.rb CHANGED
@@ -10,8 +10,8 @@ module LocMods
10
10
  attribute :area_type, :string
11
11
 
12
12
  xml do
13
- root "area"
14
- namespace "http://www.loc.gov/mods/v3", nil
13
+ element "area"
14
+ namespace Namespace
15
15
 
16
16
  map_content to: :content
17
17
  map_attribute "areaType", to: :area_type
@@ -8,8 +8,8 @@ module LocMods
8
8
  attribute :display_label, :string
9
9
 
10
10
  xml do
11
- root "cartographicExtension"
12
- namespace "http://www.loc.gov/mods/v3", nil
11
+ element "cartographicExtension"
12
+ namespace Namespace
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "displayLabel", to: :display_label
@@ -15,8 +15,8 @@ module LocMods
15
15
  attribute :cartographic_extension, CartographicExtension, collection: true
16
16
 
17
17
  xml do
18
- root "cartographics"
19
- namespace "http://www.loc.gov/mods/v3", nil
18
+ element "cartographics"
19
+ namespace Namespace
20
20
 
21
21
  map_attribute "authority", to: :authority
22
22
  map_attribute "authorityURI", to: :authority_uri
@@ -10,8 +10,8 @@ module LocMods
10
10
  attribute :city_section_type, :string
11
11
 
12
12
  xml do
13
- root "citySection"
14
- namespace "http://www.loc.gov/mods/v3", nil
13
+ element "citySection"
14
+ namespace Namespace
15
15
 
16
16
  map_content to: :content
17
17
  map_attribute "citySectionType", to: :city_section_type
@@ -13,8 +13,8 @@ module LocMods
13
13
  attribute :generator, :string
14
14
 
15
15
  xml do
16
- root "classification"
17
- namespace "http://www.loc.gov/mods/v3", nil
16
+ element "classification"
17
+ namespace Namespace
18
18
 
19
19
  map_content to: :content
20
20
  map_attribute "authority", to: :authority
data/lib/loc_mods/cli.rb CHANGED
@@ -5,9 +5,12 @@ require "loc_mods"
5
5
 
6
6
  module LocMods
7
7
  class Cli < Thor
8
- desc "detect-duplicates PATH...", "Detect duplicate records in MODS XML files or directories"
9
- method_option :show_unchanged, type: :boolean, default: false, desc: "Show unchanged attributes in the diff output"
10
- method_option :highlight_diff, type: :boolean, default: false, desc: "Highlight only the differences"
8
+ desc "detect-duplicates PATH...",
9
+ "Detect duplicate records in MODS XML files or directories"
10
+ method_option :show_unchanged, type: :boolean, default: false,
11
+ desc: "Show unchanged attributes in the diff output"
12
+ method_option :highlight_diff, type: :boolean, default: false,
13
+ desc: "Highlight only the differences"
11
14
  method_option :color, type: :string, enum: %w[auto on off], default: "auto",
12
15
  desc: "Use colors in the diff output (auto, on, off)"
13
16
 
@@ -27,7 +30,9 @@ module LocMods
27
30
 
28
31
  records_by_url = {}
29
32
  all_records.each do |record|
30
- urls = record[:record].location.flat_map { |loc| loc.url.map(&:content) }.compact
33
+ urls = record[:record].location.flat_map do |loc|
34
+ loc.url.map(&:content)
35
+ end.compact
31
36
  unless urls.any?
32
37
  puts "Warning: Record without URL found in file: #{record[:file]}"
33
38
  next
@@ -54,7 +59,7 @@ module LocMods
54
59
  record2[:record],
55
60
  options[:show_unchanged],
56
61
  options[:highlight_diff],
57
- color_enabled?
62
+ color_enabled?,
58
63
  )
59
64
  puts "\n"
60
65
  end
@@ -71,14 +76,15 @@ module LocMods
71
76
  end
72
77
  end
73
78
 
74
- def print_differences(record1, record2, show_unchanged, highlight_diff, use_colors)
79
+ def print_differences(record1, record2, show_unchanged, highlight_diff,
80
+ use_colors)
75
81
  diff_score, diff_tree = Lutaml::Model::Serialize.diff_with_score(
76
82
  record1,
77
83
  record2,
78
84
  show_unchanged: show_unchanged,
79
85
  highlight_diff: highlight_diff,
80
86
  use_colors: use_colors,
81
- indent: " "
87
+ indent: " ",
82
88
  )
83
89
  similarity_percentage = (1 - diff_score) * 100
84
90
 
@@ -101,7 +107,7 @@ module LocMods
101
107
  def supports_color?
102
108
  return false unless $stdout.tty?
103
109
 
104
- if RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/
110
+ if /mswin|mingw|cygwin/.match?(RbConfig::CONFIG["host_os"])
105
111
  return true if ENV["ANSICON"]
106
112
  return true if ENV["ConEmuANSI"] == "ON"
107
113
  return true if ENV["TERM"] == "xterm"
@@ -109,7 +115,7 @@ module LocMods
109
115
 
110
116
  return true if ENV["COLORTERM"]
111
117
 
112
- term = ENV["TERM"]
118
+ term = ENV.fetch("TERM", nil)
113
119
  return false if term.nil? || term.empty?
114
120
 
115
121
  color_terms = %w[ansi color console cygwin gnome konsole kterm
@@ -9,8 +9,8 @@ module LocMods
9
9
  attribute :mods, Record, collection: true
10
10
 
11
11
  xml do
12
- root "modsCollection"
13
- namespace "http://www.loc.gov/mods/v3", nil
12
+ element "modsCollection"
13
+ namespace Namespace
14
14
 
15
15
  map_element "mods", to: :mods
16
16
  end
@@ -19,8 +19,8 @@ module LocMods
19
19
  attribute :item_identifier, ItemIdentifier, collection: true
20
20
 
21
21
  xml do
22
- root "copyInformation"
23
- namespace "http://www.loc.gov/mods/v3", nil
22
+ element "copyInformation"
23
+ namespace Namespace
24
24
 
25
25
  map_element "form", to: :form
26
26
  map_element "subLocation", to: :sub_location
data/lib/loc_mods/date.rb CHANGED
@@ -5,18 +5,18 @@ require "lutaml/model"
5
5
  module LocMods
6
6
  class Date < Lutaml::Model::Serializable
7
7
  attribute :content, :string
8
- attribute :encoding, :string
8
+ attribute :encoding_code, :string
9
9
  attribute :qualifier, :string
10
10
  attribute :point, :string
11
11
  attribute :key_date, :string
12
12
  attribute :calendar, :string
13
13
 
14
14
  xml do
15
- root "recordChangeDate"
16
- namespace "http://www.loc.gov/mods/v3", nil
15
+ element "recordChangeDate"
16
+ namespace Namespace
17
17
 
18
18
  map_content to: :content
19
- map_attribute "encoding", to: :encoding
19
+ map_attribute "encoding", to: :encoding_code
20
20
  map_attribute "qualifier", to: :qualifier
21
21
  map_attribute "point", to: :point
22
22
  map_attribute "keyDate", to: :key_date
@@ -10,8 +10,8 @@ module LocMods
10
10
  attribute :type, :string
11
11
 
12
12
  xml do
13
- root "dateOther"
14
- namespace "http://www.loc.gov/mods/v3", nil
13
+ element "dateOther"
14
+ namespace Namespace
15
15
 
16
16
  map_content to: :content
17
17
  map_attribute "type", to: :type
@@ -11,8 +11,8 @@ module LocMods
11
11
  attribute :title, :string, collection: true
12
12
 
13
13
  xml do
14
- root "detail"
15
- namespace "http://www.loc.gov/mods/v3", nil
14
+ element "detail"
15
+ namespace Namespace
16
16
 
17
17
  map_attribute "type", to: :type
18
18
  map_attribute "level", to: :level
@@ -9,8 +9,8 @@ module LocMods
9
9
  attribute :supplied, :string
10
10
 
11
11
  xml do
12
- root "edition"
13
- namespace "http://www.loc.gov/mods/v3", nil
12
+ element "edition"
13
+ namespace Namespace
14
14
 
15
15
  map_content to: :content
16
16
  map_attribute "supplied", to: :supplied
@@ -8,8 +8,8 @@ module LocMods
8
8
  attribute :unit_type, :string
9
9
 
10
10
  xml do
11
- root "enumerationAndChronology"
12
- namespace "http://www.loc.gov/mods/v3", nil
11
+ element "enumerationAndChronology"
12
+ namespace Namespace
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "unitType", to: :unit_type
@@ -8,8 +8,8 @@ module LocMods
8
8
  attribute :unit, :string
9
9
 
10
10
  xml do
11
- root "extent"
12
- namespace "http://www.loc.gov/mods/v3", nil
11
+ element "extent"
12
+ namespace Namespace
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "unit", to: :unit
@@ -11,8 +11,8 @@ module LocMods
11
11
  attribute :list, :string
12
12
 
13
13
  xml do
14
- root "extentDefinition"
15
- namespace "http://www.loc.gov/mods/v3", nil
14
+ element "extentDefinition"
15
+ namespace Namespace
16
16
 
17
17
  map_attribute "unit", to: :unit
18
18
  map_element "start", to: :start
data/lib/loc_mods/form.rb CHANGED
@@ -9,8 +9,8 @@ module LocMods
9
9
  attribute :authority, :string
10
10
 
11
11
  xml do
12
- root "form"
13
- namespace "http://www.loc.gov/mods/v3", nil
12
+ element "form"
13
+ namespace Namespace
14
14
 
15
15
  map_content to: :content
16
16
  map_attribute "type", to: :type
@@ -12,8 +12,8 @@ module LocMods
12
12
  attribute :authority, :string
13
13
 
14
14
  xml do
15
- root "genre"
16
- namespace "http://www.loc.gov/mods/v3", nil
15
+ element "genre"
16
+ namespace Namespace
17
17
 
18
18
  map_content to: :content
19
19
  map_attribute "type", to: :type
@@ -10,8 +10,8 @@ module LocMods
10
10
  attribute :authority, :string
11
11
 
12
12
  xml do
13
- root "geographicCode"
14
- namespace "http://www.loc.gov/mods/v3", nil
13
+ element "geographicCode"
14
+ namespace Namespace
15
15
 
16
16
  map_content to: :content
17
17
  map_attribute "authorityURI", to: :authority_uri
@@ -26,8 +26,8 @@ module LocMods
26
26
  attribute :area, Area, collection: true
27
27
 
28
28
  xml do
29
- root "hierarchicalGeographic"
30
- namespace "http://www.loc.gov/mods/v3", nil
29
+ element "hierarchicalGeographic"
30
+ namespace Namespace
31
31
 
32
32
  map_attribute "authority", to: :authority
33
33
  map_attribute "authorityURI", to: :authority_uri
@@ -12,8 +12,8 @@ module LocMods
12
12
  attribute :value_uri, :string
13
13
 
14
14
  xml do
15
- root "territory"
16
- namespace "http://www.loc.gov/mods/v3", nil
15
+ element "territory"
16
+ namespace Namespace
17
17
 
18
18
  map_content to: :content
19
19
  map_attribute "level", to: :level
@@ -9,8 +9,8 @@ module LocMods
9
9
  attribute :copy_information, CopyInformation, collection: true
10
10
 
11
11
  xml do
12
- root "holdingSimple"
13
- namespace "http://www.loc.gov/mods/v3", nil
12
+ element "holdingSimple"
13
+ namespace Namespace
14
14
 
15
15
  map_element "copyInformation", to: :copy_information
16
16
  end
@@ -12,8 +12,8 @@ module LocMods
12
12
  attribute :alt_rep_group, :string
13
13
 
14
14
  xml do
15
- root "nameIdentifier"
16
- namespace "http://www.loc.gov/mods/v3", nil
15
+ element "nameIdentifier"
16
+ namespace Namespace
17
17
 
18
18
  map_content to: :content
19
19
  map_attribute "displayLabel", to: :display_label
@@ -8,8 +8,8 @@ module LocMods
8
8
  attribute :type, :string
9
9
 
10
10
  xml do
11
- root "itemIdentifier"
12
- namespace "http://www.loc.gov/mods/v3", nil
11
+ element "itemIdentifier"
12
+ namespace Namespace
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "type", to: :type
@@ -18,8 +18,8 @@ module LocMods
18
18
  attribute :script_term, ScriptTerm, collection: true
19
19
 
20
20
  xml do
21
- root "languageOfCataloging"
22
- namespace "http://www.loc.gov/mods/v3", nil
21
+ element "languageOfCataloging"
22
+ namespace Namespace
23
23
 
24
24
  map_attribute "objectPart", to: :object_part
25
25
  map_attribute "lang", to: :lang
@@ -11,8 +11,8 @@ module LocMods
11
11
  attribute :type, :string
12
12
 
13
13
  xml do
14
- root "languageTerm"
15
- namespace "http://www.loc.gov/mods/v3", nil
14
+ element "languageTerm"
15
+ namespace Namespace
16
16
 
17
17
  map_content to: :content
18
18
  map_attribute "authorityURI", to: :authority_uri
@@ -21,8 +21,8 @@ module LocMods
21
21
  attribute :holding_external, CartographicExtension
22
22
 
23
23
  xml do
24
- root "location"
25
- namespace "http://www.loc.gov/mods/v3", nil
24
+ element "location"
25
+ namespace Namespace
26
26
 
27
27
  map_attribute "lang", to: :lang
28
28
  map_attribute "script", to: :script
data/lib/loc_mods/name.rb CHANGED
@@ -29,15 +29,13 @@ module LocMods
29
29
  attribute :name_identifier, Identifier, collection: true
30
30
  attribute :alternative_name, AlternativeName, collection: true
31
31
  attribute :etal, :string
32
- attribute :href, :string
32
+ attribute :href, XlinkHref
33
33
 
34
34
  xml do
35
- root "name"
36
- namespace "http://www.loc.gov/mods/v3", nil
35
+ element "name"
36
+ namespace Namespace
37
37
 
38
- map_attribute "href", to: :href,
39
- namespace: "http://www.w3.org/1999/xlink",
40
- prefix: "xlink"
38
+ map_attribute "href", to: :href
41
39
 
42
40
  map_attribute "ID", to: :id
43
41
  map_attribute "authority", to: :authority
@@ -8,8 +8,8 @@ module LocMods
8
8
  attribute :type, :string
9
9
 
10
10
  xml do
11
- root "namePart"
12
- namespace "http://www.loc.gov/mods/v3", nil
11
+ element "namePart"
12
+ namespace Namespace
13
13
 
14
14
  map_content to: :content
15
15
  map_attribute "type", to: :type
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LocMods
4
+ class Namespace < Lutaml::Xml::Namespace
5
+ uri "http://www.loc.gov/mods/v3"
6
+ prefix_default "mods"
7
+ element_form_default :unqualified
8
+ attribute_form_default :unqualified
9
+ end
10
+ end