relaton 3.1.11 → 3.1.14
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/etsi/data_parser.rb +1 -1
- data/lib/relaton/ieee/idams_parser.rb +1 -1
- data/lib/relaton/ietf/rfc/entry.rb +1 -1
- data/lib/relaton/iho/docidentifier.rb +8 -0
- data/lib/relaton/logger/channels/gh_issue.rb +6 -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: 11ab89b10403b98a447c659bfcff3c5797f6af404f83ea0951ad4c99381bdfc7
|
|
4
|
+
data.tar.gz: a90519205d323c6298e4771ff59384492d3d145f492edecc90ae468e0d049824
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 641202b0d40c80638a5935638221a38b73b1de7cd8dfb6f9cc57e9a1747e9d076689325c665dbbaac6400c46d255acccfa4a32c478577c80705fa4f1076457da
|
|
7
|
+
data.tar.gz: 7cb1528532f44ecc7a5aa1c4069b46e7224d4a7c06015f0f6ac47074e4983e5b0c8ff98e2dcb753d7c2ed073d5893e77dc77c19fb02da6695d2c13e88fe9a41b
|
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.
|
|
@@ -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
|
|
@@ -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
|
|
@@ -12,6 +12,14 @@ module Relaton
|
|
|
12
12
|
|
|
13
13
|
def content=(value)
|
|
14
14
|
super
|
|
15
|
+
# URN-typed docidentifiers carry the MRN form
|
|
16
|
+
# (urn:mrn:iho:pub:spec:...), not a Pubid-parseable face — the
|
|
17
|
+
# parse would raise on every bibdata read (metanorma-iho#573,
|
|
18
|
+
# #603 emit these for S-4 update units and S-158:1xx primaries).
|
|
19
|
+
# Detected from the value: type may not be assigned yet when the
|
|
20
|
+
# setter fires during initialize.
|
|
21
|
+
return if value.to_s.start_with?("urn:")
|
|
22
|
+
|
|
15
23
|
@pubid = ::Pubid::Iho::Identifier.parse(value) if value
|
|
16
24
|
end
|
|
17
25
|
|
|
@@ -40,6 +40,10 @@ 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
|
+
# @return [Boolean, nil] true when GitHub took the issue or the
|
|
45
|
+
# comment, false when it refused it, nil when nothing was sent
|
|
46
|
+
# (an empty log or no GITHUB_TOKEN)
|
|
43
47
|
def create_issue
|
|
44
48
|
return if @log.empty? || ENV["GITHUB_TOKEN"].nil?
|
|
45
49
|
|
|
@@ -55,8 +59,10 @@ module Relaton
|
|
|
55
59
|
def report_response(responce, success_message, success_code)
|
|
56
60
|
if responce.code.to_i == success_code
|
|
57
61
|
puts success_message
|
|
62
|
+
true
|
|
58
63
|
else
|
|
59
64
|
puts "Failed to report issue: #{responce.code} #{responce.message}\n#{responce.body}"
|
|
65
|
+
false
|
|
60
66
|
end
|
|
61
67
|
end
|
|
62
68
|
|
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.14
|
|
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-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|