relaton 3.0.3 → 3.0.4
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/lib/relaton/3gpp/data_fetcher.rb +3 -2
- data/lib/relaton/bipm/data_outcomes_parser.rb +2 -1
- data/lib/relaton/bipm/si_brochure_parser.rb +3 -2
- data/lib/relaton/core/data_fetcher.rb +3 -2
- data/lib/relaton/core/processor.rb +29 -0
- data/lib/relaton/db/CLAUDE.md +14 -2
- data/lib/relaton/db/cache.rb +5 -2
- data/lib/relaton/db.rb +7 -3
- data/lib/relaton/ecma/processor.rb +8 -0
- data/lib/relaton/equivalence.rb +2 -2
- data/lib/relaton/gb/scraper.rb +2 -2
- data/lib/relaton/ieee/data_fetcher.rb +2 -1
- data/lib/relaton/iho/processor.rb +6 -0
- data/lib/relaton/index/file_io.rb +9 -8
- data/lib/relaton/index/shard_source.rb +3 -2
- data/lib/relaton/iso/hit_collection.rb +20 -3
- data/lib/relaton/jcgm/meetings_parser.rb +2 -2
- data/lib/relaton/nist/cswp.rb +2 -2
- data/lib/relaton/nist/data_fetcher.rb +3 -2
- data/lib/relaton/sdo/store.rb +3 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/xsf/hit.rb +2 -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: f6cef1665e29f9d4a6e8ab48528253675e5b901399666138306c2be69c0d1b6e
|
|
4
|
+
data.tar.gz: e4eef10cab8373db1d911a4b68342b35c1bb335c15f986d24697f286e83d9a96
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41185be7ff82e3b45667eb33380fb3eee8e548e3ea24039d8743c5ed50b2fcc1b1c252536f87a1d6b0c4821e41e17b08a45e861af1d6886a8abe9df287a800a6
|
|
7
|
+
data.tar.gz: 3235473497b828e0f5d8890a59b6548994b2ab113d665f010d24e1970c6b24eaa398b298d7f83ba3b770153c558c712059ff5147b5f39d86b61ad5e35312d930
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
require "fileutils"
|
|
2
3
|
require "net/http"
|
|
3
4
|
require "uri"
|
|
@@ -64,7 +65,7 @@ module Relaton
|
|
|
64
65
|
# @return [String, nil] file name
|
|
65
66
|
#
|
|
66
67
|
def get_file(renewal) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
|
67
|
-
@current =
|
|
68
|
+
@current = Yeptris::Psych.load_file CURRENT if File.exist? CURRENT
|
|
68
69
|
@current ||= {}
|
|
69
70
|
uri = URI(CSV_URL)
|
|
70
71
|
n = 0
|
|
@@ -183,7 +184,7 @@ module Relaton
|
|
|
183
184
|
# @return [Relaton3gpp::BibliographicItem, nil] merged bibliographic item or nil if no merge has been done
|
|
184
185
|
#
|
|
185
186
|
def merge_duplication(bib, file)
|
|
186
|
-
hash =
|
|
187
|
+
hash = Yeptris::Psych.load_file file
|
|
187
188
|
existed = Item.from_hash hash
|
|
188
189
|
changed = update_source? bib, existed
|
|
189
190
|
bib1, bib2, chng = transposed_relation bib, existed
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
module Relaton::Bipm
|
|
2
3
|
class DataOutcomesParser
|
|
3
4
|
SHORTTYPE = {
|
|
@@ -130,7 +131,7 @@ module Relaton::Bipm
|
|
|
130
131
|
fr_file = en_file.sub "en", "fr"
|
|
131
132
|
[en_file, fr_file].map do |file|
|
|
132
133
|
if File.exist? file
|
|
133
|
-
data =
|
|
134
|
+
data = Yeptris::Psych.safe_load(File.read(file, encoding: "UTF-8"))
|
|
134
135
|
path = file
|
|
135
136
|
end
|
|
136
137
|
[path, data]
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
require "moxml"
|
|
2
3
|
|
|
3
4
|
module Relaton::Bipm
|
|
@@ -60,8 +61,8 @@ module Relaton::Bipm
|
|
|
60
61
|
warn_duplicate = false
|
|
61
62
|
item2 = Item.from_yaml File.read(outfile, encoding: "UTF-8")
|
|
62
63
|
fix_si_brochure_id item2
|
|
63
|
-
hash1 =
|
|
64
|
-
hash2 =
|
|
64
|
+
hash1 = Yeptris::Psych.safe_load item1.to_yaml
|
|
65
|
+
hash2 = Yeptris::Psych.safe_load item2.to_yaml
|
|
65
66
|
Item.from_yaml deep_merge(hash1, hash2).to_yaml
|
|
66
67
|
else
|
|
67
68
|
warn_duplicate = true
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
require "yeptris"
|
|
2
3
|
require "fileutils"
|
|
3
4
|
|
|
@@ -121,7 +122,7 @@ module Relaton
|
|
|
121
122
|
kept = ledger.merge(ledger_new).select do |_, row|
|
|
122
123
|
row.is_a?(Hash) && row["file"] && @written.include?(row["file"])
|
|
123
124
|
end
|
|
124
|
-
File.write ledger_path,
|
|
125
|
+
File.write ledger_path, Yeptris::Psych.dump(kept), encoding: "UTF-8"
|
|
125
126
|
@ledger = kept
|
|
126
127
|
end
|
|
127
128
|
|
|
@@ -349,7 +350,7 @@ module Relaton
|
|
|
349
350
|
|
|
350
351
|
def ledger
|
|
351
352
|
@ledger ||= if File.exist?(ledger_path)
|
|
352
|
-
|
|
353
|
+
Yeptris::Psych.safe_load_file(ledger_path) || {}
|
|
353
354
|
else
|
|
354
355
|
{}
|
|
355
356
|
end
|
|
@@ -134,6 +134,21 @@ module Relaton
|
|
|
134
134
|
copy
|
|
135
135
|
end
|
|
136
136
|
|
|
137
|
+
# A copy of `pubid` with each given component the parse leaves nil, for
|
|
138
|
+
# #item_cache_key. `pubid` itself when there is nothing to add.
|
|
139
|
+
#
|
|
140
|
+
# @param pubid [Pubid::Identifier]
|
|
141
|
+
# @param values [Hash{Symbol => String, nil}]
|
|
142
|
+
# @return [Pubid::Identifier]
|
|
143
|
+
def with_components(pubid, **values)
|
|
144
|
+
values = values.select { |attr, value| value && pubid.public_send(attr).nil? }
|
|
145
|
+
return pubid if values.empty?
|
|
146
|
+
|
|
147
|
+
copy = pubid.class.from_hash pubid.to_hash
|
|
148
|
+
values.each { |attr, value| copy.public_send "#{attr}=", value }
|
|
149
|
+
copy
|
|
150
|
+
end
|
|
151
|
+
|
|
137
152
|
# The cache key for a query: the parsed pubid with the `year` and
|
|
138
153
|
# `all_parts` options folded in. The publication date range is not part
|
|
139
154
|
# of the identity, so it never enters the key.
|
|
@@ -153,6 +168,20 @@ module Relaton
|
|
|
153
168
|
pubid
|
|
154
169
|
end
|
|
155
170
|
|
|
171
|
+
# The cache key of a fetched document: its primary docidentifier as
|
|
172
|
+
# parsed (`pubid`), plus the components that docid omits by design and
|
|
173
|
+
# the item keeps elsewhere. A flavor whose printed docid drops the
|
|
174
|
+
# edition (IHO `B-12`, ECMA `ECMA-262`) overrides this, or every
|
|
175
|
+
# edition gets one key and one cache file (relaton#408). The same set
|
|
176
|
+
# as relaton-cli's `MachineIndex::REFINABLE_KEYS`.
|
|
177
|
+
#
|
|
178
|
+
# @param pubid [Pubid::Identifier] the docid's parse; not mutated
|
|
179
|
+
# @param _item [Relaton::Bib::ItemData] the fetched document
|
|
180
|
+
# @return [Pubid::Identifier]
|
|
181
|
+
def item_cache_key(pubid, _item)
|
|
182
|
+
pubid
|
|
183
|
+
end
|
|
184
|
+
|
|
156
185
|
def initialize
|
|
157
186
|
raise "This is an abstract class!"
|
|
158
187
|
end
|
data/lib/relaton/db/CLAUDE.md
CHANGED
|
@@ -223,6 +223,17 @@ relaton#189 item 2 / relaton#204. Two lutaml-store `FileSystem` stores under
|
|
|
223
223
|
both naming the same file. There are no redirect entries. A document is
|
|
224
224
|
deleted with the last row that points to it; a row whose document is gone is
|
|
225
225
|
a miss.
|
|
226
|
+
- **The item row's key must tell editions apart (relaton#408).** `Db#item_key`
|
|
227
|
+
parses the primary docidentifier and passes it through
|
|
228
|
+
`Core::Processor#item_cache_key(pubid, item)`. A flavor whose printed docid
|
|
229
|
+
omits the edition by design overrides the hook to add it from the item:
|
|
230
|
+
IHO adds `version` from `edition` (`IHO B-12` → `IHO B-12 3.0.0`), ECMA adds
|
|
231
|
+
`edition` and the `volume` extent (`ECMA-262` → `ECMA-262 ed16`), through
|
|
232
|
+
`#with_components`, which fills only components the parse leaves nil, on a
|
|
233
|
+
copy. Without it every edition got one item key and one file, and a fetch of
|
|
234
|
+
`IHO B-12 2.0.3` overwrote the file the `IHO B-12 3.0.0` query row named. A
|
|
235
|
+
cache with such a file is dropped by the next `Relaton::VERSION` bump
|
|
236
|
+
(`grammar_hash`), so no separate cache-version bump was made.
|
|
226
237
|
|
|
227
238
|
Matching: the **exact** row first (canonical `to_hash`, not pubid `==`, which
|
|
228
239
|
is false after a `from_hash` round trip for some flavors, e.g. UN). Only a
|
|
@@ -233,8 +244,9 @@ still applies and it never answers with another query's year-stripped copy.
|
|
|
233
244
|
`ISO 19115:2003 === ISO 19115-1:2003` (and the same for IEC, BSI, JIS, GB).
|
|
234
245
|
`Cache#subset_of?` therefore also requires that every component the row adds
|
|
235
246
|
(at any depth) is allowed: only a language for the dated fallback
|
|
236
|
-
(`LANGUAGE_COMPONENTS`), a year/date/month
|
|
237
|
-
`
|
|
247
|
+
(`LANGUAGE_COMPONENTS`), a year/date/month, an edition/version (the
|
|
248
|
+
`item_cache_key` components; not a volume, which names another document) or a
|
|
249
|
+
language for the date-range `candidates` (`EDITION_COMPONENTS`). A row with no `root.number` (DOI, ISBN)
|
|
238
250
|
goes to one of 256 digest buckets (`<flavor>/~<hex>`).
|
|
239
251
|
|
|
240
252
|
Expiry (`Cache#valid_row?`): an undated row, and **every** `not_found` row,
|
data/lib/relaton/db/cache.rb
CHANGED
|
@@ -36,8 +36,11 @@ module Relaton
|
|
|
36
36
|
# reads an omitted `part` as "any part" (`ISO 19115:2003 ===
|
|
37
37
|
# ISO 19115-1:2003`), which names another document.
|
|
38
38
|
LANGUAGE_COMPONENTS = %w[language languages].freeze
|
|
39
|
-
# What a row may add to a key and still be one of its editions.
|
|
40
|
-
|
|
39
|
+
# What a row may add to a key and still be one of its editions. An
|
|
40
|
+
# `edition` or a `version` comes from Core::Processor#item_cache_key
|
|
41
|
+
# (IHO, ECMA; relaton#408). A `volume` names another document.
|
|
42
|
+
EDITION_COMPONENTS =
|
|
43
|
+
(%w[year date month edition version] + LANGUAGE_COMPONENTS).freeze
|
|
41
44
|
|
|
42
45
|
# @return [String]
|
|
43
46
|
attr_reader :dir
|
data/lib/relaton/db.rb
CHANGED
|
@@ -382,13 +382,17 @@ module Relaton
|
|
|
382
382
|
[query, query && processor.cache_key(code, year, opts, query)]
|
|
383
383
|
end
|
|
384
384
|
|
|
385
|
-
# The key of a fetched document, from its primary identifier
|
|
386
|
-
# identifier
|
|
385
|
+
# The key of a fetched document, from its primary identifier and what
|
|
386
|
+
# that identifier omits (Core::Processor#item_cache_key, relaton#408).
|
|
387
|
+
# The identifier is data, so an unparseable one gives no key.
|
|
387
388
|
def item_key(bib, stdclass)
|
|
388
389
|
docid = bib.docidentifier.detect(&:primary) || bib.docidentifier.first
|
|
389
390
|
return unless docid&.content
|
|
390
391
|
|
|
391
|
-
cache_key docid.content, nil, {}, stdclass
|
|
392
|
+
key = cache_key docid.content, nil, {}, stdclass
|
|
393
|
+
return key unless key.is_a? ::Pubid::Identifier
|
|
394
|
+
|
|
395
|
+
@registry[stdclass].item_cache_key key, bib
|
|
392
396
|
rescue ::Pubid::Errors::Error
|
|
393
397
|
nil
|
|
394
398
|
end
|
|
@@ -21,6 +21,14 @@ module Relaton
|
|
|
21
21
|
Bibliography.get(code, date, opts)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
# An ECMA record prints `ECMA-262` with no ` ed<N>`/` vol<N>`, and keeps
|
|
25
|
+
# them in `edition` and in a `volume` extent (relaton#408).
|
|
26
|
+
def item_cache_key(pubid, item)
|
|
27
|
+
volume = item.extent.flat_map(&:locality)
|
|
28
|
+
.detect { |l| l.type == "volume" }&.reference_from
|
|
29
|
+
with_components pubid, edition: item.edition&.content, volume: volume
|
|
30
|
+
end
|
|
31
|
+
|
|
24
32
|
#
|
|
25
33
|
# Fetch all the documents from a source
|
|
26
34
|
#
|
data/lib/relaton/equivalence.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "
|
|
1
|
+
require "yeptris/psych"
|
|
2
2
|
|
|
3
3
|
module Relaton
|
|
4
4
|
# Cross-SDO equivalence as data: chain patterns and explicit equivalences
|
|
@@ -23,7 +23,7 @@ module Relaton
|
|
|
23
23
|
else
|
|
24
24
|
[path]
|
|
25
25
|
end
|
|
26
|
-
files.each { |f| tables <<
|
|
26
|
+
files.each { |f| tables << Yeptris::Psych.safe_load_file(f, aliases: true) }
|
|
27
27
|
tables
|
|
28
28
|
end
|
|
29
29
|
|
data/lib/relaton/gb/scraper.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
# encoding: UTF-8
|
|
2
3
|
# frozen_string_literal: true
|
|
3
4
|
|
|
4
|
-
require "yaml"
|
|
5
5
|
require "gb_agencies"
|
|
6
6
|
|
|
7
7
|
module Relaton
|
|
@@ -132,7 +132,7 @@ module Relaton
|
|
|
132
132
|
# @param pref [String]
|
|
133
133
|
# @return [Hash{String=>String}]
|
|
134
134
|
def prefix(pref)
|
|
135
|
-
@prefixes ||=
|
|
135
|
+
@prefixes ||= Yeptris::Psych.load_file File.join(__dir__, "yaml/prefixes.yaml")
|
|
136
136
|
@prefixes[pref]
|
|
137
137
|
end
|
|
138
138
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
require "etc"
|
|
2
3
|
require "zip"
|
|
3
4
|
require_relative "../ieee"
|
|
@@ -77,7 +78,7 @@ module Relaton
|
|
|
77
78
|
# @param file [String]
|
|
78
79
|
# @return [String, nil]
|
|
79
80
|
def primary_docid(file)
|
|
80
|
-
yaml =
|
|
81
|
+
yaml = Yeptris::Psych.safe_load(File.read(file, encoding: "UTF-8"),
|
|
81
82
|
permitted_classes: [Symbol, Date, Time])
|
|
82
83
|
id = yaml && yaml["docidentifier"]&.find do |i|
|
|
83
84
|
i["type"] == "IEEE" && i["primary"] == true && i["trademark"].nil?
|
|
@@ -25,6 +25,12 @@ module Relaton
|
|
|
25
25
|
Bibliography.get(code, date, opts)
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
+
# An IHO record prints `B-12` and keeps its edition in `edition`, so
|
|
29
|
+
# the edition goes on the key as the version (relaton#408).
|
|
30
|
+
def item_cache_key(pubid, item)
|
|
31
|
+
with_components pubid, version: item.edition&.content
|
|
32
|
+
end
|
|
33
|
+
|
|
28
34
|
# @param xml [String]
|
|
29
35
|
# @return [Relaton::Iho::ItemData]
|
|
30
36
|
def from_xml(xml)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
module Relaton
|
|
2
3
|
module Index
|
|
3
4
|
#
|
|
@@ -219,12 +220,12 @@ module Relaton
|
|
|
219
220
|
end
|
|
220
221
|
|
|
221
222
|
def load_index(yaml, save = false)
|
|
222
|
-
index =
|
|
223
|
+
index = Yeptris::Psych.safe_load(yaml, permitted_classes: [Symbol])
|
|
223
224
|
save index if save
|
|
224
225
|
return deserialize_pubid(index) if check_format(index)
|
|
225
226
|
|
|
226
227
|
report_invalid_index(save, "Wrong structure of")
|
|
227
|
-
rescue Psych::SyntaxError
|
|
228
|
+
rescue Yeptris::Psych::SyntaxError
|
|
228
229
|
report_invalid_index(save, "YAML parsing error when reading")
|
|
229
230
|
rescue InvalidIndexError
|
|
230
231
|
report_invalid_index(save, "Wrong structure of")
|
|
@@ -430,7 +431,7 @@ module Relaton
|
|
|
430
431
|
end
|
|
431
432
|
yaml = yaml.read unless yaml.is_a?(String)
|
|
432
433
|
Util.info "Downloaded index from `#{url}` for sqlite materialization", progname
|
|
433
|
-
raw =
|
|
434
|
+
raw = Yeptris::Psych.safe_load(yaml, permitted_classes: [Symbol])
|
|
434
435
|
return nil unless check_format(raw)
|
|
435
436
|
|
|
436
437
|
Enumerator.new do |y|
|
|
@@ -439,7 +440,7 @@ module Relaton
|
|
|
439
440
|
y << [number, number, r[:id], r[:file]]
|
|
440
441
|
end
|
|
441
442
|
end
|
|
442
|
-
rescue Psych::SyntaxError, SocketError, OpenURI::HTTPError, Errno::ECONNRESET,
|
|
443
|
+
rescue Yeptris::Psych::SyntaxError, SocketError, OpenURI::HTTPError, Errno::ECONNRESET,
|
|
443
444
|
OpenSSL::SSL::SSLError => e
|
|
444
445
|
Util.info "SQLite index build failed (#{e.message}); falling back", progname
|
|
445
446
|
nil
|
|
@@ -512,8 +513,8 @@ module Relaton
|
|
|
512
513
|
return unless yaml
|
|
513
514
|
|
|
514
515
|
begin
|
|
515
|
-
raw =
|
|
516
|
-
rescue Psych::SyntaxError
|
|
516
|
+
raw = Yeptris::Psych.safe_load(yaml, permitted_classes: [Symbol])
|
|
517
|
+
rescue Yeptris::Psych::SyntaxError
|
|
517
518
|
warn_local_index_error("YAML parsing error when reading")
|
|
518
519
|
delete_sidecar
|
|
519
520
|
return [[], []]
|
|
@@ -613,7 +614,7 @@ module Relaton
|
|
|
613
614
|
yaml = zip.entries.first.get_input_stream.read
|
|
614
615
|
end
|
|
615
616
|
Util.info "Downloaded index from `#{url}`", progname
|
|
616
|
-
raw =
|
|
617
|
+
raw = Yeptris::Psych.safe_load(yaml, permitted_classes: [Symbol])
|
|
617
618
|
if check_format(raw)
|
|
618
619
|
save raw
|
|
619
620
|
raw = nil # release the parsed copy; read_raw_file loads the sidecar's
|
|
@@ -622,7 +623,7 @@ module Relaton
|
|
|
622
623
|
warn_remote_index_error "Wrong structure of"
|
|
623
624
|
[[], []]
|
|
624
625
|
end
|
|
625
|
-
rescue Psych::SyntaxError
|
|
626
|
+
rescue Yeptris::Psych::SyntaxError
|
|
626
627
|
warn_remote_index_error "YAML parsing error when reading"
|
|
627
628
|
[[], []]
|
|
628
629
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
require "yeptris"
|
|
2
3
|
require "json"
|
|
3
4
|
require "net/http"
|
|
@@ -152,11 +153,11 @@ module Relaton
|
|
|
152
153
|
yaml = unzip(body)
|
|
153
154
|
raise Error, "empty archive at `#{url(path)}`" unless yaml
|
|
154
155
|
|
|
155
|
-
index =
|
|
156
|
+
index = Yeptris::Psych.safe_load(yaml, permitted_classes: [Symbol])
|
|
156
157
|
raise Error, "wrong structure of `#{url(path)}`" unless @file_io.check_basic_format(index)
|
|
157
158
|
|
|
158
159
|
@file_io.deserialize_pubid(index)
|
|
159
|
-
rescue FileIO::InvalidIndexError, Psych::SyntaxError, Zip::Error, Zlib::Error => e
|
|
160
|
+
rescue FileIO::InvalidIndexError, Yeptris::Psych::SyntaxError, Zip::Error, Zlib::Error => e
|
|
160
161
|
raise Error, "cannot read `#{url(path)}`: #{e.message}"
|
|
161
162
|
end
|
|
162
163
|
end
|
|
@@ -88,13 +88,30 @@ module Relaton
|
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def pubid_match?(pubid)
|
|
91
|
-
match_excludings =
|
|
92
|
-
|
|
91
|
+
match_excludings = base_match_excludings
|
|
92
|
+
unless pubid.typed_stage&.abbr&.include?("DIR")
|
|
93
|
+
match_excludings = match_excludings + [:edition]
|
|
94
|
+
end
|
|
93
95
|
# Only the candidate is built via .create (from the index) and so may
|
|
94
96
|
# carry a compound part; `ref_pubid_no_year` is always a parsed pubid,
|
|
95
97
|
# already split, so it needs no normalization.
|
|
96
98
|
cand = normalize_compound_part(exclude_id_attrs(pubid, *match_excludings))
|
|
97
|
-
cand ==
|
|
99
|
+
cand == ref_excluded(match_excludings)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# The candidate's excludings set varies only by the DIR exception; the
|
|
103
|
+
# reference side is invariant per distinct set. Exclude the ref's
|
|
104
|
+
# (possibly deep) base chain once per set, not once per candidate —
|
|
105
|
+
# on a large vocabulary compile this chain ran per candidate per
|
|
106
|
+
# lookup and dominated the bibitem-resolution phase (relaton#423).
|
|
107
|
+
def base_match_excludings
|
|
108
|
+
@base_match_excludings ||= translate_excludings(excludings) + [:all_parts]
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def ref_excluded(match_excludings)
|
|
112
|
+
@ref_excluded ||= {}
|
|
113
|
+
@ref_excluded[match_excludings] ||=
|
|
114
|
+
exclude_id_attrs(ref_pubid_no_year, *match_excludings)
|
|
98
115
|
end
|
|
99
116
|
|
|
100
117
|
# @TODO TEMP WORKAROUND (pubid 2.x migration): the v1-generated index
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
require "fileutils"
|
|
2
|
-
require "yaml"
|
|
3
3
|
require "date"
|
|
4
4
|
|
|
5
5
|
module Relaton::Jcgm
|
|
@@ -65,7 +65,7 @@ module Relaton::Jcgm
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
def load_yaml(file)
|
|
68
|
-
|
|
68
|
+
Yeptris::Psych.safe_load File.read(file, encoding: "UTF-8"), permitted_classes: [Date, Time]
|
|
69
69
|
end
|
|
70
70
|
|
|
71
71
|
# "JCGM 17th Meeting (2012)" — ordinal via pubid's Meeting.ordinal.
|
data/lib/relaton/nist/cswp.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require "
|
|
1
|
+
require "yeptris/psych"
|
|
2
2
|
|
|
3
3
|
module Relaton
|
|
4
4
|
module Nist
|
|
@@ -24,7 +24,7 @@ module Relaton
|
|
|
24
24
|
class << self
|
|
25
25
|
# @return [Hash] the table as written in cswp.yaml
|
|
26
26
|
def table
|
|
27
|
-
@table ||=
|
|
27
|
+
@table ||= Yeptris::Psych.load_file File.expand_path("cswp.yaml", __dir__)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
#
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "yeptris/psych"
|
|
4
|
+
|
|
4
5
|
require "mechanize"
|
|
5
6
|
require "loc_mods"
|
|
6
7
|
require_relative "../nist"
|
|
@@ -183,7 +184,7 @@ module Relaton
|
|
|
183
184
|
end
|
|
184
185
|
|
|
185
186
|
def series
|
|
186
|
-
@series ||=
|
|
187
|
+
@series ||= Yeptris::Psych.load_file File.expand_path("series.yaml", __dir__)
|
|
187
188
|
end
|
|
188
189
|
end
|
|
189
190
|
end
|
data/lib/relaton/sdo/store.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "yeptris/psych"
|
|
4
|
+
|
|
3
5
|
module Relaton
|
|
4
6
|
module Sdo
|
|
5
7
|
# Singleton registry of organizations, built lazily from the index manifest
|
|
@@ -35,7 +37,7 @@ module Relaton
|
|
|
35
37
|
|
|
36
38
|
def build_index
|
|
37
39
|
yaml = Fetcher.fetch_index
|
|
38
|
-
data = yaml.nil? || yaml.empty? ? {} :
|
|
40
|
+
data = yaml.nil? || yaml.empty? ? {} : Yeptris::Psych.safe_load(yaml)
|
|
39
41
|
# A corrupt/unexpected index (non-mapping YAML) degrades to "no orgs"
|
|
40
42
|
# rather than crashing every lookup with a TypeError.
|
|
41
43
|
organizations = data.is_a?(Hash) ? (data["organizations"] || {}) : {}
|
data/lib/relaton/version.rb
CHANGED
data/lib/relaton/xsf/hit.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require "yeptris/psych"
|
|
1
2
|
module Relaton
|
|
2
3
|
module Xsf
|
|
3
4
|
class Hit < Relaton::Core::Hit
|
|
@@ -6,7 +7,7 @@ module Relaton
|
|
|
6
7
|
|
|
7
8
|
agent = Mechanize.new
|
|
8
9
|
resp = agent.get hit[:url]
|
|
9
|
-
hash =
|
|
10
|
+
hash = Yeptris::Psych.safe_load resp.body
|
|
10
11
|
hash["fetched"] = Date.today.to_s
|
|
11
12
|
@doc = Relaton::Xsf::Item.from_yaml hash.to_yaml
|
|
12
13
|
rescue StandardError => e
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.
|
|
4
|
+
version: 3.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -366,14 +366,14 @@ dependencies:
|
|
|
366
366
|
requirements:
|
|
367
367
|
- - "~>"
|
|
368
368
|
- !ruby/object:Gem::Version
|
|
369
|
-
version: 0.
|
|
369
|
+
version: 0.6.0
|
|
370
370
|
type: :runtime
|
|
371
371
|
prerelease: false
|
|
372
372
|
version_requirements: !ruby/object:Gem::Requirement
|
|
373
373
|
requirements:
|
|
374
374
|
- - "~>"
|
|
375
375
|
- !ruby/object:Gem::Version
|
|
376
|
-
version: 0.
|
|
376
|
+
version: 0.6.0
|
|
377
377
|
- !ruby/object:Gem::Dependency
|
|
378
378
|
name: leptris
|
|
379
379
|
requirement: !ruby/object:Gem::Requirement
|