relaton-iso 1.13.7 → 1.14.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/README.adoc +122 -107
- data/lib/relaton_iso/hit_collection.rb +2 -1
- data/lib/relaton_iso/iso_bibliography.rb +17 -22
- data/lib/relaton_iso/version.rb +1 -1
- data/relaton_iso.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f816fe256a883b565f7b3b1a41503cbb1718e19db7a4132b4bed7b6e11a67123
|
|
4
|
+
data.tar.gz: 18f3d87e6637e20b1b54255df3d5f8576f661808d357e7161df7074777e3e035
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 420603c2ec9fb866efb5da22e15706d2d7f54ec464723b7ddf76900461d6e59c717cf391312411cb12cb131997f28f1dfb561fc877381ea1df90bd034e4fcd4e
|
|
7
|
+
data.tar.gz: bd25b7a40dbbd476ace3493515502229ba57375add1bc04c4b719eabf71983e3b2bef7b5f7c840d81ead394ac078f60c7bd7bbcf46077d7274937eb3561b0361
|
data/README.adoc
CHANGED
|
@@ -46,18 +46,40 @@ hit_collection.first
|
|
|
46
46
|
|
|
47
47
|
item = hit_collection[2].fetch
|
|
48
48
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x007fa5dca89510
|
|
49
|
-
@abstract=
|
|
50
|
-
[#<RelatonBib::FormattedString:0x007fa5dca88458
|
|
51
|
-
@content=
|
|
52
|
-
"ISO/TS 19115-3:2016 defines an integrated XML implementation of ISO 19115‑1, ..."
|
|
53
49
|
...
|
|
54
50
|
|
|
55
51
|
item.docidentifier
|
|
56
|
-
=> [#<
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
=> [#<RelatonIso::DocumentIdentifier:0x00007fa8b7db1f20
|
|
53
|
+
@id=
|
|
54
|
+
#<Pubid::Iso::Identifier:0x00007fa8b7db2a60
|
|
55
|
+
@base=#<Pubid::Iso::Identifier:0x00007fa8b7db2c68 @edition="1", @number="19115"@4, @part="1", @publisher="ISO", @year=2014>,
|
|
56
|
+
@number="2"@21,
|
|
57
|
+
@publisher="ISO",
|
|
58
|
+
@stage=#<Pubid::Iso::Stage:0x00007fa8b7db20d8 @abbr=nil, @harmonized_code=#<Pubid::Iso::HarmonizedStageCode:0x00007fa8b7db2088 @stages=["60.60"]>>,
|
|
59
|
+
@typed_stage=#<Pubid::Iso::TypedStage:0x00007fa8b7db2920 @type=#<Pubid::Iso::Type:0x00007fa8b7db26c8 @type=:amd>, @typed_stage=nil>,
|
|
60
|
+
@year=2020>,
|
|
61
|
+
@language=nil,
|
|
62
|
+
@primary=true,
|
|
63
|
+
@scope=nil,
|
|
64
|
+
@script=nil,
|
|
65
|
+
@type="ISO">,
|
|
66
|
+
#<RelatonIso::DocumentIdentifier:0x00007fa8b7db1e80
|
|
67
|
+
@id=
|
|
68
|
+
#<Pubid::Iso::Identifier:0x00007fa8b7db2a60
|
|
69
|
+
@base=#<Pubid::Iso::Identifier:0x00007fa8b7db2c68 @edition="1", @number="19115"@4, @part="1", @publisher="ISO", @year=2014>,
|
|
70
|
+
@number="2"@21,
|
|
71
|
+
@publisher="ISO",
|
|
72
|
+
@stage=#<Pubid::Iso::Stage:0x00007fa8b7db20d8 @abbr=nil, @harmonized_code=#<Pubid::Iso::HarmonizedStageCode:0x00007fa8b7db2088 @stages=["60.60"]>>,
|
|
73
|
+
@typed_stage=#<Pubid::Iso::TypedStage:0x00007fa8b7db2920 @type=#<Pubid::Iso::Type:0x00007fa8b7db26c8 @type=:amd>, @typed_stage=nil>,
|
|
74
|
+
@year=2020>,
|
|
75
|
+
@language=nil,
|
|
76
|
+
@primary=nil,
|
|
77
|
+
@scope=nil,
|
|
78
|
+
@script=nil,
|
|
79
|
+
@type="URN">]
|
|
80
|
+
|
|
81
|
+
item.docidentifier.detect { |di| di.type == "URN" }.id
|
|
82
|
+
=> "urn:iso:std:iso:19115:-1:ed-1:amd:2020:v2"
|
|
61
83
|
----
|
|
62
84
|
|
|
63
85
|
=== Fetch document by reference and year
|
|
@@ -65,14 +87,14 @@ item.docidentifier
|
|
|
65
87
|
[source,ruby]
|
|
66
88
|
----
|
|
67
89
|
item = RelatonIso::IsoBibliography.get "ISO 19115:2003"
|
|
68
|
-
[relaton-iso] ("ISO 19115:2003") fetching...
|
|
69
|
-
[relaton-iso] ("ISO 19115:2003")
|
|
90
|
+
[relaton-iso] ("ISO 19115:2003") fetching from ISO...
|
|
91
|
+
[relaton-iso] ("ISO 19115:2003") Found exact match.
|
|
70
92
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c83429e30
|
|
71
93
|
...
|
|
72
94
|
|
|
73
95
|
item = RelatonIso::IsoBibliography.get "ISO 19115", "2003"
|
|
74
|
-
[relaton-iso] ("ISO 19115") fetching...
|
|
75
|
-
[relaton-iso] ("ISO 19115")
|
|
96
|
+
[relaton-iso] ("ISO 19115") fetching from ISO...
|
|
97
|
+
[relaton-iso] ("ISO 19115:2003") Found exact match.
|
|
76
98
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c828d3180
|
|
77
99
|
...
|
|
78
100
|
|
|
@@ -85,8 +107,8 @@ item.docidentifier[0].id
|
|
|
85
107
|
[source,ruby]
|
|
86
108
|
----
|
|
87
109
|
item = RelatonIso::IsoBibliography.get "ISO 19115"
|
|
88
|
-
[relaton-iso] ("ISO 19115") fetching...
|
|
89
|
-
[relaton-iso] ("ISO 19115")
|
|
110
|
+
[relaton-iso] ("ISO 19115") fetching from ISO...
|
|
111
|
+
[relaton-iso] ("ISO 19115") Found ("ISO 19115:2003").
|
|
90
112
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c830275a8
|
|
91
113
|
...
|
|
92
114
|
|
|
@@ -94,18 +116,18 @@ item.docidentifier[0].id
|
|
|
94
116
|
=> "ISO 19115:2003"
|
|
95
117
|
----
|
|
96
118
|
|
|
97
|
-
=== Fetch part document
|
|
119
|
+
=== Fetch a part document
|
|
98
120
|
|
|
99
121
|
[source,ruby]
|
|
100
122
|
----
|
|
101
123
|
item = RelatonIso::IsoBibliography.get "ISO 19115-1"
|
|
102
|
-
[relaton-iso] ("ISO 19115-1") fetching...
|
|
103
|
-
[relaton-iso] ("ISO 19115-1")
|
|
124
|
+
[relaton-iso] ("ISO 19115-1") fetching from ISO...
|
|
125
|
+
[relaton-iso] ("ISO 19115-1") Found ("ISO 19115-1:2014").
|
|
104
126
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c83408af0
|
|
105
127
|
...
|
|
106
128
|
|
|
107
129
|
item.docidentifier[0].id
|
|
108
|
-
=> "ISO 19115-1
|
|
130
|
+
=> "ISO 19115-1"
|
|
109
131
|
----
|
|
110
132
|
|
|
111
133
|
=== Fetch all-parts document
|
|
@@ -113,14 +135,14 @@ item.docidentifier[0].id
|
|
|
113
135
|
[source,ruby]
|
|
114
136
|
----
|
|
115
137
|
item = RelatonIso::IsoBibliography.get "ISO 19115 (all parts)"
|
|
116
|
-
[relaton-iso] ("ISO 19115")
|
|
117
|
-
[relaton-iso] ("ISO 19115")
|
|
138
|
+
[relaton-iso] ("ISO 19115") Fetching from ISO...
|
|
139
|
+
[relaton-iso] ("ISO 19115") Found exact match.
|
|
118
140
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8ca216e118
|
|
119
141
|
...
|
|
120
142
|
|
|
121
143
|
item = RelatonIso::IsoBibliography.get "ISO 19115", nil, all_parts: true
|
|
122
|
-
[relaton-iso] ("ISO 19115")
|
|
123
|
-
[relaton-iso] ("ISO 19115")
|
|
144
|
+
[relaton-iso] ("ISO 19115") Fetching from ISO...
|
|
145
|
+
[relaton-iso] ("ISO 19115") Found exact match.
|
|
124
146
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c830f3d38
|
|
125
147
|
...
|
|
126
148
|
|
|
@@ -128,13 +150,13 @@ item.docidentifier[0].id
|
|
|
128
150
|
=> "ISO 19115 (all parts)"
|
|
129
151
|
|
|
130
152
|
item = RelatonIso::IsoBibliography.get "ISO 19115-1 (all parts)"
|
|
131
|
-
[relaton-iso] ("ISO 19115
|
|
132
|
-
[relaton-iso] ("ISO 19115
|
|
153
|
+
[relaton-iso] ("ISO 19115") Fetching from ISO...
|
|
154
|
+
[relaton-iso] ("ISO 19115") Found exact match.
|
|
133
155
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c8290e5a0
|
|
134
156
|
|
|
135
157
|
item = RelatonIso::IsoBibliography.get "ISO 19115-1", nil, all_parts: true
|
|
136
|
-
[relaton-iso] ("ISO 19115
|
|
137
|
-
[relaton-iso] ("ISO 19115
|
|
158
|
+
[relaton-iso] ("ISO 19115") Fetching from ISO...
|
|
159
|
+
[relaton-iso] ("ISO 19115") Found exact match.
|
|
138
160
|
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007f8c925355b8
|
|
139
161
|
...
|
|
140
162
|
|
|
@@ -144,7 +166,7 @@ item.docidentifier[0].id
|
|
|
144
166
|
|
|
145
167
|
=== Search for ISO/IEC Directives
|
|
146
168
|
|
|
147
|
-
The ISO/IEC
|
|
169
|
+
The ISO/IEC Directives are stored in a static cache in a relaton gem. It needs to use the relaton gem to fetch the ISO/IEC Directives. The following references are allowed to fetch:
|
|
148
170
|
|
|
149
171
|
- ISO/IEC DIR 1 - Procedures for the technical work
|
|
150
172
|
- ISO/IEC DIR 1 IEC SUP - Procedures for the technical work – Procedures specific to IEC
|
|
@@ -164,48 +186,30 @@ Possible options:
|
|
|
164
186
|
[source,ruby]
|
|
165
187
|
----
|
|
166
188
|
item.to_xml
|
|
167
|
-
"<bibitem id="
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
<title type="title-intro" format="text/plain" language="fr" script="Latn">Information géographique</title>
|
|
174
|
-
<title type="title-main" format="text/plain" language="fr" script="Latn">Métadonnées</title>
|
|
175
|
-
<title type="title-part" format="text/plain" language="fr" script="Latn">Partie 3: Mise en oeuvre par des schémas XML</title>
|
|
176
|
-
<title type="main" format="text/plain" language="fr" script="Latn">Information géographique - Métadonnées - Partie 3: Mise en oeuvre par des schémas XML</title>
|
|
177
|
-
<uri type="src">https://www.iso.org/standard/32579.html</uri>
|
|
178
|
-
<uri type="obp">https://www.iso.org/obp/ui/#!iso:std:32579:en</uri>
|
|
179
|
-
<uri type="rss">https://www.iso.org/contents/data/standard/03/25/32579.detail.rss</uri>
|
|
180
|
-
<docidentifier type="ISO">ISO/TS 19115-3:2016</docidentifier>
|
|
181
|
-
<docidentifier type="URN">urn:iso:std:iso-ts:ts:19115:-3:stage-90.92:ed-1:en,fr</docidentifier>
|
|
182
|
-
...
|
|
183
|
-
</bibitem>"
|
|
189
|
+
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.2.1">
|
|
190
|
+
<fetched>2022-12-04</fetched>
|
|
191
|
+
<title type="title-intro" format="text/plain" language="en" script="Latn">Geographic information</title>
|
|
192
|
+
<title type="title-main" format="text/plain" language="en" script="Latn">Metadata</title>
|
|
193
|
+
...
|
|
194
|
+
</bibitem>"
|
|
184
195
|
|
|
185
196
|
item.to_xml bibdata: true
|
|
186
|
-
=>"<bibdata type="standard">
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
<text>IT applications in science</text>
|
|
196
|
-
</ics>
|
|
197
|
-
<structuredidentifier type="ISO">
|
|
198
|
-
<project-number>ISO/TS 19115</project-number>
|
|
199
|
-
</structuredidentifier>
|
|
200
|
-
</ext>
|
|
201
|
-
</bibdata>"
|
|
197
|
+
=> "<bibdata type="standard" schema-version="v1.2.1">
|
|
198
|
+
<fetched>2022-12-04</fetched>
|
|
199
|
+
<title type="title-intro" format="text/plain" language="en" script="Latn">Geographic information</title>
|
|
200
|
+
...
|
|
201
|
+
<ext schema-version="v1.0.0">
|
|
202
|
+
<doctype>international-standard</doctype>
|
|
203
|
+
...
|
|
204
|
+
</ext>
|
|
205
|
+
</bibdata>"
|
|
202
206
|
|
|
203
207
|
item.to_xml note: [{ text: "Note", type: "note" }]
|
|
204
|
-
=>"<bibitem id="ISO19115-1-2014">
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
</bibitem>"
|
|
208
|
+
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.2.1">
|
|
209
|
+
...
|
|
210
|
+
<note format="text/plain" type="note">Note</note>
|
|
211
|
+
...
|
|
212
|
+
</bibitem>"
|
|
209
213
|
----
|
|
210
214
|
|
|
211
215
|
=== Get specific language
|
|
@@ -213,47 +217,51 @@ item.to_xml note: [{ text: "Note", type: "note" }]
|
|
|
213
217
|
[source,ruby]
|
|
214
218
|
----
|
|
215
219
|
item.title lang: 'en'
|
|
216
|
-
=>
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
@
|
|
232
|
-
@type="main">]
|
|
220
|
+
=> #<RelatonBib::TypedTitleStringCollection:0x00007fa8b7f47c90
|
|
221
|
+
@array=
|
|
222
|
+
[#<RelatonBib::TypedTitleString:0x00007fa8b7be8a40
|
|
223
|
+
@title=#<RelatonBib::FormattedString:0x00007fa8b7be87c0 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
|
224
|
+
@type="title-intro">,
|
|
225
|
+
#<RelatonBib::TypedTitleString:0x00007fa8b7be84a0
|
|
226
|
+
@title=#<RelatonBib::FormattedString:0x00007fa8b7be83d8 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
|
|
227
|
+
@type="title-main">,
|
|
228
|
+
#<RelatonBib::TypedTitleString:0x00007fa8b7be8130
|
|
229
|
+
@title=
|
|
230
|
+
#<RelatonBib::FormattedString:0x00007fa8b7be8018
|
|
231
|
+
@content="Geographic information – Metadata",
|
|
232
|
+
@format="text/plain",
|
|
233
|
+
@language=["en"],
|
|
234
|
+
@script=["Latn"]>,
|
|
235
|
+
@type="main">]>
|
|
233
236
|
|
|
234
237
|
item.title lang: 'fr'
|
|
235
|
-
=>
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
@
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
238
|
+
=> #<RelatonBib::TypedTitleStringCollection:0x00007fa8b7bcb4b8
|
|
239
|
+
@array=
|
|
240
|
+
[#<RelatonBib::TypedTitleString:0x00007fa8b7be3ea0
|
|
241
|
+
@title=#<RelatonBib::FormattedString:0x00007fa8b7be3dd8 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
|
242
|
+
@type="title-intro">,
|
|
243
|
+
#<RelatonBib::TypedTitleString:0x00007fa8b7be3ba8
|
|
244
|
+
@title=#<RelatonBib::FormattedString:0x00007fa8b7be3b58 @content="Métadonnées", @format="text/plain", @language=["fr"], @script=["Latn"]>,
|
|
245
|
+
@type="title-main">,
|
|
246
|
+
#<RelatonBib::TypedTitleString:0x00007fa8b7be38d8
|
|
247
|
+
@title=
|
|
248
|
+
#<RelatonBib::FormattedString:0x00007fa8b7be3860
|
|
249
|
+
@content="Information géographique – Métadonnées",
|
|
250
|
+
@format="text/plain",
|
|
251
|
+
@language=["fr"],
|
|
252
|
+
@script=["Latn"]>,
|
|
253
|
+
@type="main">]>
|
|
254
|
+
|
|
255
|
+
item = RelatonIso::IsoBibliography.get "ISO 19115:2003"
|
|
256
|
+
[relaton-iso] ("ISO 19115:2003") Fetching from ISO...
|
|
257
|
+
[relaton-iso] ("ISO 19115:2003") Found exact match.
|
|
258
|
+
=> #<RelatonIsoBib::IsoBibliographicItem:0x00007fa8870b69e0
|
|
259
|
+
|
|
260
|
+
item.abstract lang: 'en'
|
|
261
|
+
item.abstract lang: 'en'
|
|
262
|
+
=> #<RelatonBib::FormattedString:0x00007fa8870b4f78
|
|
255
263
|
@content=
|
|
256
|
-
"ISO
|
|
264
|
+
"ISO 19115:2003 defines the schema required for describing geographic information ...",
|
|
257
265
|
@format="text/plain",
|
|
258
266
|
@language=["en"],
|
|
259
267
|
@script=["Latn"]>
|
|
@@ -266,9 +274,16 @@ Each ISO document has `src` type link and optional `obp`, `rss`, and `pub` link
|
|
|
266
274
|
[source,ruby]
|
|
267
275
|
----
|
|
268
276
|
item.link
|
|
269
|
-
=> [#<RelatonBib::TypedUri:
|
|
270
|
-
|
|
271
|
-
|
|
277
|
+
=> [#<RelatonBib::TypedUri:0x00007fa8870ac5a8
|
|
278
|
+
@content=#<Addressable::URI:0xcc6514 URI:https://www.iso.org/standard/26020.html>,
|
|
279
|
+
@language=nil,
|
|
280
|
+
@script=nil,
|
|
281
|
+
@type="src">,
|
|
282
|
+
#<RelatonBib::TypedUri:0x00007fa8870a7490
|
|
283
|
+
@content=#<Addressable::URI:0xcc6528 URI:https://www.iso.org/contents/data/standard/02/60/26020.detail.rss>,
|
|
284
|
+
@language=nil,
|
|
285
|
+
@script=nil,
|
|
286
|
+
@type="rss">]
|
|
272
287
|
----
|
|
273
288
|
|
|
274
289
|
== Development
|
|
@@ -42,7 +42,7 @@ module RelatonIso
|
|
|
42
42
|
#
|
|
43
43
|
# @return [Array<RelatonIso::Hit]
|
|
44
44
|
#
|
|
45
|
-
def fetch_github # rubocop:disable Metrics/AbcSize
|
|
45
|
+
def fetch_github # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
46
46
|
ref = text.gsub(/[\s\/]/, "_").upcase
|
|
47
47
|
url = "https://raw.githubusercontent.com/relaton/relaton-data-iso/main/data/#{ref}.yaml"
|
|
48
48
|
resp = Net::HTTP.get_response URI(url)
|
|
@@ -50,6 +50,7 @@ module RelatonIso
|
|
|
50
50
|
|
|
51
51
|
hash = YAML.safe_load resp.body
|
|
52
52
|
bib_hash = RelatonIsoBib::HashConverter.hash_to_bib hash
|
|
53
|
+
bib_hash[:fetched] = Date.today.to_s
|
|
53
54
|
bib = RelatonIsoBib::IsoBibliographicItem.new(**bib_hash)
|
|
54
55
|
hit = Hit.new({ title: text }, self)
|
|
55
56
|
hit.fetch = bib
|
|
@@ -66,12 +66,12 @@ module RelatonIso
|
|
|
66
66
|
warn "[relaton-iso] (\"#{query_pubid}\") Found exact match."
|
|
67
67
|
elsif matches_base?(query_pubid, response_pubid)
|
|
68
68
|
warn "[relaton-iso] (\"#{query_pubid}\") " \
|
|
69
|
-
|
|
69
|
+
"Found (\"#{response_pubid}\")."
|
|
70
70
|
elsif matches_base?(query_pubid, response_pubid, any_types_stages: true)
|
|
71
71
|
warn "[relaton-iso] (\"#{query_pubid}\") TIP: " \
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
"Found with different type/stage, " \
|
|
73
|
+
"please amend to (\"#{response_pubid}\")."
|
|
74
|
+
else
|
|
75
75
|
# when there are all parts
|
|
76
76
|
warn "[relaton-iso] (\"#{query_pubid}\") Found (\"#{response_pubid}\")."
|
|
77
77
|
end
|
|
@@ -118,9 +118,8 @@ module RelatonIso
|
|
|
118
118
|
# filter by year
|
|
119
119
|
hits = hit_collection.select do |hit|
|
|
120
120
|
if (hit.pubid.base.nil? && hit.pubid.year.to_s == year.to_s) ||
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
elsif (!hit.pubid.base.nil? && hit.pubid.year.to_s == year.to_s)
|
|
121
|
+
(!hit.pubid.base.nil? && hit.pubid.base.year.to_s == year.to_s) ||
|
|
122
|
+
(!hit.pubid.base.nil? && hit.pubid.year.to_s == year.to_s)
|
|
124
123
|
true
|
|
125
124
|
elsif hit.pubid.year.nil? && hit.hit[:year].to_s == year
|
|
126
125
|
hit.pubid.year = year
|
|
@@ -156,8 +155,8 @@ module RelatonIso
|
|
|
156
155
|
|
|
157
156
|
unless %w(TS TR PAS Guide).include?(query_pubid.type)
|
|
158
157
|
warn "[relaton-iso] (\"#{query_pubid}\") TIP: " \
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
"If the document is not an International Standard, use its " \
|
|
159
|
+
"deliverable type abbreviation (TS, TR, PAS, Guide)."
|
|
161
160
|
end
|
|
162
161
|
|
|
163
162
|
nil
|
|
@@ -167,8 +166,8 @@ module RelatonIso
|
|
|
167
166
|
# @param missed_years [Array<String>]
|
|
168
167
|
def warn_missing_years(pubid, missed_years)
|
|
169
168
|
warn "[relaton-iso] (\"#{pubid}\") TIP: " \
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
"No match for edition year #{pubid.year}, " \
|
|
170
|
+
"but matches exist for #{missed_years.uniq.join(', ')}."
|
|
172
171
|
end
|
|
173
172
|
|
|
174
173
|
# Search for hits using ISO/IEC prefix.
|
|
@@ -176,16 +175,12 @@ module RelatonIso
|
|
|
176
175
|
# @param old_pubid [Pubid::Iso::Identifier] reference with ISO prefix
|
|
177
176
|
# @param opts [Hash]
|
|
178
177
|
# @return [Array<RelatonIso::Hit>]
|
|
179
|
-
def retry_isoiec_prefix(old_pubid, opts)
|
|
180
|
-
return nil unless
|
|
181
|
-
old_pubid.copublisher.nil? &&
|
|
182
|
-
old_pubid.publisher == "ISO"
|
|
183
|
-
)
|
|
178
|
+
def retry_isoiec_prefix(old_pubid, opts) # rubocop:disable Metrics/MethodLength
|
|
179
|
+
return nil unless old_pubid.copublisher.nil? && old_pubid.publisher == "ISO"
|
|
184
180
|
|
|
185
181
|
pubid = old_pubid.dup
|
|
186
182
|
pubid.copublisher = "IEC"
|
|
187
|
-
warn "[relaton-iso] (\"#{old_pubid}\") Not found,
|
|
188
|
-
"trying with ISO/IEC prefix (\"#{pubid}\")..."
|
|
183
|
+
warn "[relaton-iso] (\"#{old_pubid}\") Not found, trying with ISO/IEC prefix (\"#{pubid}\")..."
|
|
189
184
|
resp_isoiec = isobib_search_filter(pubid, opts)
|
|
190
185
|
|
|
191
186
|
if resp_isoiec[:hits].empty?
|
|
@@ -193,9 +188,8 @@ module RelatonIso
|
|
|
193
188
|
return nil
|
|
194
189
|
end
|
|
195
190
|
|
|
196
|
-
warn "[relaton-iso] (\"#{pubid}\") TIP: " \
|
|
197
|
-
|
|
198
|
-
"please amend to (\"#{pubid}\")."
|
|
191
|
+
warn "[relaton-iso] (\"#{pubid}\") TIP: Found with ISO/IEC prefix, " \
|
|
192
|
+
"please amend to (\"#{pubid}\")."
|
|
199
193
|
|
|
200
194
|
resp_isoiec
|
|
201
195
|
end
|
|
@@ -219,12 +213,14 @@ module RelatonIso
|
|
|
219
213
|
# filter only matching hits
|
|
220
214
|
res = filter_hits hit_collection, query_pubid, all_parts: opts[:all_parts]
|
|
221
215
|
return res unless res[:hits].empty?
|
|
216
|
+
|
|
222
217
|
missed_years += res[:missed_years]
|
|
223
218
|
|
|
224
219
|
# lookup for documents with stages when no match without stage
|
|
225
220
|
res = filter_hits hit_collection, query_pubid,
|
|
226
221
|
all_parts: opts[:all_parts], any_types_stages: true
|
|
227
222
|
return res unless res[:hits].empty?
|
|
223
|
+
|
|
228
224
|
missed_years += res[:missed_years]
|
|
229
225
|
|
|
230
226
|
if missed_years.any?
|
|
@@ -251,7 +247,6 @@ module RelatonIso
|
|
|
251
247
|
|
|
252
248
|
filter_hits_by_year(result, query_pubid.year)
|
|
253
249
|
end
|
|
254
|
-
|
|
255
250
|
end
|
|
256
251
|
end
|
|
257
252
|
end
|
data/lib/relaton_iso/version.rb
CHANGED
data/relaton_iso.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: byebug
|
|
@@ -198,14 +198,14 @@ dependencies:
|
|
|
198
198
|
requirements:
|
|
199
199
|
- - "~>"
|
|
200
200
|
- !ruby/object:Gem::Version
|
|
201
|
-
version: 1.
|
|
201
|
+
version: 1.14.0
|
|
202
202
|
type: :runtime
|
|
203
203
|
prerelease: false
|
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements:
|
|
206
206
|
- - "~>"
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
|
-
version: 1.
|
|
208
|
+
version: 1.14.0
|
|
209
209
|
description: 'RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem
|
|
210
210
|
model'
|
|
211
211
|
email:
|