relaton-iso 2.0.0 → 2.1.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.
- checksums.yaml +4 -4
- data/CLAUDE.md +2 -2
- data/Gemfile +1 -0
- data/grammars/biblio.rng +4 -8
- data/lib/relaton/iso/data_fetcher.rb +1 -1
- data/lib/relaton/iso/item_data.rb +0 -4
- data/lib/relaton/iso/model/bibdata.rb +1 -0
- data/lib/relaton/iso/model/bibitem.rb +1 -0
- data/lib/relaton/iso/model/contributor.rb +0 -1
- data/lib/relaton/iso/model/docidentifier.rb +70 -81
- data/lib/relaton/iso/model/ext.rb +9 -5
- data/lib/relaton/iso/model/item_base.rb +15 -12
- data/lib/relaton/iso/version.rb +1 -1
- data/{relaton_iso.gemspec → relaton-iso.gemspec} +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fd102580f9b62955c20c472e51fa4ef1ebf17da882ec6831d29b6c50736f45d1
|
|
4
|
+
data.tar.gz: 90539cae8ac8b65341a3a9e169095f509f83eebd511e2379355fd1492cfd443b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4b23ce25925854f5f3c17e94a2dd8a5021901e6ce5c01fd6b2cf5673b6db5697335ac171ccf56dadaedeefd95814aeb7909476e5c0347bfb515cfd3267ae13e
|
|
7
|
+
data.tar.gz: 5f170c2c73bfa5c533a0c21b3e3bd602313731c6b3f2a6641068383fc3a5bc9ac8098a4708dcb1d5191e089df3cf07c6aeb60e0739922f32f9562f369d3a3804
|
data/CLAUDE.md
CHANGED
|
@@ -29,5 +29,5 @@ Key dependency: `pubid-iso` gem handles ISO publication identifier parsing and c
|
|
|
29
29
|
|
|
30
30
|
- **Framework:** RSpec with VCR cassettes and WebMock
|
|
31
31
|
- **Network access:** fully blocked via `WebMock.disable_net_connect!`
|
|
32
|
-
- **Index fixture:** `spec/fixtures/index-v1.zip` is
|
|
33
|
-
- **VCR:** cassettes in `spec/vcr_cassettes/`, record mode `:once`, re-record interval 7 days. Index download requests are ignored by VCR (handled by
|
|
32
|
+
- **Index fixture:** `spec/fixtures/index-v1.zip` is pre-loaded into `Relaton::Index` pool in `before(:suite)` (configured in `spec/support/webmock.rb`). Run `rake spec:update_index` to refresh from relaton-data-iso.
|
|
33
|
+
- **VCR:** cassettes in `spec/vcr_cassettes/`, record mode `:once`, re-record interval 7 days. Index download requests are ignored by VCR (handled by fixture instead).
|
data/Gemfile
CHANGED
data/grammars/biblio.rng
CHANGED
|
@@ -2015,15 +2015,11 @@ provided that it is not the entire bibliographic item that is so related</a:docu
|
|
|
2015
2015
|
<a:documentation>A version of the bibliographic item (within an edition). Can be used for drafts</a:documentation>
|
|
2016
2016
|
<element name="version">
|
|
2017
2017
|
<optional>
|
|
2018
|
-
<
|
|
2019
|
-
<a:documentation>
|
|
2020
|
-
</
|
|
2021
|
-
</optional>
|
|
2022
|
-
<optional>
|
|
2023
|
-
<ref name="draft">
|
|
2024
|
-
<a:documentation>The identifier for the current draft of the bibliographic item</a:documentation>
|
|
2025
|
-
</ref>
|
|
2018
|
+
<attribute name="type">
|
|
2019
|
+
<a:documentation>Versioning scheme, in case of multiple versioning schemes</a:documentation>
|
|
2020
|
+
</attribute>
|
|
2026
2021
|
</optional>
|
|
2022
|
+
<text/>
|
|
2027
2023
|
</element>
|
|
2028
2024
|
</define>
|
|
2029
2025
|
<define name="vedition">
|
|
@@ -1,133 +1,122 @@
|
|
|
1
1
|
module Relaton
|
|
2
2
|
module Iso
|
|
3
|
-
class Pubid < Lutaml::Model::Type::Value
|
|
4
|
-
module Renderer
|
|
5
|
-
end
|
|
6
|
-
|
|
7
|
-
class << self
|
|
8
|
-
def cast(value)
|
|
9
|
-
value.is_a?(String) ? ::Pubid::Iso::Identifier.parse(value) : value
|
|
10
|
-
rescue StandardError
|
|
11
|
-
Util.warn "Failed to parse Pubid: #{value}"
|
|
12
|
-
value
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
::Lutaml::Model::Config::AVAILABLE_FORMATS.each do |format|
|
|
17
|
-
define_method(:"to_#{format}") { value.to_s with_prf: true }
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def to_h = value.to_h
|
|
21
|
-
def urn = value.urn
|
|
22
|
-
end
|
|
23
|
-
|
|
24
3
|
class Docidentifier < Bib::Docidentifier
|
|
25
|
-
|
|
4
|
+
attribute :content, :string
|
|
26
5
|
|
|
27
|
-
|
|
6
|
+
attr_reader :pubid
|
|
28
7
|
|
|
29
|
-
# iso-tc identifiers are TC document numbers, not ISO standard
|
|
30
|
-
# identifiers — parsing them through Pubid adds a spurious
|
|
31
|
-
# "ISO" prefix (#178). Bypass Pubid casting for iso-tc content
|
|
32
|
-
# in both direct construction and XML deserialization paths.
|
|
33
8
|
def initialize(arg = nil, **kwargs)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
super(**kwargs)
|
|
40
|
-
end
|
|
41
|
-
@content = raw_content if raw_content.is_a?(String)
|
|
9
|
+
arg.is_a?(Hash) ? super(arg) : super(**kwargs)
|
|
10
|
+
# Content may have been set before type during lutaml init. Re-run
|
|
11
|
+
# the setter so type-dependent parsing (e.g. iso-tc bypass) applies.
|
|
12
|
+
raw = arg.is_a?(Hash) ? (arg["content"] || arg[:content]) : kwargs[:content]
|
|
13
|
+
self.content = raw if raw
|
|
42
14
|
end
|
|
43
15
|
|
|
44
|
-
# Capture raw iso-tc content before Pubid casting (#178).
|
|
45
|
-
# The lutaml-model setter is defined via define_method, so we
|
|
46
|
-
# wrap it with alias_method instead of super.
|
|
47
16
|
alias_method :original_content=, :content=
|
|
17
|
+
alias_method :original_content, :content
|
|
18
|
+
|
|
48
19
|
def content=(value)
|
|
49
|
-
|
|
50
|
-
|
|
20
|
+
@pubid = nil
|
|
21
|
+
@raw_content = nil
|
|
22
|
+
|
|
23
|
+
if type == "iso-tc" && value.is_a?(String)
|
|
24
|
+
@raw_content = value
|
|
25
|
+
else
|
|
26
|
+
parsed =
|
|
27
|
+
case value
|
|
28
|
+
when ::Pubid::Iso::Identifier::Base then value
|
|
29
|
+
when String
|
|
30
|
+
begin
|
|
31
|
+
::Pubid::Iso::Identifier.parse(value)
|
|
32
|
+
rescue StandardError
|
|
33
|
+
Util.warn "Failed to parse Pubid: #{value}"
|
|
34
|
+
nil
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
if parsed
|
|
39
|
+
@pubid = parsed
|
|
40
|
+
elsif value.is_a?(String)
|
|
41
|
+
@raw_content = value
|
|
42
|
+
end
|
|
51
43
|
end
|
|
52
|
-
|
|
44
|
+
|
|
45
|
+
send(:original_content=, to_s)
|
|
53
46
|
end
|
|
54
47
|
|
|
55
|
-
def
|
|
56
|
-
|
|
48
|
+
def content
|
|
49
|
+
return @raw_content if @raw_content
|
|
50
|
+
return render_pubid(@pubid) if @pubid
|
|
51
|
+
|
|
52
|
+
original_content
|
|
57
53
|
end
|
|
58
54
|
|
|
59
|
-
def
|
|
60
|
-
|
|
55
|
+
def to_s
|
|
56
|
+
content.to_s
|
|
61
57
|
end
|
|
62
58
|
|
|
63
59
|
def to_all_parts!
|
|
64
|
-
|
|
65
|
-
Util.warn "Cannot convert String to all parts: #{content}"
|
|
66
|
-
return
|
|
67
|
-
end
|
|
60
|
+
return unless @pubid
|
|
68
61
|
|
|
69
62
|
remove_part!
|
|
70
63
|
remove_date!
|
|
71
64
|
remove_stage!
|
|
72
|
-
|
|
65
|
+
@pubid.all_parts = true
|
|
66
|
+
refresh_content!
|
|
73
67
|
end
|
|
74
68
|
|
|
75
69
|
def remove_stage!
|
|
76
|
-
remove_attr!
|
|
70
|
+
remove_attr!(:stage)
|
|
77
71
|
end
|
|
78
72
|
|
|
79
73
|
def remove_part!
|
|
80
|
-
remove_attr!
|
|
74
|
+
remove_attr!(:part)
|
|
81
75
|
end
|
|
82
76
|
|
|
83
77
|
def remove_date!
|
|
84
|
-
remove_attr!
|
|
78
|
+
remove_attr!(:year)
|
|
85
79
|
end
|
|
86
80
|
|
|
87
81
|
def exclude_year
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
return @raw_content if @raw_content
|
|
83
|
+
return nil unless @pubid
|
|
84
|
+
|
|
85
|
+
pubid = @pubid.exclude(:year)
|
|
86
|
+
current = pubid
|
|
87
|
+
while current.base
|
|
88
|
+
current.base = current.base.exclude(:year)
|
|
89
|
+
current = current.base
|
|
95
90
|
end
|
|
96
91
|
pubid
|
|
97
92
|
end
|
|
98
93
|
|
|
99
|
-
|
|
100
|
-
return content if content.is_a? String
|
|
101
|
-
return @iso_tc_raw if @iso_tc_raw
|
|
94
|
+
private
|
|
102
95
|
|
|
96
|
+
def render_pubid(pubid)
|
|
103
97
|
case type
|
|
104
|
-
when "URN" then
|
|
105
|
-
when "iso-reference", "iso-with-lang"
|
|
106
|
-
|
|
98
|
+
when "URN" then pubid.urn
|
|
99
|
+
when "iso-reference", "iso-with-lang"
|
|
100
|
+
pubid.to_s(format: :ref_num_short, with_prf: true)
|
|
101
|
+
else
|
|
102
|
+
pubid.to_s(with_prf: true)
|
|
107
103
|
end
|
|
108
104
|
end
|
|
109
105
|
|
|
110
|
-
def iso_reference
|
|
111
|
-
content.to_s(format: :ref_num_short, with_prf: true)
|
|
112
|
-
|
|
113
|
-
# return content.to_s(format: :ref_num_short, with_prf: true) if content.language
|
|
114
|
-
|
|
115
|
-
# pubid_dup = content.dup
|
|
116
|
-
# pubid_dup.language = "en"
|
|
117
|
-
# pubid_dup.to_s(format: :ref_num_short, with_prf: true)
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
private
|
|
121
|
-
|
|
122
106
|
def remove_attr!(attr)
|
|
123
|
-
return
|
|
107
|
+
return unless @pubid
|
|
124
108
|
|
|
125
|
-
|
|
126
|
-
base =
|
|
109
|
+
@pubid.send("#{attr}=", nil)
|
|
110
|
+
base = @pubid.base
|
|
127
111
|
while base
|
|
128
112
|
base.send("#{attr}=", nil)
|
|
129
113
|
base = base.base
|
|
130
114
|
end
|
|
115
|
+
refresh_content!
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def refresh_content!
|
|
119
|
+
send(:original_content=, to_s)
|
|
131
120
|
end
|
|
132
121
|
end
|
|
133
122
|
end
|
|
@@ -5,7 +5,6 @@ require_relative "structured_identifier"
|
|
|
5
5
|
module Relaton
|
|
6
6
|
module Iso
|
|
7
7
|
class Ext < Bib::Ext
|
|
8
|
-
attribute :schema_version, method: :get_schema_version
|
|
9
8
|
attribute :doctype, Doctype
|
|
10
9
|
attribute :structuredidentifier, StructuredIdentifier
|
|
11
10
|
attribute :horizontal, :boolean
|
|
@@ -14,18 +13,23 @@ module Relaton
|
|
|
14
13
|
attribute :fast_track, :boolean
|
|
15
14
|
attribute :price_code, :string
|
|
16
15
|
|
|
17
|
-
def get_schema_version
|
|
18
|
-
Relaton.schema_versions["relaton-model-iso"]
|
|
19
|
-
end
|
|
16
|
+
def get_schema_version = Relaton.schema_versions["relaton-model-iso"]
|
|
20
17
|
|
|
21
18
|
xml do
|
|
22
|
-
root "ext"
|
|
23
19
|
map_element "horizontal", to: :horizontal
|
|
24
20
|
map_element "stagename", to: :stagename
|
|
25
21
|
map_element "updates-document-type", to: :updates_document_type
|
|
26
22
|
map_element "fast-track", to: :fast_track
|
|
27
23
|
map_element "price-code", to: :price_code
|
|
28
24
|
end
|
|
25
|
+
|
|
26
|
+
key_value do
|
|
27
|
+
map_element "horizontal", to: :horizontal
|
|
28
|
+
map_element "stagename", to: :stagename
|
|
29
|
+
map_element "updates_document_type", to: :updates_document_type
|
|
30
|
+
map_element "fast_track", to: :fast_track
|
|
31
|
+
map_element "price_code", to: :price_code
|
|
32
|
+
end
|
|
29
33
|
end
|
|
30
34
|
end
|
|
31
35
|
end
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
require_relative "docidentifier"
|
|
2
|
+
|
|
1
3
|
module Relaton
|
|
2
4
|
module Iso
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
class ItemBase < Lutaml::Model::Serializable
|
|
6
|
+
include Bib::NamespaceHelper
|
|
7
|
+
|
|
8
|
+
attr_accessor :type
|
|
9
|
+
|
|
6
10
|
model ItemData
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
attributes.delete :ext
|
|
12
|
+
instance_exec(&Bib::ItemShared::ATTRIBUTES)
|
|
13
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
14
|
+
attribute :relation, Relation, collection: true, initialize_empty: true
|
|
15
|
+
|
|
16
|
+
xml do
|
|
17
|
+
map_attribute "type", to: :type
|
|
18
|
+
instance_exec(&Bib::ItemShared::XML_BODY)
|
|
19
|
+
end
|
|
17
20
|
end
|
|
18
21
|
end
|
|
19
22
|
end
|
data/lib/relaton/iso/version.rb
CHANGED
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_dependency "isoics", "~> 0.1.6"
|
|
30
30
|
spec.add_dependency "openssl", "~> 3.3.2" # 3.3.0 raised an error on Ruby 3.4.7
|
|
31
31
|
spec.add_dependency "pubid-iso", "~> 1.15.8"
|
|
32
|
-
spec.add_dependency "relaton-bib", "~> 2.
|
|
32
|
+
spec.add_dependency "relaton-bib", "~> 2.1.0"
|
|
33
33
|
spec.add_dependency "relaton-core", "~> 0.0.12"
|
|
34
34
|
spec.add_dependency "relaton-index", "~> 0.2.12"
|
|
35
35
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-05-04 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: isoics
|
|
@@ -57,14 +58,14 @@ dependencies:
|
|
|
57
58
|
requirements:
|
|
58
59
|
- - "~>"
|
|
59
60
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.
|
|
61
|
+
version: 2.1.0
|
|
61
62
|
type: :runtime
|
|
62
63
|
prerelease: false
|
|
63
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
65
|
requirements:
|
|
65
66
|
- - "~>"
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 2.
|
|
68
|
+
version: 2.1.0
|
|
68
69
|
- !ruby/object:Gem::Dependency
|
|
69
70
|
name: relaton-core
|
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -147,11 +148,12 @@ files:
|
|
|
147
148
|
- lib/relaton/iso/scraper.rb
|
|
148
149
|
- lib/relaton/iso/util.rb
|
|
149
150
|
- lib/relaton/iso/version.rb
|
|
150
|
-
-
|
|
151
|
+
- relaton-iso.gemspec
|
|
151
152
|
homepage: https://github.com/relaton/relaton-iso
|
|
152
153
|
licenses:
|
|
153
154
|
- BSD-2-Clause
|
|
154
155
|
metadata: {}
|
|
156
|
+
post_install_message:
|
|
155
157
|
rdoc_options: []
|
|
156
158
|
require_paths:
|
|
157
159
|
- lib
|
|
@@ -166,7 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
166
168
|
- !ruby/object:Gem::Version
|
|
167
169
|
version: '0'
|
|
168
170
|
requirements: []
|
|
169
|
-
rubygems_version: 3.
|
|
171
|
+
rubygems_version: 3.5.22
|
|
172
|
+
signing_key:
|
|
170
173
|
specification_version: 4
|
|
171
174
|
summary: 'Relaton::Iso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
|
|
172
175
|
model'
|