relaton 3.0.0.pre.alpha.4 → 3.0.0.pre.alpha.5
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/adobe/processor.rb +9 -0
- data/lib/relaton/bib/converter/csl.rb +110 -0
- data/lib/relaton/bib/converter/ris.rb +104 -0
- data/lib/relaton/bib/converter/titles.rb +24 -0
- data/lib/relaton/bib/item_data.rb +9 -0
- data/lib/relaton/bib/model/item.rb +6 -6
- data/lib/relaton/bib/sanitizer.rb +71 -30
- data/lib/relaton/bib.rb +10 -0
- data/lib/relaton/bipm/processor.rb +1 -0
- data/lib/relaton/bipm/rawdata_bipm_metrologia/affiliations.rb +6 -6
- data/lib/relaton/bipm/si_brochure_parser.rb +2 -2
- data/lib/relaton/bsi/processor.rb +5 -0
- data/lib/relaton/ccsds/bibliography.rb +1 -0
- data/lib/relaton/ccsds/processor.rb +12 -0
- data/lib/relaton/cen/hit_collection.rb +1 -1
- data/lib/relaton/cen/processor.rb +5 -0
- data/lib/relaton/cen/scraper.rb +9 -9
- data/lib/relaton/cie/data_fetcher.rb +18 -18
- data/lib/relaton/cie/processor.rb +1 -0
- data/lib/relaton/cie.rb +1 -1
- data/lib/relaton/cloud.rb +127 -0
- data/lib/relaton/core/hit_collection.rb +6 -10
- data/lib/relaton/core/processor.rb +68 -0
- data/lib/relaton/db/cache.rb +444 -148
- data/lib/relaton/db/cache_entry.rb +33 -0
- data/lib/relaton/db/registry.rb +52 -0
- data/lib/relaton/db.rb +131 -72
- data/lib/relaton/doi/crossref.rb +23 -6
- data/lib/relaton/doi/processor.rb +1 -0
- data/lib/relaton/easc/processor.rb +1 -0
- data/lib/relaton/ecma/data_fetcher.rb +1 -1
- data/lib/relaton/ecma/data_parser.rb +1 -1
- data/lib/relaton/ecma/edition_parser.rb +2 -2
- data/lib/relaton/ecma/memento_parser.rb +4 -4
- data/lib/relaton/ecma/standard_parser.rb +6 -6
- data/lib/relaton/etsi/processor.rb +1 -0
- data/lib/relaton/gb/gb_scraper.rb +5 -5
- data/lib/relaton/gb/scraper.rb +16 -16
- data/lib/relaton/gb/sec_scraper.rb +8 -8
- data/lib/relaton/gb/t_scraper.rb +5 -5
- data/lib/relaton/gost/processor.rb +1 -0
- data/lib/relaton/iala/processor.rb +1 -0
- data/lib/relaton/iana/data_fetcher.rb +3 -3
- data/lib/relaton/iana/parser.rb +8 -4
- data/lib/relaton/iana/processor.rb +9 -0
- data/lib/relaton/iec/data_parser.rb +24 -9
- data/lib/relaton/iec/processor.rb +6 -0
- data/lib/relaton/iec.rb +1 -1
- data/lib/relaton/ieee/data_fetcher.rb +1 -1
- data/lib/relaton/ieee/processor.rb +8 -0
- data/lib/relaton/ietf/data_fetcher.rb +1 -1
- data/lib/relaton/ietf/processor.rb +1 -0
- data/lib/relaton/ietf/rfc/entry.rb +15 -19
- data/lib/relaton/iho/processor.rb +1 -0
- data/lib/relaton/index/file_io.rb +2 -2
- data/lib/relaton/index/pool.rb +4 -3
- data/lib/relaton/index/shard_source.rb +1 -1
- data/lib/relaton/index/type.rb +2 -5
- data/lib/relaton/isbn/open_library.rb +11 -7
- data/lib/relaton/isbn/processor.rb +10 -0
- data/lib/relaton/iso/data_parser.rb +2 -2
- data/lib/relaton/iso/processor.rb +5 -0
- data/lib/relaton/iso/scraper.rb +20 -20
- data/lib/relaton/itu/bibliography.rb +99 -13
- data/lib/relaton/itu/data_crawler_r.rb +2 -2
- data/lib/relaton/itu/hit_collection.rb +64 -52
- data/lib/relaton/itu/processor.rb +1 -0
- data/lib/relaton/itu/scraper.rb +13 -3
- data/lib/relaton/itu.rb +0 -2
- data/lib/relaton/jis/data_fetcher.rb +4 -4
- data/lib/relaton/jis/processor.rb +1 -0
- data/lib/relaton/jis/scraper.rb +8 -8
- data/lib/relaton/oasis/browser_agent.rb +2 -2
- data/lib/relaton/oasis/data_parser.rb +5 -5
- data/lib/relaton/oasis/data_parser_utils.rb +2 -2
- data/lib/relaton/oasis/data_part_parser.rb +7 -7
- data/lib/relaton/ogc/processor.rb +7 -0
- data/lib/relaton/oiml/processor.rb +1 -0
- data/lib/relaton/omg/scraper.rb +11 -11
- data/lib/relaton/omg.rb +1 -1
- data/lib/relaton/plateau/processor.rb +1 -0
- data/lib/relaton/un/bibliography.rb +21 -10
- data/lib/relaton/un/processor.rb +1 -0
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/w3c/processor.rb +1 -0
- data/lib/relaton.rb +13 -0
- metadata +48 -16
- data/lib/relaton/itu/pubid.rb +0 -199
data/lib/relaton/jis/scraper.rb
CHANGED
|
@@ -22,7 +22,7 @@ module Relaton
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def fetch # rubocop:disable Metrics/MethodLength
|
|
25
|
-
@doc = @agent.get(@url).
|
|
25
|
+
@doc = @agent.get(@url).at_xpath "//div[@id='main']/section"
|
|
26
26
|
contributors = fetch_contributor
|
|
27
27
|
eg_contributor = fetch_editorialgroup_contributor
|
|
28
28
|
contributors << eg_contributor if eg_contributor
|
|
@@ -33,7 +33,7 @@ module Relaton
|
|
|
33
33
|
|
|
34
34
|
def fetch_title
|
|
35
35
|
result = { "ja" => "Jpan", "en" => "Latn" }.map.with_index do |(lang, script), i|
|
|
36
|
-
content = @doc.
|
|
36
|
+
content = @doc.at_xpath("./h2/text()[#{i + 2}]").text.strip
|
|
37
37
|
Bib::Title.new content: content, language: lang, script: script
|
|
38
38
|
end
|
|
39
39
|
@errors[:title] &&= result.empty?
|
|
@@ -84,12 +84,12 @@ module Relaton
|
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
def document_id
|
|
87
|
-
@document_id ||= @doc.
|
|
87
|
+
@document_id ||= @doc.at_xpath("./h2/text()[1]")&.text&.strip
|
|
88
88
|
end
|
|
89
89
|
|
|
90
90
|
def fetch_date
|
|
91
91
|
result = DATETYPES.each_with_object([]) do |(key, type), a|
|
|
92
|
-
node = @doc.
|
|
92
|
+
node = @doc.at_xpath("./div/div/div/p/text()[contains(.,'#{key}')]")
|
|
93
93
|
next unless node
|
|
94
94
|
|
|
95
95
|
at = node.text.match(/\d{4}-\d{2}-\d{2}/).to_s
|
|
@@ -116,7 +116,7 @@ module Relaton
|
|
|
116
116
|
def langs_scripts # rubocop:disable Metrics/MethodLength
|
|
117
117
|
@langs_scripts ||= begin
|
|
118
118
|
result = LANGS.each_with_object([]) do |(key, lang), a|
|
|
119
|
-
l = @doc.
|
|
119
|
+
l = @doc.at_xpath(
|
|
120
120
|
"./div/div/div[@class='blockContentFile']/div/div/p[1]" \
|
|
121
121
|
"/span[contains(.,'#{key}')]/following-sibling::span",
|
|
122
122
|
)
|
|
@@ -132,7 +132,7 @@ module Relaton
|
|
|
132
132
|
def fetch_status
|
|
133
133
|
xpath = "./div/div/div/p/text()[contains(.,'状態')]" \
|
|
134
134
|
"/following-sibling::span"
|
|
135
|
-
st = @doc.
|
|
135
|
+
st = @doc.at_xpath(xpath)
|
|
136
136
|
status_val = STATUSES[st&.text&.strip]
|
|
137
137
|
@errors[:status] &&= status_val.nil?
|
|
138
138
|
return unless status_val
|
|
@@ -155,7 +155,7 @@ module Relaton
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
def fetch_ics
|
|
158
|
-
td = @doc.
|
|
158
|
+
td = @doc.at_xpath("./table/tr[th[.='ICS']]/td")
|
|
159
159
|
@errors[:ics] &&= td.nil?
|
|
160
160
|
return [] unless td
|
|
161
161
|
|
|
@@ -194,7 +194,7 @@ module Relaton
|
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
def fetch_editorialgroup_contributor # rubocop:disable Metrics/MethodLength
|
|
197
|
-
node = @doc.
|
|
197
|
+
node = @doc.at_xpath("./table/tr[th[.='原案作成団体']]/td")
|
|
198
198
|
@errors[:editorialgroup] &&= node.nil?
|
|
199
199
|
return unless node
|
|
200
200
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require "ferrum"
|
|
2
|
-
require "
|
|
2
|
+
require "moxml"
|
|
3
3
|
|
|
4
4
|
module Relaton
|
|
5
5
|
module Oasis
|
|
@@ -42,7 +42,7 @@ module Relaton
|
|
|
42
42
|
def get(url)
|
|
43
43
|
@browser.go_to(url)
|
|
44
44
|
wait_for_challenge
|
|
45
|
-
|
|
45
|
+
Moxml.new.parse_html(@browser.body)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
# HTTP status code of the most recent navigation's main resource,
|
|
@@ -7,7 +7,7 @@ module Relaton
|
|
|
7
7
|
#
|
|
8
8
|
# Initialize parser.
|
|
9
9
|
#
|
|
10
|
-
# @param [
|
|
10
|
+
# @param [Moxml::Element] node document node
|
|
11
11
|
#
|
|
12
12
|
def initialize(node, errors = {}, agent: nil)
|
|
13
13
|
@node = node
|
|
@@ -16,14 +16,14 @@ module Relaton
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def title
|
|
19
|
-
@title ||= @node.
|
|
19
|
+
@title ||= @node.at_xpath("./summary/div/h2").text
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def text
|
|
23
23
|
xpath = "./div/div/div[contains(@class, " \
|
|
24
24
|
"'standard__grid--cite-as')]" \
|
|
25
25
|
"/p[em or i or a or span]"
|
|
26
|
-
@text ||= @node.
|
|
26
|
+
@text ||= @node.at_xpath(xpath)&.text&.strip
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
#
|
|
@@ -144,7 +144,7 @@ module Relaton
|
|
|
144
144
|
xpath = "./div/div/div[contains(@class, " \
|
|
145
145
|
"'standard__grid--cite-as')]" \
|
|
146
146
|
"/p[strong or span/strong]/a"
|
|
147
|
-
@link_node ||= @node.
|
|
147
|
+
@link_node ||= @node.at_xpath(xpath)
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
#
|
|
@@ -220,7 +220,7 @@ module Relaton
|
|
|
220
220
|
parts = document_part_refs
|
|
221
221
|
result = case parts.size
|
|
222
222
|
when 0
|
|
223
|
-
txt = @node.
|
|
223
|
+
txt = @node.at_xpath("./summary/div/h2").text
|
|
224
224
|
parse_spec title_to_docid(txt)
|
|
225
225
|
when 1 then parse_part parse_spec(parts[0])
|
|
226
226
|
else parts_to_docid parts
|
|
@@ -83,7 +83,7 @@ module Relaton
|
|
|
83
83
|
# @param [#get] agent HTTP client responding to #get(url)
|
|
84
84
|
# @param [Integer] retries number of retries
|
|
85
85
|
#
|
|
86
|
-
# @return [
|
|
86
|
+
# @return [Moxml::Document, Mechanize::Page, nil] page or nil
|
|
87
87
|
#
|
|
88
88
|
def retry_page(url, agent, retries = 3)
|
|
89
89
|
sleep 1 # to avoid 429 error
|
|
@@ -156,7 +156,7 @@ module Relaton
|
|
|
156
156
|
href = email[:href]
|
|
157
157
|
if href.start_with?("mailto:")
|
|
158
158
|
[href.split(":")[1]]
|
|
159
|
-
elsif (cf_email = email.
|
|
159
|
+
elsif (cf_email = email.at_xpath(".//span[@data-cfemail]"))
|
|
160
160
|
decoded = decode_cf_email(cf_email["data-cfemail"])
|
|
161
161
|
return [] if decoded.empty?
|
|
162
162
|
|
|
@@ -7,7 +7,7 @@ module Relaton
|
|
|
7
7
|
#
|
|
8
8
|
# Initialize parser.
|
|
9
9
|
#
|
|
10
|
-
# @param [
|
|
10
|
+
# @param [Moxml::Element] node document node
|
|
11
11
|
#
|
|
12
12
|
def initialize(node, errors = {}, agent: nil)
|
|
13
13
|
@node = node
|
|
@@ -20,7 +20,7 @@ module Relaton
|
|
|
20
20
|
|
|
21
21
|
sibling_xpath = "./strong/following-sibling::text()" \
|
|
22
22
|
"|./span[strong]/following-sibling::text()"
|
|
23
|
-
if @node.
|
|
23
|
+
if @node.at_xpath(sibling_xpath)
|
|
24
24
|
nodes_xpath = "./strong/following-sibling::node()" \
|
|
25
25
|
"|./span[strong]/following-sibling::node()"
|
|
26
26
|
@text = @node.xpath(nodes_xpath).text.strip
|
|
@@ -34,7 +34,7 @@ module Relaton
|
|
|
34
34
|
|
|
35
35
|
xpath = "./span[@class='citationTitle' " \
|
|
36
36
|
"or @class='citeTitle']|./em|./i"
|
|
37
|
-
t = @node.
|
|
37
|
+
t = @node.at_xpath(xpath)
|
|
38
38
|
@title = if t
|
|
39
39
|
t.text
|
|
40
40
|
else
|
|
@@ -83,7 +83,7 @@ module Relaton
|
|
|
83
83
|
# @return [String] document number
|
|
84
84
|
#
|
|
85
85
|
def parse_docnumber
|
|
86
|
-
ref = @node.
|
|
86
|
+
ref = @node.at_xpath("./span/strong|./strong|./b/span")
|
|
87
87
|
num = ref.text.match(/[^\[\]]+/).to_s
|
|
88
88
|
id = parse_errata(num)
|
|
89
89
|
# some part refs need "Pt" to distinguish from root doc
|
|
@@ -183,7 +183,7 @@ module Relaton
|
|
|
183
183
|
# @return [Array<Bib::Relation>] document relations
|
|
184
184
|
#
|
|
185
185
|
def parse_relation
|
|
186
|
-
parser = DataParser.new(@node.
|
|
186
|
+
parser = DataParser.new(@node.at_xpath("./ancestor::details"), @errors, agent: @agent)
|
|
187
187
|
fref = parser.parse_docid[0].content
|
|
188
188
|
bib = ItemData.new(formattedref: Bib::Formattedref.new(content: fref))
|
|
189
189
|
result = [Bib::Relation.new(type: "partOf", bibitem: bib)]
|
|
@@ -221,7 +221,7 @@ module Relaton
|
|
|
221
221
|
end
|
|
222
222
|
|
|
223
223
|
def link_node
|
|
224
|
-
@link_node = @node.
|
|
224
|
+
@link_node = @node.at_xpath("./a|./following-sibling::p[1]/a")
|
|
225
225
|
end
|
|
226
226
|
|
|
227
227
|
#
|
|
@@ -230,7 +230,7 @@ module Relaton
|
|
|
230
230
|
# @return [Array<String>] technology areas
|
|
231
231
|
#
|
|
232
232
|
def parse_technology_area
|
|
233
|
-
result = super(@node.
|
|
233
|
+
result = super(@node.at_xpath("./ancestor::details"))
|
|
234
234
|
@errors[:part_technology_area] &&= result.empty?
|
|
235
235
|
result
|
|
236
236
|
end
|
|
@@ -21,6 +21,13 @@ module Relaton
|
|
|
21
21
|
Bibliography.get(code, date, opts)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
# The `year` argument filters by publication year, but an OGC pubid's
|
|
25
|
+
# `year` is the year in the document number (`19` in `OGC 19-025r1`),
|
|
26
|
+
# so it cannot be folded into the key: such a query is not cached.
|
|
27
|
+
def cache_key(ref, year, opts)
|
|
28
|
+
year ? nil : super
|
|
29
|
+
end
|
|
30
|
+
|
|
24
31
|
# @param source [String]
|
|
25
32
|
# @param opts [Hash]
|
|
26
33
|
def fetch_data(_source, opts)
|
data/lib/relaton/omg/scraper.rb
CHANGED
|
@@ -63,7 +63,7 @@ module Relaton
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def fetch_title
|
|
66
|
-
content = @doc.
|
|
66
|
+
content = @doc.at_xpath('//dt[.="Title:"]/following-sibling::dd').text
|
|
67
67
|
content += ": #{@part}" if @part
|
|
68
68
|
[Bib::Title.new(type: "main", content: content, language: "en", script: "Latn")]
|
|
69
69
|
end
|
|
@@ -76,7 +76,7 @@ module Relaton
|
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def fetch_abstract
|
|
79
|
-
content = @doc.
|
|
79
|
+
content = @doc.at_xpath('//section[@id="document-metadata"]/div/div/p').text
|
|
80
80
|
[Bib::Abstract.new(content: content, language: "en", script: "Latn")]
|
|
81
81
|
end
|
|
82
82
|
|
|
@@ -85,7 +85,7 @@ module Relaton
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def doc_version
|
|
88
|
-
@doc_version ||= @doc.
|
|
88
|
+
@doc_version ||= @doc.at_xpath('//dt[.="Version:"]/following-sibling::dd/p/span').text
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
def fetch_date
|
|
@@ -105,7 +105,7 @@ module Relaton
|
|
|
105
105
|
#
|
|
106
106
|
# @return [Date, nil]
|
|
107
107
|
def jsonld_date
|
|
108
|
-
script = @doc.
|
|
108
|
+
script = @doc.at_xpath('//script[@type="application/ld+json"]')
|
|
109
109
|
return unless script
|
|
110
110
|
|
|
111
111
|
node = JSON.parse(script.text).find { |e| e.is_a?(Hash) && e[LD_DATE] }
|
|
@@ -117,7 +117,7 @@ module Relaton
|
|
|
117
117
|
|
|
118
118
|
# @return [Date, nil]
|
|
119
119
|
def dd_date
|
|
120
|
-
text = @doc.
|
|
120
|
+
text = @doc.at_xpath('//dt[.="Publication Date:"]/following-sibling::dd').text.strip
|
|
121
121
|
::Date.parse text
|
|
122
122
|
rescue ::Date::Error
|
|
123
123
|
Util.warn "Cannot parse the publication date `#{text}`."
|
|
@@ -125,7 +125,7 @@ module Relaton
|
|
|
125
125
|
end
|
|
126
126
|
|
|
127
127
|
def fetch_status
|
|
128
|
-
status = @doc.
|
|
128
|
+
status = @doc.at_xpath('//dt[.="Document Status:"]/following-sibling::dd')
|
|
129
129
|
stage = status.text.strip.match(/\w+/).to_s
|
|
130
130
|
Bib::Status.new(stage: Bib::Status::Stage.new(content: stage))
|
|
131
131
|
end
|
|
@@ -135,12 +135,12 @@ module Relaton
|
|
|
135
135
|
|
|
136
136
|
@links = []
|
|
137
137
|
if @part
|
|
138
|
-
a = @doc.
|
|
138
|
+
a = @doc.at_xpath("//a[@href='#{@url}/#{@part}/PDF']")
|
|
139
139
|
@links << Bib::Uri.new(type: "src", content: a[:href]) if a
|
|
140
140
|
else
|
|
141
|
-
a = @doc.
|
|
141
|
+
a = @doc.at_xpath('//dt[.="This Document:"]/following-sibling::dd/a')
|
|
142
142
|
@links << Bib::Uri.new(type: "src", content: a[:href]) if a
|
|
143
|
-
pdf = @doc.
|
|
143
|
+
pdf = @doc.at_xpath('//a[@class="download-document"]')
|
|
144
144
|
@links << Bib::Uri.new(type: "pdf", content: pdf[:href]) if pdf
|
|
145
145
|
end
|
|
146
146
|
@links
|
|
@@ -149,9 +149,9 @@ module Relaton
|
|
|
149
149
|
def fetch_relation
|
|
150
150
|
v = @doc.xpath('//h2[.="History"]/following-sibling::section/div/table/tbody/tr')
|
|
151
151
|
v.reduce([]) do |mem, row|
|
|
152
|
-
ver = row.
|
|
152
|
+
ver = row.at_xpath("td").text
|
|
153
153
|
unless ver == doc_version
|
|
154
|
-
acronym = row.
|
|
154
|
+
acronym = row.at_xpath("td[3]/a")[:href].split("/")[4]
|
|
155
155
|
id = render_id(acronym, ver)
|
|
156
156
|
docid = Docidentifier.new(content: id, type: "OMG")
|
|
157
157
|
bibitem = Bib::ItemBase.new(formattedref: Bib::Formattedref.new(content: id), docidentifier: [docid])
|
data/lib/relaton/omg.rb
CHANGED
|
@@ -8,6 +8,7 @@ module Relaton
|
|
|
8
8
|
def initialize # rubocop:disable Lint/MissingSuper
|
|
9
9
|
@short = :relaton_plateau
|
|
10
10
|
@prefix = "PLATEAU"
|
|
11
|
+
@pubid_identifier = :Plateau # Db cache key
|
|
11
12
|
@defaultprefix = /^PLATEAU\s/
|
|
12
13
|
@idtype = "PLATEAU"
|
|
13
14
|
@datasets = %w[plateau-handbooks plateau-technical-reports]
|
|
@@ -15,25 +15,36 @@ module Relaton
|
|
|
15
15
|
"Could not access #{HitCollection::API_BASE}: #{e.message}"
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
-
# @param ref [String] document reference
|
|
18
|
+
# @param ref [String, Pubid::Un::Identifier] document reference
|
|
19
19
|
# @param year [String, NilClass]
|
|
20
20
|
# @param opts [Hash] options
|
|
21
21
|
# @return [Relaton::Bib::ItemData]
|
|
22
22
|
def get(ref, _year = nil, _opts = {})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Util.info "
|
|
28
|
-
|
|
29
|
-
else
|
|
30
|
-
Util.info "Not found.", key: ref
|
|
31
|
-
nil
|
|
23
|
+
key = ref.to_s
|
|
24
|
+
Util.info "Fetching from documents.un.org ...", key: key
|
|
25
|
+
item = isobib_search_filter(document_symbol(ref))&.item
|
|
26
|
+
unless item
|
|
27
|
+
Util.info "Not found.", key: key
|
|
28
|
+
return
|
|
32
29
|
end
|
|
30
|
+
|
|
31
|
+
Util.info "Found: `#{item.docidentifier[0].content}`", key: key
|
|
32
|
+
item
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
private
|
|
36
36
|
|
|
37
|
+
# The UN document symbol to search for. A parsed pubid renders it
|
|
38
|
+
# (`TRADE/CEFACT/2004/32`); a String may start with a `UN ` token.
|
|
39
|
+
#
|
|
40
|
+
# @param ref [String, Pubid::Un::Identifier]
|
|
41
|
+
# @return [String]
|
|
42
|
+
def document_symbol(ref)
|
|
43
|
+
return ref.to_s unless ref.is_a?(String)
|
|
44
|
+
|
|
45
|
+
ref[/^(?:UN\s)?(.*)/, 1]
|
|
46
|
+
end
|
|
47
|
+
|
|
37
48
|
# Search for hits.
|
|
38
49
|
#
|
|
39
50
|
# @param code [String] reference without correction
|
data/lib/relaton/un/processor.rb
CHANGED
data/lib/relaton/version.rb
CHANGED
data/lib/relaton.rb
CHANGED
|
@@ -5,6 +5,18 @@
|
|
|
5
5
|
# `require "relaton/<flavor>"`, loading that flavor's code on demand rather than
|
|
6
6
|
# at `require "relaton"`. When adding a flavor, add an autoload line here.
|
|
7
7
|
require "relaton/version"
|
|
8
|
+
require "moxml"
|
|
9
|
+
|
|
10
|
+
# YAML through yeptris (Psych-compatible drop-in; stdlib Psych is kept
|
|
11
|
+
# as Yeptris::Psych::ORIGINAL). Must load before any YAML/Psych use.
|
|
12
|
+
# yeptris 0.5 moved the exclusive drop-in rebind to yeptris/psych/drop_in
|
|
13
|
+
# — plain yeptris/psych only defines the namespace and leaves stdlib
|
|
14
|
+
# Psych in place (yeptris-ruby#95, bug 3).
|
|
15
|
+
# Load stdlib Psych first: the drop-in keeps it as Yeptris::Psych::ORIGINAL,
|
|
16
|
+
# and a later plain require "psych" against the rebound constant is a
|
|
17
|
+
# superclass mismatch (yeptris-ruby#95, bug 3 follow-on).
|
|
18
|
+
require "psych"
|
|
19
|
+
require "yeptris/psych/drop_in"
|
|
8
20
|
|
|
9
21
|
module Relaton
|
|
10
22
|
autoload :Logger, "relaton/logger"
|
|
@@ -46,6 +58,7 @@ module Relaton
|
|
|
46
58
|
autoload :Plateau, "relaton/plateau"
|
|
47
59
|
autoload :Doi, "relaton/doi"
|
|
48
60
|
autoload :Sdo, "relaton/sdo"
|
|
61
|
+
autoload :Cloud, "relaton/cloud"
|
|
49
62
|
|
|
50
63
|
# Global PubID prefix register (relaton-db#103). Maps an SDO document-ID
|
|
51
64
|
# prefix to the flavor module(s) that own it. Conflicting prefixes (e.g.
|
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.0.pre.alpha.
|
|
4
|
+
version: 3.0.0.pre.alpha.5
|
|
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-09-
|
|
11
|
+
date: 2026-09-30 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -302,14 +302,28 @@ dependencies:
|
|
|
302
302
|
requirements:
|
|
303
303
|
- - "~>"
|
|
304
304
|
- !ruby/object:Gem::Version
|
|
305
|
-
version: 0.8.
|
|
305
|
+
version: 0.8.76
|
|
306
306
|
type: :runtime
|
|
307
307
|
prerelease: false
|
|
308
308
|
version_requirements: !ruby/object:Gem::Requirement
|
|
309
309
|
requirements:
|
|
310
310
|
- - "~>"
|
|
311
311
|
- !ruby/object:Gem::Version
|
|
312
|
-
version: 0.8.
|
|
312
|
+
version: 0.8.76
|
|
313
|
+
- !ruby/object:Gem::Dependency
|
|
314
|
+
name: lutaml-store
|
|
315
|
+
requirement: !ruby/object:Gem::Requirement
|
|
316
|
+
requirements:
|
|
317
|
+
- - "~>"
|
|
318
|
+
- !ruby/object:Gem::Version
|
|
319
|
+
version: 0.3.2
|
|
320
|
+
type: :runtime
|
|
321
|
+
prerelease: false
|
|
322
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
323
|
+
requirements:
|
|
324
|
+
- - "~>"
|
|
325
|
+
- !ruby/object:Gem::Version
|
|
326
|
+
version: 0.3.2
|
|
313
327
|
- !ruby/object:Gem::Dependency
|
|
314
328
|
name: mechanize
|
|
315
329
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -353,19 +367,33 @@ dependencies:
|
|
|
353
367
|
- !ruby/object:Gem::Version
|
|
354
368
|
version: 0.3.4
|
|
355
369
|
- !ruby/object:Gem::Dependency
|
|
356
|
-
name:
|
|
370
|
+
name: moxml
|
|
371
|
+
requirement: !ruby/object:Gem::Requirement
|
|
372
|
+
requirements:
|
|
373
|
+
- - ">="
|
|
374
|
+
- !ruby/object:Gem::Version
|
|
375
|
+
version: '0.5'
|
|
376
|
+
type: :runtime
|
|
377
|
+
prerelease: false
|
|
378
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
379
|
+
requirements:
|
|
380
|
+
- - ">="
|
|
381
|
+
- !ruby/object:Gem::Version
|
|
382
|
+
version: '0.5'
|
|
383
|
+
- !ruby/object:Gem::Dependency
|
|
384
|
+
name: leptris
|
|
357
385
|
requirement: !ruby/object:Gem::Requirement
|
|
358
386
|
requirements:
|
|
359
387
|
- - ">="
|
|
360
388
|
- !ruby/object:Gem::Version
|
|
361
|
-
version:
|
|
389
|
+
version: 1.9.80
|
|
362
390
|
type: :runtime
|
|
363
391
|
prerelease: false
|
|
364
392
|
version_requirements: !ruby/object:Gem::Requirement
|
|
365
393
|
requirements:
|
|
366
394
|
- - ">="
|
|
367
395
|
- !ruby/object:Gem::Version
|
|
368
|
-
version:
|
|
396
|
+
version: 1.9.80
|
|
369
397
|
- !ruby/object:Gem::Dependency
|
|
370
398
|
name: parallel
|
|
371
399
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -395,33 +423,33 @@ dependencies:
|
|
|
395
423
|
- !ruby/object:Gem::Version
|
|
396
424
|
version: 2.0.0
|
|
397
425
|
- !ruby/object:Gem::Dependency
|
|
398
|
-
name:
|
|
426
|
+
name: pubid
|
|
399
427
|
requirement: !ruby/object:Gem::Requirement
|
|
400
428
|
requirements:
|
|
401
429
|
- - "~>"
|
|
402
430
|
- !ruby/object:Gem::Version
|
|
403
|
-
version:
|
|
431
|
+
version: 2.0.0.pre.alpha.13
|
|
404
432
|
type: :runtime
|
|
405
433
|
prerelease: false
|
|
406
434
|
version_requirements: !ruby/object:Gem::Requirement
|
|
407
435
|
requirements:
|
|
408
436
|
- - "~>"
|
|
409
437
|
- !ruby/object:Gem::Version
|
|
410
|
-
version:
|
|
438
|
+
version: 2.0.0.pre.alpha.13
|
|
411
439
|
- !ruby/object:Gem::Dependency
|
|
412
|
-
name:
|
|
440
|
+
name: yeptris
|
|
413
441
|
requirement: !ruby/object:Gem::Requirement
|
|
414
442
|
requirements:
|
|
415
|
-
- - "
|
|
443
|
+
- - ">="
|
|
416
444
|
- !ruby/object:Gem::Version
|
|
417
|
-
version:
|
|
445
|
+
version: '0.4'
|
|
418
446
|
type: :runtime
|
|
419
447
|
prerelease: false
|
|
420
448
|
version_requirements: !ruby/object:Gem::Requirement
|
|
421
449
|
requirements:
|
|
422
|
-
- - "
|
|
450
|
+
- - ">="
|
|
423
451
|
- !ruby/object:Gem::Version
|
|
424
|
-
version:
|
|
452
|
+
version: '0.4'
|
|
425
453
|
- !ruby/object:Gem::Dependency
|
|
426
454
|
name: rfcxml
|
|
427
455
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -523,6 +551,9 @@ files:
|
|
|
523
551
|
- lib/relaton/bib/converter/bibxml/from_rfcxml_referencegroup.rb
|
|
524
552
|
- lib/relaton/bib/converter/bibxml/to_rfcxml.rb
|
|
525
553
|
- lib/relaton/bib/converter/bibxml/to_rfcxml_referencegroup.rb
|
|
554
|
+
- lib/relaton/bib/converter/csl.rb
|
|
555
|
+
- lib/relaton/bib/converter/ris.rb
|
|
556
|
+
- lib/relaton/bib/converter/titles.rb
|
|
526
557
|
- lib/relaton/bib/hash_parser_v1.rb
|
|
527
558
|
- lib/relaton/bib/item_data.rb
|
|
528
559
|
- lib/relaton/bib/model/abstract.rb
|
|
@@ -676,6 +707,7 @@ files:
|
|
|
676
707
|
- lib/relaton/cie/processor.rb
|
|
677
708
|
- lib/relaton/cie/scrapper.rb
|
|
678
709
|
- lib/relaton/cie/util.rb
|
|
710
|
+
- lib/relaton/cloud.rb
|
|
679
711
|
- lib/relaton/core.rb
|
|
680
712
|
- lib/relaton/core/array_wrapper.rb
|
|
681
713
|
- lib/relaton/core/data_fetcher.rb
|
|
@@ -690,6 +722,7 @@ files:
|
|
|
690
722
|
- lib/relaton/core/workers_pool.rb
|
|
691
723
|
- lib/relaton/db.rb
|
|
692
724
|
- lib/relaton/db/cache.rb
|
|
725
|
+
- lib/relaton/db/cache_entry.rb
|
|
693
726
|
- lib/relaton/db/config.rb
|
|
694
727
|
- lib/relaton/db/registry.rb
|
|
695
728
|
- lib/relaton/db/util.rb
|
|
@@ -945,7 +978,6 @@ files:
|
|
|
945
978
|
- lib/relaton/itu/model/recommendation_status.rb
|
|
946
979
|
- lib/relaton/itu/model/structured_identifier.rb
|
|
947
980
|
- lib/relaton/itu/processor.rb
|
|
948
|
-
- lib/relaton/itu/pubid.rb
|
|
949
981
|
- lib/relaton/itu/radio_regulations_parser.rb
|
|
950
982
|
- lib/relaton/itu/recommendation_fields.rb
|
|
951
983
|
- lib/relaton/itu/recommendation_parser.rb
|