relaton 3.1.13 → 3.1.15
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/arxiv/parser.rb +1 -1
- data/lib/relaton/bib/converter/asciibib/to_asciibib.rb +2 -2
- data/lib/relaton/bib/converter/bibtex/from_bibtex.rb +1 -1
- data/lib/relaton/bib/converter/bibtex/to_bibtex.rb +1 -1
- data/lib/relaton/bib/converter/bibxml/from_rfcxml.rb +1 -1
- data/lib/relaton/bib/converter/bibxml/to_rfcxml.rb +2 -2
- data/lib/relaton/bib/converter/csl/from_csl.rb +1 -1
- data/lib/relaton/bib/converter/endnote/from_endnote.rb +1 -1
- data/lib/relaton/bib/converter/endnote/to_endnote.rb +1 -1
- data/lib/relaton/bib/converter/ris/from_ris.rb +1 -1
- data/lib/relaton/bib/hash_parser_v1.rb +1 -1
- data/lib/relaton/bib/model/keyword.rb +1 -1
- data/lib/relaton/bib/model/validity.rb +5 -4
- data/lib/relaton/cli/index_site_generator.rb +30 -1
- data/lib/relaton/core/processor.rb +49 -7
- data/lib/relaton/etsi/data_parser.rb +1 -1
- data/lib/relaton/ieee/data_fetcher.rb +21 -0
- data/lib/relaton/ieee/idams_parser.rb +1 -1
- data/lib/relaton/ieee/rawbib_id_parser.rb +80 -4
- data/lib/relaton/ietf/rfc/entry.rb +1 -1
- data/lib/relaton/logger/channels/gh_issue.rb +13 -0
- data/lib/relaton/nist/scraper.rb +1 -1
- data/lib/relaton/omg/scraper.rb +1 -1
- data/lib/relaton/plateau/technical_report_parser.rb +1 -1
- data/lib/relaton/un/parser.rb +1 -1
- data/lib/relaton/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 41a7f64e787b24723fa113edb1e212d200ab7eb382db19d54bc5551623b4d18a
|
|
4
|
+
data.tar.gz: eeabf573cb7643a521426c129e0c1ada4c81ed2cf993dfbaa5bc0bb9b1423b59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6d731f599c71306c4d2f155dcb2974b9aaa690cde0ceedb4dbeaff9be571b4f8df10bec0ba848cb858be2a140a2c77ae1c43249d1f64419b463ebb73a12d5db8
|
|
7
|
+
data.tar.gz: 0f805d43da7544dbb09e14d34f89923fce20b1923562d16aa960a3ce002e87e85680521b64c45331d8b98e29f0c1b72fb28c329804ae5490027cd72d19f44d56
|
data/lib/relaton/arxiv/parser.rb
CHANGED
|
@@ -138,7 +138,7 @@ module Relaton
|
|
|
138
138
|
primary = children("primary_category").first&.[]("term")
|
|
139
139
|
terms = children("category").map { |c| c["term"] }
|
|
140
140
|
([primary] + terms).compact.uniq.map do |term|
|
|
141
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: term))
|
|
141
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: term)])
|
|
142
142
|
end
|
|
143
143
|
end
|
|
144
144
|
|
|
@@ -593,8 +593,8 @@ module Relaton
|
|
|
593
593
|
end
|
|
594
594
|
|
|
595
595
|
def render_keyword(kw, prefix, count)
|
|
596
|
-
if kw.vocab
|
|
597
|
-
|
|
596
|
+
if Array(kw.vocab).any?
|
|
597
|
+
array(kw.vocab).map { |v| render_localized_string(v, prefix, count) }.join
|
|
598
598
|
else
|
|
599
599
|
array(kw.taxon).map { |t| render_localized_string(t, prefix, count) }.join
|
|
600
600
|
end
|
|
@@ -230,7 +230,7 @@ module Relaton
|
|
|
230
230
|
# @return [Array<Relaton::Bib::Keyword>]
|
|
231
231
|
def fetch_keyword
|
|
232
232
|
@entry["keywords"]&.split(/,\s?/)&.map do |kw|
|
|
233
|
-
Keyword.new(vocab: LocalizedString.new(content: kw))
|
|
233
|
+
Keyword.new(vocab: [LocalizedString.new(content: kw)])
|
|
234
234
|
end || []
|
|
235
235
|
end
|
|
236
236
|
|
|
@@ -297,7 +297,7 @@ module Relaton # rubocop:disable Style/OneClassPerFile
|
|
|
297
297
|
def add_keyword
|
|
298
298
|
if @bib.keyword&.any?
|
|
299
299
|
@item.keywords = @bib.keyword.reduce([]) do |m, kw|
|
|
300
|
-
m + (kw.vocab ?
|
|
300
|
+
m + (Array(kw.vocab).any? ? Array(kw.vocab).map(&:content) : kw.taxon.map(&:content))
|
|
301
301
|
end.join(", ")
|
|
302
302
|
end
|
|
303
303
|
end
|
|
@@ -293,8 +293,8 @@ module Relaton
|
|
|
293
293
|
|
|
294
294
|
def create_keyword
|
|
295
295
|
@item.keyword.inject([]) do |a, k|
|
|
296
|
-
|
|
297
|
-
a +
|
|
296
|
+
unless Array(k.vocab).empty?
|
|
297
|
+
a + Array(k.vocab).map { |v| Rfcxml::V3::Keyword.new(content: v.content) }
|
|
298
298
|
else
|
|
299
299
|
a + k.taxon.map { |t| Rfcxml::V3::Keyword.new(content: t.content) }
|
|
300
300
|
end
|
|
@@ -173,7 +173,7 @@ module Relaton
|
|
|
173
173
|
# @return [Array<Relaton::Bib::Keyword>]
|
|
174
174
|
def fetch_keyword
|
|
175
175
|
Array(@entry["keyword"]).map do |kw|
|
|
176
|
-
Keyword.new(vocab: LocalizedString.new(content: kw))
|
|
176
|
+
Keyword.new(vocab: [LocalizedString.new(content: kw)])
|
|
177
177
|
end
|
|
178
178
|
end
|
|
179
179
|
|
|
@@ -20,7 +20,7 @@ module Relaton
|
|
|
20
20
|
add_field(lines, "%I", publisher_name)
|
|
21
21
|
add_journal(lines)
|
|
22
22
|
add_series(lines)
|
|
23
|
-
Array(@item.keyword).each { |k| add_field(lines, "%K",
|
|
23
|
+
Array(@item.keyword).each { |k| Array(k.vocab).each { |v| add_field(lines, "%K", v.content.to_s) } }
|
|
24
24
|
add_field(lines, "%U", source_uri)
|
|
25
25
|
lines.join("\n") + "\n"
|
|
26
26
|
end
|
|
@@ -15,7 +15,7 @@ module Relaton
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
attribute :vocab, LocalizedString
|
|
18
|
+
attribute :vocab, LocalizedString, collection: true, initialize_empty: true
|
|
19
19
|
attribute :taxon, LocalizedString, collection: true, initialize_empty: true
|
|
20
20
|
attribute :vocabid, Vocabid, collection: true, initialize_empty: true
|
|
21
21
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
require_relative "type/plain_date"
|
|
2
|
+
|
|
1
3
|
module Relaton
|
|
2
4
|
module Bib
|
|
3
5
|
class Validity < Lutaml::Model::Serializable
|
|
4
|
-
attribute :begins,
|
|
5
|
-
attribute :ends,
|
|
6
|
-
attribute :revision,
|
|
7
|
-
|
|
6
|
+
attribute :begins, PlainDate
|
|
7
|
+
attribute :ends, PlainDate
|
|
8
|
+
attribute :revision, PlainDate
|
|
8
9
|
xml do
|
|
9
10
|
root "validity"
|
|
10
11
|
map_element "validityBegins", to: :begins
|
|
@@ -10,6 +10,7 @@ require_relative "../index"
|
|
|
10
10
|
require "zip"
|
|
11
11
|
require "pubid"
|
|
12
12
|
require_relative "index_item_normalizer"
|
|
13
|
+
require_relative "../logger/channels/gh_issue"
|
|
13
14
|
|
|
14
15
|
module Relaton
|
|
15
16
|
module Cli
|
|
@@ -393,6 +394,13 @@ module Relaton
|
|
|
393
394
|
.map(&:file).uniq.sort
|
|
394
395
|
end
|
|
395
396
|
|
|
397
|
+
# The rendered docid and the file of each row behind
|
|
398
|
+
# `skipped_count`, ordered by file.
|
|
399
|
+
def skipped_rows
|
|
400
|
+
@rows.select { |row| row.id_hash.nil? }
|
|
401
|
+
.map { |row| [row.rendered, row.file] }.uniq.sort_by(&:last)
|
|
402
|
+
end
|
|
403
|
+
|
|
396
404
|
# Rows bucketed by shard, in deterministic (key, rendered) order;
|
|
397
405
|
# empty buckets are absent — a client treats a 404 as not-found.
|
|
398
406
|
def each_shard
|
|
@@ -776,7 +784,7 @@ module Relaton
|
|
|
776
784
|
machine.manifest(generated: @generated).merge(artifact),
|
|
777
785
|
),
|
|
778
786
|
)
|
|
779
|
-
if machine.skipped_count.positive?
|
|
787
|
+
if machine.skipped_count.positive? && !report_unindexed(machine)
|
|
780
788
|
raise Relaton::IndexBuildError,
|
|
781
789
|
"Machine index build: #{machine.skipped_count} of " \
|
|
782
790
|
"#{machine.count} document(s) could not be indexed — neither " \
|
|
@@ -788,6 +796,27 @@ module Relaton
|
|
|
788
796
|
machine.shard_count
|
|
789
797
|
end
|
|
790
798
|
|
|
799
|
+
UNINDEXED_ISSUE_TITLE = "Documents missing from the machine index"
|
|
800
|
+
|
|
801
|
+
# Report the documents no row could identify as a GitHub issue in the
|
|
802
|
+
# data repo, as the ISO crawler reports its unparseable ids, so the
|
|
803
|
+
# build can publish the rest. A tracked issue is not a silent drop;
|
|
804
|
+
# the build raises only when it cannot report (no GITHUB_REPOSITORY
|
|
805
|
+
# or GITHUB_TOKEN, or GitHub refuses the issue). Answers true when
|
|
806
|
+
# GitHub took the report.
|
|
807
|
+
def report_unindexed(machine)
|
|
808
|
+
Util.warn "Machine index: #{machine.skipped_count} of " \
|
|
809
|
+
"#{machine.count} document(s) could not be indexed"
|
|
810
|
+
repo = ENV.fetch("GITHUB_REPOSITORY", nil)
|
|
811
|
+
return false if repo.to_s.empty? || ENV["GITHUB_TOKEN"].to_s.empty?
|
|
812
|
+
|
|
813
|
+
issue = Relaton::Logger::Channels::GhIssue.new(repo, UNINDEXED_ISSUE_TITLE)
|
|
814
|
+
machine.skipped_rows.each do |rendered, file|
|
|
815
|
+
issue.write "Unparseable primary id `#{rendered}` was not indexed (#{file})"
|
|
816
|
+
end
|
|
817
|
+
issue.create_issue == true
|
|
818
|
+
end
|
|
819
|
+
|
|
791
820
|
# Zip sibling of a monolith — the form `Relaton::Index url:`
|
|
792
821
|
# fetches today. The zip stores the yaml at its bare basename,
|
|
793
822
|
# matching the layout data repos publish in git. Returns the zip path.
|
|
@@ -63,17 +63,59 @@ module Relaton
|
|
|
63
63
|
# receives the String and normalizes it itself, and the query is not
|
|
64
64
|
# keyed - the same reading as a flavor's own miss.
|
|
65
65
|
#
|
|
66
|
+
# The parse is memoized per identifier class (relaton#633): it is pure,
|
|
67
|
+
# and one compile re-reads the same reference many times, so the key
|
|
68
|
+
# path must not re-run a parslet parse per access (the plateau v5
|
|
69
|
+
# campaign measured the MatchData/string churn). The map is bounded
|
|
70
|
+
# FIFO, mutex-guarded (Db serves lookups from a workers pool), and
|
|
71
|
+
# caches misses too. Memoized instances are shared: the key path never
|
|
72
|
+
# mutates a parsed identifier (`fold_year` and `to_all_parts` copy),
|
|
73
|
+
# and an override of this method keeps its own behaviour.
|
|
74
|
+
#
|
|
66
75
|
# @param ref [String]
|
|
67
76
|
# @return [Pubid::Identifier, nil]
|
|
68
77
|
def cache_pubid(ref)
|
|
69
|
-
pubid_class
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
klass = pubid_class
|
|
79
|
+
return nil unless klass
|
|
80
|
+
|
|
81
|
+
Core::Processor.cached_pubid(klass, ref)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# The bounded memo behind .cache_pubid: `[identifier class, reference]`
|
|
85
|
+
# → parsed identifier or nil. Insertion order is the eviction order;
|
|
86
|
+
# the limit covers a compile's reference working set with headroom.
|
|
87
|
+
MEMO_LIMIT = 2000
|
|
88
|
+
|
|
89
|
+
@pubid_memo = {}
|
|
90
|
+
@memo_mutex = Mutex.new
|
|
91
|
+
|
|
92
|
+
class << self
|
|
93
|
+
def cached_pubid(klass, ref)
|
|
94
|
+
key = [klass, ref]
|
|
95
|
+
hit = nil
|
|
96
|
+
present = @memo_mutex.synchronize do
|
|
97
|
+
hit = @pubid_memo[key]
|
|
98
|
+
@pubid_memo.key?(key)
|
|
99
|
+
end
|
|
100
|
+
return hit if present
|
|
101
|
+
|
|
102
|
+
parsed =
|
|
103
|
+
begin
|
|
104
|
+
klass.parse(ref)
|
|
105
|
+
rescue ArgumentError, ::Pubid::Errors::Error
|
|
106
|
+
# relaton-bib carries the log facade; core specs load without it.
|
|
72
107
|
require_relative "../bib"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
108
|
+
Relaton::Bib::Util.info "does not parse as this flavor's pubid; " \
|
|
109
|
+
"passing the reference to the flavor as " \
|
|
110
|
+
"written", "relaton-db", key: ref
|
|
111
|
+
nil
|
|
112
|
+
end
|
|
113
|
+
@memo_mutex.synchronize do
|
|
114
|
+
@pubid_memo.shift while @pubid_memo.size >= MEMO_LIMIT
|
|
115
|
+
@pubid_memo[key] = parsed
|
|
116
|
+
end
|
|
117
|
+
parsed
|
|
118
|
+
end
|
|
77
119
|
end
|
|
78
120
|
|
|
79
121
|
# The reference as `get` receives it and the cache keys it (relaton#205):
|
|
@@ -170,7 +170,7 @@ module Relaton
|
|
|
170
170
|
end
|
|
171
171
|
|
|
172
172
|
result = @row["Keywords"].split(",").map do |kw|
|
|
173
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: kw.strip, language: "en", script: "Latn"))
|
|
173
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: kw.strip, language: "en", script: "Latn")])
|
|
174
174
|
end
|
|
175
175
|
@errors[:keyword] &&= result.empty?
|
|
176
176
|
result
|
|
@@ -647,6 +647,7 @@ module Relaton
|
|
|
647
647
|
bib = IdamsParser.new(doc, self, local_errors).parse
|
|
648
648
|
if bib.docnumber.nil?
|
|
649
649
|
Util.warn "PubID parse error. Normtitle: `#{doc.normtitle}`, file: `#{file}`"
|
|
650
|
+
report_missing_id(doc.normtitle, info&.stdnumber, file)
|
|
650
651
|
return nil
|
|
651
652
|
end
|
|
652
653
|
[idx, file, doc, bib, local_errors]
|
|
@@ -655,6 +656,26 @@ module Relaton
|
|
|
655
656
|
nil
|
|
656
657
|
end
|
|
657
658
|
|
|
659
|
+
#
|
|
660
|
+
# A numbered record that gets no id, with nothing to explain it
|
|
661
|
+
# (`RawbibIdParser.unexpected_miss?`), is a new parse failure, so the
|
|
662
|
+
# record is skipped but not silently: `report_errors` sends the String
|
|
663
|
+
# to the crawl's GitHub issue. The key is the normtitle, because the
|
|
664
|
+
# rawbib dataset repeats a record in many files. A forked worker hands
|
|
665
|
+
# @errors to the parent with its state (`merge_errors`).
|
|
666
|
+
#
|
|
667
|
+
# @param [String, nil] normtitle
|
|
668
|
+
# @param [String, nil] stdnumber
|
|
669
|
+
# @param [String] file
|
|
670
|
+
#
|
|
671
|
+
def report_missing_id(normtitle, stdnumber, file)
|
|
672
|
+
key = :"no_id #{normtitle}"
|
|
673
|
+
# @errors defaults to true, so `||=` would never assign.
|
|
674
|
+
return if @errors.key?(key) || !RawbibIdParser.unexpected_miss?(normtitle, stdnumber)
|
|
675
|
+
|
|
676
|
+
@errors[key] = "No IEEE id for normtitle `#{normtitle}`, stdnumber `#{stdnumber}` (#{file})"
|
|
677
|
+
end
|
|
678
|
+
|
|
658
679
|
#
|
|
659
680
|
# Merge a worker's local errors hash into the shared @errors hash,
|
|
660
681
|
# preserving the existing AND semantics (`@errors[k] &&= v`).
|
|
@@ -249,7 +249,7 @@ module Relaton
|
|
|
249
249
|
#
|
|
250
250
|
def parse_keyword
|
|
251
251
|
result = @doc.keyword.map do |kw|
|
|
252
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: CGI.unescapeHTML(kw), language: "en", script: "Latn"))
|
|
252
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: CGI.unescapeHTML(kw), language: "en", script: "Latn")])
|
|
253
253
|
end
|
|
254
254
|
@errors[:keyword] &&= result.empty?
|
|
255
255
|
result
|
|
@@ -29,6 +29,9 @@ module Relaton
|
|
|
29
29
|
# @return [::Pubid::Ieee::Identifier, nil]
|
|
30
30
|
#
|
|
31
31
|
def parse(normtitle, stdnumber)
|
|
32
|
+
return nil if NOT_A_DESIGNATION.include?(stdnumber.to_s)
|
|
33
|
+
|
|
34
|
+
normtitle = normalize(normtitle, stdnumber.to_s)
|
|
32
35
|
# Bespoke canonical string is the faithfulness reference: for the ~6% of
|
|
33
36
|
# normtitles pubid can't parse directly it's the recovery source, and for
|
|
34
37
|
# the rest it guards against pubid parsing but silently dropping a digit.
|
|
@@ -40,6 +43,69 @@ module Relaton
|
|
|
40
43
|
rendered # neither pubid parse kept every digit — keep the bespoke id
|
|
41
44
|
end
|
|
42
45
|
|
|
46
|
+
# Records whose `stdnumber` is free text, not an IEEE designation
|
|
47
|
+
# (relaton-data-ieee#11). A stripped title would name another document
|
|
48
|
+
# (`IEEE 1512` is a different standard), so they get no id, and the
|
|
49
|
+
# crawler skips them without an error. Each is the record's stdnumber.
|
|
50
|
+
NOT_A_DESIGNATION = [
|
|
51
|
+
"1512 Guide", # a guide for implementing IEEE 1512
|
|
52
|
+
"802.11ba Battery Life Improvement", # a technology report
|
|
53
|
+
"3006HistoricalData-2012", # reliability data for IEEE 3006
|
|
54
|
+
"PR 1533-1998", # IEEE/NEMI specification
|
|
55
|
+
"ST 430-9:2008 Am1:2011", # a SMPTE amendment
|
|
56
|
+
].freeze
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# True when a record gets no id and nothing explains it, so the crawler
|
|
60
|
+
# must report it. A record is explained when it is in
|
|
61
|
+
# {NOT_A_DESIGNATION}, when its `stdnumber` has no digit (a category
|
|
62
|
+
# such as "White Paper": {#parse_fallback} gives it no id on purpose),
|
|
63
|
+
# or when {#parse} gives an id that the IdamsParser drops (the
|
|
64
|
+
# {#fabricated_title_id?} guard).
|
|
65
|
+
#
|
|
66
|
+
# @param [String, nil] normtitle
|
|
67
|
+
# @param [String, nil] stdnumber
|
|
68
|
+
#
|
|
69
|
+
# @return [Boolean]
|
|
70
|
+
#
|
|
71
|
+
def unexpected_miss?(normtitle, stdnumber)
|
|
72
|
+
return false if NOT_A_DESIGNATION.include?(stdnumber.to_s)
|
|
73
|
+
return false unless stdnumber.to_s.match?(/\d/)
|
|
74
|
+
|
|
75
|
+
parse(normtitle.to_s, stdnumber.to_s).nil?
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
#
|
|
79
|
+
# Repair vendor spellings that neither pubid nor {#parse_fallback} can
|
|
80
|
+
# read, before both see the normtitle (relaton-data-ieee#10). Each rule
|
|
81
|
+
# is narrow: an id that pubid already parses must not change.
|
|
82
|
+
#
|
|
83
|
+
# @param [String] normtitle
|
|
84
|
+
# @param [String] stdnumber
|
|
85
|
+
#
|
|
86
|
+
# @return [String]
|
|
87
|
+
#
|
|
88
|
+
def normalize(normtitle, stdnumber) # rubocop:disable Metrics/AbcSize
|
|
89
|
+
# The Spanish NESC Handbook has a title for normtitle; the year is in
|
|
90
|
+
# stdnumber (`NESC HBK-2018`).
|
|
91
|
+
if stdnumber =~ /\ANESC HBK-(\d{4})\z/ && normtitle.start_with?("NESC Handbook, Premier Edition")
|
|
92
|
+
return "#{Regexp.last_match(1)} NESC Handbook, Premier Edition"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
nt = normtitle.sub(/\b(IEEE )St(?=\d)/, '\1Std ') # IEEE St802.3de
|
|
96
|
+
.sub(/(?<=\d)_FDIS_D(?=\d)/, "/D") # P61886-1_FDIS_D3.1
|
|
97
|
+
.sub(/(?<=[a-z\d])REVD(?=\d)/i, "-REV/D") # P802.1QREVD2.2 (keeps the revision)
|
|
98
|
+
# PC37.10.1D5BA. A letter after the draft digits keeps
|
|
99
|
+
# `P802.1D5` (802.1D is a real standard) as it is.
|
|
100
|
+
.sub(/\A(IEEE PC?\d+(?:\.\d+)+)D(?=\d+[A-Z])/, '\1/D')
|
|
101
|
+
# An empty draft (`P11073-10415/D, February 2019`) takes the draft of
|
|
102
|
+
# stdnumber (`P11073-10415/D6, Feb 2019`).
|
|
103
|
+
if nt.include?("/D,") && (draft = stdnumber[%r{/D(\w[\w.]*)}, 1])
|
|
104
|
+
nt = nt.sub("/D,", "/D#{draft},")
|
|
105
|
+
end
|
|
106
|
+
nt
|
|
107
|
+
end
|
|
108
|
+
|
|
43
109
|
#
|
|
44
110
|
# True when `pid` is not a real IEEE designation but a leading fragment
|
|
45
111
|
# of the document's own title, coined by a generic {#parse_fallback}
|
|
@@ -113,6 +179,9 @@ module Relaton
|
|
|
113
179
|
# when /^(\d+HistoricalData)-(\d{4})/ then "IEEE #{$1}.#{$2}"
|
|
114
180
|
# when /^(\d+)\.(\w+)\sBattery\sLife\sImprovement/ then "IEEE #{$1}-#{$2}"
|
|
115
181
|
# when /^(\d+)\.(\w+)-(\d{4})\s\(Amendment/ then "IEEE #{$1}-#{$2}.#{$3}"
|
|
182
|
+
# No month: pubid renders a three-part draft with a month badly.
|
|
183
|
+
when "IEEE P1901.2_vD0.07.01, March 2013" # "IEEE P1901.2/D0.07.01-2013"
|
|
184
|
+
Renderer.new(publisher: "IEEE", number: "P1901", part: "2", draft: "0.07.01", year: "2013")
|
|
116
185
|
when "A.I.E.E. No. 15 May-1928" then Renderer.new(publisher: "AIEE", number: "15", year: "1928", month: "05")
|
|
117
186
|
# when "AIEE Nos 72 and 73 - 1932" then "AIEE 72_73.1932"
|
|
118
187
|
when "IEEE Std P1073.1.3.4/D3.0" then Renderer.new(publisher: "IEEE", std: true, number: "P11073", part: "00101") # "IEEE Std P11073-00101"
|
|
@@ -527,7 +596,8 @@ module Relaton
|
|
|
527
596
|
# number, part, year
|
|
528
597
|
when /^(\d{2})\sIRE\s(\w+)[\s.](\w+)/ # "IRE #{$2}-#{$3}.#{yn $1}"
|
|
529
598
|
Renderer.new(publisher: "IRE", number: $2, part: $3, year: yn($1))
|
|
530
|
-
when /^(\w+)\.(\w+)-(
|
|
599
|
+
when /^(\w+)\.(\w+)-(\d{4}).*?(\s-\sRedline)?\z/
|
|
600
|
+
Renderer.new(publisher: "IEEE", number: $1, part: $2, year: $3, redline: !$4.nil?)
|
|
531
601
|
|
|
532
602
|
# number, year
|
|
533
603
|
when /^(\w+)-(\d{4})\D/ then Renderer.new(publisher: "IEEE", number: $1, year: $2)
|
|
@@ -710,13 +780,19 @@ module Relaton
|
|
|
710
780
|
end
|
|
711
781
|
|
|
712
782
|
def edition_to_s = edition ? "/E-#{edition}" : ""
|
|
713
|
-
def draft_to_s = draft ? "/D-#{draft}"
|
|
783
|
+
def draft_to_s = blank?(draft) ? "" : "/D-#{draft}"
|
|
714
784
|
def rev_to_s = rev ? "/R-#{rev}" : ""
|
|
715
785
|
def corr_to_s = corr ? "/Cor#{corr}" : ""
|
|
716
786
|
def amd_to_s = amd ? "/Amd #{amd}" : ""
|
|
717
|
-
def year_to_s = year ? "
|
|
718
|
-
def month_to_s = month ? "
|
|
787
|
+
def year_to_s = blank?(year) ? "" : "-#{year}"
|
|
788
|
+
def month_to_s = blank?(month) ? "" : "-#{month}"
|
|
719
789
|
def redline_to_s = redline ? " Redline" : ""
|
|
790
|
+
|
|
791
|
+
private
|
|
792
|
+
|
|
793
|
+
# An empty capture must print nothing: `/D-` or a bare `-` gives an
|
|
794
|
+
# id that pubid cannot parse (relaton-data-ieee#10).
|
|
795
|
+
def blank?(value) = value.to_s.empty?
|
|
720
796
|
end
|
|
721
797
|
|
|
722
798
|
def initialize(pubid)
|
|
@@ -40,6 +40,14 @@ module Relaton
|
|
|
40
40
|
# fresh issue every time would pile up duplicates of the same standing
|
|
41
41
|
# report; when an open issue with this title already exists, add the run's
|
|
42
42
|
# log as a comment on it instead.
|
|
43
|
+
#
|
|
44
|
+
# A request that raises (timeout, DNS, TLS) is printed and answers
|
|
45
|
+
# false: a crawl calls this from `report_errors`, and an escaped error
|
|
46
|
+
# would fail the fetch step before its data is committed.
|
|
47
|
+
#
|
|
48
|
+
# @return [Boolean, nil] true when GitHub took the issue or the
|
|
49
|
+
# comment, false when it refused it or the request raised, nil when
|
|
50
|
+
# nothing was sent (an empty log or no GITHUB_TOKEN)
|
|
43
51
|
def create_issue
|
|
44
52
|
return if @log.empty? || ENV["GITHUB_TOKEN"].nil?
|
|
45
53
|
|
|
@@ -48,6 +56,9 @@ module Relaton
|
|
|
48
56
|
else
|
|
49
57
|
report_response post_issue, "Issue created!", 201
|
|
50
58
|
end
|
|
59
|
+
rescue StandardError => e
|
|
60
|
+
puts "Failed to report issue: #{e.class}: #{e.message}"
|
|
61
|
+
false
|
|
51
62
|
end
|
|
52
63
|
|
|
53
64
|
private
|
|
@@ -55,8 +66,10 @@ module Relaton
|
|
|
55
66
|
def report_response(responce, success_message, success_code)
|
|
56
67
|
if responce.code.to_i == success_code
|
|
57
68
|
puts success_message
|
|
69
|
+
true
|
|
58
70
|
else
|
|
59
71
|
puts "Failed to report issue: #{responce.code} #{responce.message}\n#{responce.body}"
|
|
72
|
+
false
|
|
60
73
|
end
|
|
61
74
|
end
|
|
62
75
|
|
data/lib/relaton/nist/scraper.rb
CHANGED
|
@@ -290,7 +290,7 @@ module Relaton
|
|
|
290
290
|
def fetch_keywords(doc)
|
|
291
291
|
doc["keywords"].map do |kw|
|
|
292
292
|
text = kw.is_a?(String) ? kw : kw.text
|
|
293
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: text))
|
|
293
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: text)])
|
|
294
294
|
end
|
|
295
295
|
end
|
|
296
296
|
|
data/lib/relaton/omg/scraper.rb
CHANGED
|
@@ -176,7 +176,7 @@ module Relaton
|
|
|
176
176
|
|
|
177
177
|
def fetch_keyword
|
|
178
178
|
@doc.xpath('//dt[.="Categories:"]/following-sibling::dd/ul/li/a/em').map do |kw|
|
|
179
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: kw.text))
|
|
179
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: kw.text)])
|
|
180
180
|
end
|
|
181
181
|
end
|
|
182
182
|
|
|
@@ -63,7 +63,7 @@ module Relaton
|
|
|
63
63
|
|
|
64
64
|
def parse_keyword
|
|
65
65
|
result = @entry["globalTags"]["nodes"].map do |tag|
|
|
66
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: tag["name"]))
|
|
66
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: tag["name"])])
|
|
67
67
|
end
|
|
68
68
|
@errors[:tr_keyword] &&= result.empty?
|
|
69
69
|
result
|
data/lib/relaton/un/parser.rb
CHANGED
|
@@ -74,7 +74,7 @@ module Relaton
|
|
|
74
74
|
def fetch_keyword
|
|
75
75
|
subjects = english_data&.dig("subjects") || []
|
|
76
76
|
subjects.map do |kw|
|
|
77
|
-
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: kw))
|
|
77
|
+
Bib::Keyword.new(vocab: [Bib::LocalizedString.new(content: kw)])
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
data/lib/relaton/version.rb
CHANGED
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.1.
|
|
4
|
+
version: 3.1.15
|
|
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-
|
|
11
|
+
date: 2026-11-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|