relaton 3.0.0.pre.alpha.14 → 3.0.0.pre.alpha.16
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/bibliography.rb +7 -2
- data/lib/relaton/3gpp.rb +4 -0
- data/lib/relaton/adobe/bibliography.rb +5 -2
- data/lib/relaton/adobe.rb +4 -0
- data/lib/relaton/bib/model/item_shared.rb +5 -1
- data/lib/relaton/bib/model/localized_string.rb +10 -0
- data/lib/relaton/bib/model/relation.rb +1 -1
- data/lib/relaton/bipm/bibliography.rb +5 -1
- data/lib/relaton/bipm.rb +4 -0
- data/lib/relaton/calconnect/hit_collection.rb +7 -2
- data/lib/relaton/calconnect.rb +4 -0
- data/lib/relaton/ccsds/hit_collection.rb +5 -1
- data/lib/relaton/ccsds.rb +4 -0
- data/lib/relaton/cie/scrapper.rb +5 -1
- data/lib/relaton/cie.rb +4 -0
- data/lib/relaton/db/cache.rb +10 -5
- data/lib/relaton/db/registry.rb +1 -1
- data/lib/relaton/easc/bibliography.rb +5 -2
- data/lib/relaton/easc.rb +4 -0
- data/lib/relaton/ecma/bibliography.rb +5 -1
- data/lib/relaton/ecma.rb +4 -0
- data/lib/relaton/etsi/bibliography.rb +5 -1
- data/lib/relaton/etsi.rb +4 -0
- data/lib/relaton/evs/bibliography.rb +138 -0
- data/lib/relaton/evs/hit.rb +32 -0
- data/lib/relaton/evs/hit_collection.rb +73 -0
- data/lib/relaton/evs/item_data.rb +7 -0
- data/lib/relaton/evs/model/bibdata.rb +8 -0
- data/lib/relaton/evs/model/bibitem.rb +8 -0
- data/lib/relaton/evs/model/docidentifier.rb +79 -0
- data/lib/relaton/evs/model/ext.rb +12 -0
- data/lib/relaton/evs/model/item.rb +14 -0
- data/lib/relaton/evs/model/structured_identifier.rb +9 -0
- data/lib/relaton/evs/processor.rb +50 -0
- data/lib/relaton/evs/scraper.rb +212 -0
- data/lib/relaton/evs/util.rb +8 -0
- data/lib/relaton/evs.rb +27 -0
- data/lib/relaton/gost/bibliography.rb +5 -2
- data/lib/relaton/gost.rb +4 -0
- data/lib/relaton/iala/bibliography.rb +5 -2
- data/lib/relaton/iala.rb +4 -0
- data/lib/relaton/iana/bibliography.rb +5 -2
- data/lib/relaton/iana.rb +4 -0
- data/lib/relaton/iec/hit_collection.rb +7 -2
- data/lib/relaton/iec.rb +4 -0
- data/lib/relaton/ieee/bibliography.rb +5 -1
- data/lib/relaton/ieee.rb +4 -0
- data/lib/relaton/ietf/scraper.rb +7 -2
- data/lib/relaton/ietf.rb +4 -0
- data/lib/relaton/iho/bibliography.rb +5 -2
- data/lib/relaton/iho/processor.rb +3 -0
- data/lib/relaton/iho.rb +4 -0
- data/lib/relaton/iso/hit_collection.rb +7 -2
- data/lib/relaton/iso.rb +4 -0
- data/lib/relaton/itu/hit_collection.rb +7 -2
- data/lib/relaton/itu/model/ext.rb +10 -0
- data/lib/relaton/itu.rb +4 -0
- data/lib/relaton/jcgm/bibliography.rb +5 -2
- data/lib/relaton/jcgm.rb +4 -0
- data/lib/relaton/nist/hit_collection.rb +20 -1
- data/lib/relaton/oasis/bibliography.rb +5 -2
- data/lib/relaton/oasis.rb +4 -0
- data/lib/relaton/ogc/hit_collection.rb +7 -2
- data/lib/relaton/ogc.rb +4 -0
- data/lib/relaton/oiml/bibliography.rb +5 -2
- data/lib/relaton/oiml.rb +4 -0
- data/lib/relaton/omg/bibliography.rb +40 -2
- data/lib/relaton/omg/scraper.rb +14 -2
- data/lib/relaton/omg.rb +11 -0
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/xsf/hit_collection.rb +5 -2
- data/lib/relaton/xsf.rb +4 -0
- data/lib/relaton.rb +1 -0
- metadata +20 -6
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Evs
|
|
3
|
+
# An EVS document identifier backed by `Pubid::Evs`.
|
|
4
|
+
#
|
|
5
|
+
# `content` stays a plain string, so serialization is unchanged; the parsed
|
|
6
|
+
# identifier lives beside it in `@pubid` and drives the three mutators.
|
|
7
|
+
# Follows `Relaton::Cen::Docidentifier`. The parse is on the DATA side: it
|
|
8
|
+
# lazily requires pubid and rescues `LoadError`/`StandardError`, so a
|
|
9
|
+
# non-EVS value or a code the grammar rejects stays verbatim with `@pubid`
|
|
10
|
+
# nil, and all three mutators no-op. A malformed *query* raises — see
|
|
11
|
+
# `Bibliography.parse`.
|
|
12
|
+
class Docidentifier < Bib::Docidentifier
|
|
13
|
+
# @return [Pubid::Evs::Identifier, nil]
|
|
14
|
+
attr_reader :pubid
|
|
15
|
+
|
|
16
|
+
# Capture the inherited (LocalizedMarkedUpString) content setter before
|
|
17
|
+
# overriding #content=, so #refresh_content! writes the re-rendered string
|
|
18
|
+
# back WITHOUT re-parsing it and discarding the mutation.
|
|
19
|
+
alias_method :store_content, :content=
|
|
20
|
+
|
|
21
|
+
def content=(value)
|
|
22
|
+
super
|
|
23
|
+
return unless value
|
|
24
|
+
|
|
25
|
+
@pubid = begin
|
|
26
|
+
require "pubid"
|
|
27
|
+
::Pubid::Evs.parse(value)
|
|
28
|
+
rescue LoadError, StandardError
|
|
29
|
+
nil
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Drops the LAST year, and only that one. On a supplement the identifier
|
|
34
|
+
# names the supplement (`EVS-EN ISO 9001:2015/A1:2024` is amendment A1 of
|
|
35
|
+
# 2024), so the supplement year goes first and the base document's year
|
|
36
|
+
# only when there is no supplement year.
|
|
37
|
+
def remove_date!
|
|
38
|
+
return unless @pubid
|
|
39
|
+
|
|
40
|
+
stripped = @pubid.exclude(:supplement_year)
|
|
41
|
+
stripped = @pubid.exclude(:year) if stripped == @pubid
|
|
42
|
+
replace_pubid stripped
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def remove_part!
|
|
46
|
+
return unless @pubid
|
|
47
|
+
|
|
48
|
+
replace_pubid @pubid.exclude(:part)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Strips the part and the date, then wraps `@pubid` in pubid's `AllParts`
|
|
52
|
+
# wrapper. `content` stays the plain part-and-date-stripped string on
|
|
53
|
+
# purpose (same trade-off as `Relaton::Cen::Docidentifier`); `#pubid`
|
|
54
|
+
# read directly answers `all_parts? == true` and renders WITH pubid's
|
|
55
|
+
# own "(all parts)" marker.
|
|
56
|
+
def to_all_parts!
|
|
57
|
+
return if !@pubid || @pubid.all_parts?
|
|
58
|
+
|
|
59
|
+
original = @pubid.exclude
|
|
60
|
+
remove_part!
|
|
61
|
+
remove_date!
|
|
62
|
+
@pubid = original.to_all_parts
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
# `Pubid#exclude` returns a COPY (the BSI/CEN shape), so the new
|
|
68
|
+
# identifier replaces the old one; it does not mutate in place.
|
|
69
|
+
def replace_pubid(new_pubid)
|
|
70
|
+
@pubid = new_pubid
|
|
71
|
+
refresh_content!
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def refresh_content!
|
|
75
|
+
store_content(@pubid.to_s) if @pubid
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require_relative "structured_identifier"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Evs
|
|
5
|
+
class Ext < Bib::Ext
|
|
6
|
+
attribute :structuredidentifier, StructuredIdentifier, collection: true, initialize_empty: true
|
|
7
|
+
|
|
8
|
+
# No `relaton-model-evs` gem exists yet, so the schema version stays the
|
|
9
|
+
# `Bib::Ext` default (nil), like the other model-less flavors.
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require_relative "../item_data"
|
|
2
|
+
require_relative "docidentifier"
|
|
3
|
+
require_relative "ext"
|
|
4
|
+
|
|
5
|
+
module Relaton
|
|
6
|
+
module Evs
|
|
7
|
+
class Item < Bib::Item
|
|
8
|
+
model ItemData
|
|
9
|
+
|
|
10
|
+
attribute :docidentifier, Docidentifier, collection: true, initialize_empty: true
|
|
11
|
+
attribute :ext, Ext
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require "relaton/core/processor"
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Evs
|
|
5
|
+
class Processor < Relaton::Core::Processor
|
|
6
|
+
def initialize # rubocop:disable Lint/MissingSuper
|
|
7
|
+
@short = :relaton_evs
|
|
8
|
+
@prefix = "EVS"
|
|
9
|
+
@pubid_flavor = :Evs
|
|
10
|
+
@defaultprefix = %r{^EVS[\s-]}
|
|
11
|
+
@idtype = "EVS"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
# @param code [String]
|
|
15
|
+
# @param date [String, NilClass] year
|
|
16
|
+
# @param opts [Hash]
|
|
17
|
+
# @return [Relaton::Evs::ItemData]
|
|
18
|
+
def get(code, date, opts)
|
|
19
|
+
require_relative "../evs"
|
|
20
|
+
::Relaton::Evs::Bibliography.get(code, date, opts)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# `Bibliography.get` applies a year to the document the reference names.
|
|
24
|
+
def fold_year(pubid, year)
|
|
25
|
+
fold_year_on_root pubid, year
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# @param xml [String]
|
|
29
|
+
# @return [Relaton::Evs::ItemData]
|
|
30
|
+
def from_xml(xml)
|
|
31
|
+
require_relative "../evs"
|
|
32
|
+
::Relaton::Evs::Item.from_xml xml
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# @param yaml [String]
|
|
36
|
+
# @return [Relaton::Evs::ItemData]
|
|
37
|
+
def from_yaml(yaml)
|
|
38
|
+
require_relative "../evs"
|
|
39
|
+
::Relaton::Evs::Item.from_yaml yaml
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Returns hash of XML grammar
|
|
43
|
+
# @return [String]
|
|
44
|
+
def grammar_hash
|
|
45
|
+
require_relative "../evs"
|
|
46
|
+
@grammar_hash ||= ::Relaton::Evs.grammar_hash
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Relaton
|
|
4
|
+
module Evs
|
|
5
|
+
# Scraper.
|
|
6
|
+
module Scraper
|
|
7
|
+
class << self
|
|
8
|
+
# Parse page.
|
|
9
|
+
# @param hit [Relaton::Evs::Hit]
|
|
10
|
+
# @return [Relaton::Evs::ItemData]
|
|
11
|
+
def parse_page(hit)
|
|
12
|
+
doc = hit.hit_collection.agent.get hit.hit[:url]
|
|
13
|
+
id = hit.pubid
|
|
14
|
+
lang = id&.language == "et" ? "et" : "en"
|
|
15
|
+
date = fetch_date(doc)
|
|
16
|
+
|
|
17
|
+
ItemData.new(
|
|
18
|
+
fetched: Date.today.to_s,
|
|
19
|
+
type: "standard",
|
|
20
|
+
docidentifier: fetch_docid(doc),
|
|
21
|
+
language: [lang],
|
|
22
|
+
script: ["Latn"],
|
|
23
|
+
title: fetch_titles(doc, lang),
|
|
24
|
+
date: date ? [date] : [],
|
|
25
|
+
contributor: fetch_contributors,
|
|
26
|
+
abstract: fetch_abstract(doc, lang),
|
|
27
|
+
copyright: fetch_copyright(doc, id),
|
|
28
|
+
source: fetch_source(hit.hit[:url]),
|
|
29
|
+
relation: fetch_relations(doc),
|
|
30
|
+
place: [Bib::Place.new(city: "Tallinn")],
|
|
31
|
+
ext: fetch_ext(doc, hit)
|
|
32
|
+
)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
# @param doc [Mechanize::Page]
|
|
38
|
+
# @return [Array<Relaton::Evs::Docidentifier>]
|
|
39
|
+
def fetch_docid(doc)
|
|
40
|
+
code = doc.at_xpath("//h1")&.text&.strip
|
|
41
|
+
return [] unless code
|
|
42
|
+
|
|
43
|
+
[Docidentifier.new(type: "EVS", content: code, primary: true)]
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# @param doc [Mechanize::Page]
|
|
47
|
+
# @param lang [String]
|
|
48
|
+
# @return [Array<Relaton::Bib::Title>]
|
|
49
|
+
def fetch_titles(doc, lang)
|
|
50
|
+
title = doc.at_xpath("//h2[contains(@class,'product-title')]")&.text&.strip
|
|
51
|
+
return [] unless title
|
|
52
|
+
|
|
53
|
+
# `from_string` splits on " - " into intro/main and returns an Array.
|
|
54
|
+
Bib::Title.from_string(title, lang, "Latn")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# The "Valid from" badge is the date the document entered into force.
|
|
58
|
+
#
|
|
59
|
+
# @param doc [Mechanize::Page]
|
|
60
|
+
# @return [Relaton::Bib::Date, nil]
|
|
61
|
+
def fetch_date(doc)
|
|
62
|
+
badge = doc.at_xpath(
|
|
63
|
+
"//div[contains(@class,'product-info-badge')][contains(., 'Valid from')]",
|
|
64
|
+
)
|
|
65
|
+
return unless badge
|
|
66
|
+
|
|
67
|
+
d = badge.text.match(/(\d{2})\.(\d{2})\.(\d{4})/)
|
|
68
|
+
return unless d
|
|
69
|
+
|
|
70
|
+
Bib::Date.new(type: "published", at: "#{d[3]}-#{d[2]}-#{d[1]}")
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
# @return [Array<Relaton::Bib::Contributor>]
|
|
74
|
+
def fetch_contributors
|
|
75
|
+
role = Bib::Contributor::Role.new(type: "publisher")
|
|
76
|
+
[Bib::Contributor.new(role: [role], organization: evs_org)]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# @param doc [Mechanize::Page]
|
|
80
|
+
# @param lang [String]
|
|
81
|
+
# @return [Array<Relaton::Bib::Abstract>]
|
|
82
|
+
def fetch_abstract(doc, lang)
|
|
83
|
+
scope = doc.at_xpath("//div[@id='tab-1']")&.text&.strip
|
|
84
|
+
return [] unless scope
|
|
85
|
+
|
|
86
|
+
[Bib::Abstract.new(content: scope, language: lang, script: "Latn")]
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# @param doc [Mechanize::Page]
|
|
90
|
+
# @param id [Pubid::Evs::Identifier, nil]
|
|
91
|
+
# @return [Array<Bib::Copyright>]
|
|
92
|
+
def fetch_copyright(doc, id)
|
|
93
|
+
from = id&.root&.year&.to_s
|
|
94
|
+
from ||= fetch_date(doc)&.at&.to_s&.slice(0, 4)
|
|
95
|
+
return [] unless from
|
|
96
|
+
|
|
97
|
+
owner = Bib::ContributionInfo.new(organization: evs_org)
|
|
98
|
+
[Bib::Copyright.new(owner: [owner], from: from)]
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# @param url [String]
|
|
102
|
+
# @return [Array<Relaton::Bib::Uri>]
|
|
103
|
+
def fetch_source(url)
|
|
104
|
+
[Bib::Uri.new(type: "src", content: url)]
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# The "Base Documents" group names the documents this record adopts:
|
|
108
|
+
# the European document for a national adoption (`EN 18216:2026`), the
|
|
109
|
+
# international document for a direct adoption. A double adoption
|
|
110
|
+
# lists both in one text node ("ISO 14001:2026; EN ISO 14001:2026"),
|
|
111
|
+
# so the pieces split on the semicolon. Each becomes an `adoptedFrom`
|
|
112
|
+
# relation.
|
|
113
|
+
#
|
|
114
|
+
# @param doc [Mechanize::Page]
|
|
115
|
+
# @return [Array<Relaton::Bib::Relation>]
|
|
116
|
+
def fetch_relations(doc)
|
|
117
|
+
group = doc.at_xpath(
|
|
118
|
+
"//div[contains(@class,'product-ics-group')]" \
|
|
119
|
+
"[div[contains(., 'Base Documents')]]",
|
|
120
|
+
)
|
|
121
|
+
return [] unless group
|
|
122
|
+
|
|
123
|
+
bases(group).map do |base|
|
|
124
|
+
Bib::Relation.new(
|
|
125
|
+
type: "adoptedFrom",
|
|
126
|
+
bibitem: ItemData.new(
|
|
127
|
+
formattedref: Bib::Formattedref.new(content: base),
|
|
128
|
+
type: "standard",
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def bases(group)
|
|
135
|
+
group.xpath("./a | ./text()").map(&:text)
|
|
136
|
+
.flat_map { |t| t.split(";") }.map(&:strip)
|
|
137
|
+
.reject(&:empty?).uniq
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# @param doc [Mechanize::Page]
|
|
141
|
+
# @return [Array<Relaton::Bib::ICS>]
|
|
142
|
+
def fetch_ics(doc)
|
|
143
|
+
doc.xpath(
|
|
144
|
+
"//div[contains(@class,'product-group-heading')][contains(., 'ICS')]",
|
|
145
|
+
).each_with_object([]) do |heading, acc|
|
|
146
|
+
heading.parent.xpath("./a").each do |a|
|
|
147
|
+
code = a.text.strip[/^[\d.]+/]
|
|
148
|
+
next if code.nil? || acc.any? { |ics| ics.code == code }
|
|
149
|
+
|
|
150
|
+
isoics = Isoics.fetch code
|
|
151
|
+
acc << Bib::ICS.new(code: code, text: isoics.description)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
# @param doc [Mechanize::Page]
|
|
157
|
+
# @param hit [Relaton::Evs::Hit]
|
|
158
|
+
# @return [Relaton::Evs::Ext]
|
|
159
|
+
def fetch_ext(doc, hit)
|
|
160
|
+
Ext.new(
|
|
161
|
+
doctype: fetch_doctype(hit.pubid),
|
|
162
|
+
flavor: "evs",
|
|
163
|
+
ics: fetch_ics(doc),
|
|
164
|
+
structuredidentifier: fetch_structuredid(hit.pubid),
|
|
165
|
+
)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
# The shared ext grammar requires a doctype. The TS and TR faces of a
|
|
169
|
+
# plain Estonian standard map to their document types; every other
|
|
170
|
+
# form is a standard.
|
|
171
|
+
#
|
|
172
|
+
# @param id [Pubid::Evs::Identifier, nil]
|
|
173
|
+
# @return [Relaton::Bib::Doctype]
|
|
174
|
+
def fetch_doctype(id)
|
|
175
|
+
evs_type = id&.evs_type if id&.respond_to?(:evs_type)
|
|
176
|
+
case evs_type
|
|
177
|
+
when "TS" then Bib::Doctype.new(content: "technical-specification")
|
|
178
|
+
when "TR" then Bib::Doctype.new(content: "technical-report")
|
|
179
|
+
else Bib::Doctype.new(content: "standard")
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
# `#root` is the accessor that answers for every form: a national
|
|
184
|
+
# adoption keeps the origin standard's number and part behind its
|
|
185
|
+
# `base` chain.
|
|
186
|
+
#
|
|
187
|
+
# @param id [Pubid::Evs::Identifier, nil]
|
|
188
|
+
# @return [Relaton::Evs::StructuredIdentifier]
|
|
189
|
+
def fetch_structuredid(id)
|
|
190
|
+
root = id&.root
|
|
191
|
+
StructuredIdentifier.new(
|
|
192
|
+
docnumber: root&.number&.to_s,
|
|
193
|
+
partnumber: root&.part.to_s,
|
|
194
|
+
agency: ["EVS"],
|
|
195
|
+
)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# @return [Hash]
|
|
199
|
+
def evs_org
|
|
200
|
+
@evs_org ||= begin
|
|
201
|
+
name = Bib::TypedLocalizedString.new(
|
|
202
|
+
content: "Eesti Standardimis- ja Akrediteerimiskeskus",
|
|
203
|
+
)
|
|
204
|
+
abbr = Bib::TypedLocalizedString.new(content: "EVS")
|
|
205
|
+
uri = Bib::Uri.new(content: "https://www.evs.ee")
|
|
206
|
+
Bib::Organization.new(name: [name], abbreviation: abbr, uri: [uri])
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
data/lib/relaton/evs.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "digest/md5"
|
|
4
|
+
require "mechanize"
|
|
5
|
+
require "relaton/core"
|
|
6
|
+
require "isoics"
|
|
7
|
+
require "pubid"
|
|
8
|
+
require "relaton/bib"
|
|
9
|
+
require_relative "version"
|
|
10
|
+
require_relative "evs/util"
|
|
11
|
+
require_relative "evs/model/item"
|
|
12
|
+
require_relative "evs/model/bibitem"
|
|
13
|
+
require_relative "evs/model/bibdata"
|
|
14
|
+
require_relative "evs/scraper"
|
|
15
|
+
require_relative "evs/hit_collection"
|
|
16
|
+
require_relative "evs/hit"
|
|
17
|
+
require_relative "evs/bibliography"
|
|
18
|
+
|
|
19
|
+
module Relaton
|
|
20
|
+
module Evs
|
|
21
|
+
# Returns hash of XML grammar
|
|
22
|
+
# @return [String]
|
|
23
|
+
def self.grammar_hash
|
|
24
|
+
Digest::MD5.hexdigest Relaton::VERSION # grammars
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -73,10 +73,13 @@ module Relaton
|
|
|
73
73
|
private
|
|
74
74
|
|
|
75
75
|
def index
|
|
76
|
+
# The machine index on the Pages site (relaton#206): a parsed query
|
|
77
|
+
# reads only its own shard; a Pages failure raises
|
|
78
|
+
# `Relaton::RequestError`; the whole-index zip on the same site
|
|
79
|
+
# serves only the retry on a miss.
|
|
76
80
|
Relaton::Index.find_or_create(
|
|
77
81
|
:gost,
|
|
78
|
-
|
|
79
|
-
file: "#{INDEXFILE}.yaml",
|
|
82
|
+
pages_url: PAGES_URL,
|
|
80
83
|
pubid_class: ::Pubid::Gost::Identifier,
|
|
81
84
|
)
|
|
82
85
|
end
|
data/lib/relaton/gost.rb
CHANGED
|
@@ -12,6 +12,10 @@ require "relaton/version"
|
|
|
12
12
|
module Relaton
|
|
13
13
|
module Gost
|
|
14
14
|
INDEXFILE = "index-v2".freeze
|
|
15
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
16
|
+
# manifest + per-shard rows read by the consumer's index; the zip stays
|
|
17
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
18
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-gost/"
|
|
15
19
|
|
|
16
20
|
class Error < StandardError; end
|
|
17
21
|
|
|
@@ -136,10 +136,13 @@ module Relaton
|
|
|
136
136
|
# `id.root.number`, and let `Type#search` bsearch. Without it the rows
|
|
137
137
|
# stay raw hashes and every lookup scans all 701 of them.
|
|
138
138
|
def index
|
|
139
|
+
# The machine index on the Pages site (relaton#206): a parsed query
|
|
140
|
+
# reads only its own shard; a Pages failure raises
|
|
141
|
+
# `Relaton::RequestError`; the whole-index zip on the same site
|
|
142
|
+
# serves only the retry on a miss.
|
|
139
143
|
Relaton::Index.find_or_create(
|
|
140
144
|
:iala,
|
|
141
|
-
|
|
142
|
-
file: "#{INDEXFILE}.yaml",
|
|
145
|
+
pages_url: PAGES_URL,
|
|
143
146
|
pubid_class: ::Pubid::Iala::Identifier,
|
|
144
147
|
)
|
|
145
148
|
end
|
data/lib/relaton/iala.rb
CHANGED
|
@@ -10,6 +10,10 @@ require "relaton/version"
|
|
|
10
10
|
module Relaton
|
|
11
11
|
module Iala
|
|
12
12
|
INDEXFILE = "index-v2".freeze
|
|
13
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
14
|
+
# manifest + per-shard rows read by the consumer's index; the zip stays
|
|
15
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
16
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-iala/"
|
|
13
17
|
|
|
14
18
|
class Error < StandardError; end
|
|
15
19
|
|
|
@@ -53,8 +53,11 @@ module Relaton
|
|
|
53
53
|
private
|
|
54
54
|
|
|
55
55
|
def index
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
# The machine index on the Pages site (relaton#206): a parsed query
|
|
57
|
+
# reads only its own shard; a Pages failure raises
|
|
58
|
+
# `Relaton::RequestError`; the whole-index zip on the same site
|
|
59
|
+
# serves only the retry on a miss.
|
|
60
|
+
Relaton::Index.find_or_create :iana, pages_url: PAGES_URL,
|
|
58
61
|
pubid_class: ::Pubid::Iana::Identifier
|
|
59
62
|
end
|
|
60
63
|
|
data/lib/relaton/iana.rb
CHANGED
|
@@ -27,6 +27,10 @@ module Relaton
|
|
|
27
27
|
# emitted by `relaton-data-iana`'s own `crawler.rb`, derived from `index-v2`,
|
|
28
28
|
# so released gem lines keep resolving. See lib/relaton/iana/CLAUDE.md.
|
|
29
29
|
INDEXFILE = "index-v2".freeze
|
|
30
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
31
|
+
# manifest + per-shard rows read by the consumer's index; the zip stays
|
|
32
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
33
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-iana/"
|
|
30
34
|
|
|
31
35
|
# Returns hash of XML reammar
|
|
32
36
|
# @return [String]
|
|
@@ -47,11 +47,16 @@ module Relaton
|
|
|
47
47
|
[pubid.part.to_s.to_i, sub.to_s.to_i]
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
#
|
|
51
|
+
# The machine index on the Pages site (relaton#206, the W3C pilot's
|
|
52
|
+
# contract): a parsed query reads only its own shard. A Pages failure
|
|
53
|
+
# raises `Relaton::RequestError`; the whole-index zip on the same site
|
|
54
|
+
# serves only the retry on a miss.
|
|
55
|
+
#
|
|
50
56
|
def index
|
|
51
57
|
@index ||= Relaton::Index.find_or_create(
|
|
52
58
|
:IEC,
|
|
53
|
-
|
|
54
|
-
file: "#{INDEXFILE}.yaml",
|
|
59
|
+
pages_url: PAGES_URL,
|
|
55
60
|
pubid_class: ::Pubid::Iec::Identifier
|
|
56
61
|
)
|
|
57
62
|
end
|
data/lib/relaton/iec.rb
CHANGED
|
@@ -21,6 +21,10 @@ require_relative "iec/model/bibdata"
|
|
|
21
21
|
module Relaton
|
|
22
22
|
module Iec
|
|
23
23
|
INDEXFILE = "index-v2".freeze
|
|
24
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
25
|
+
# manifest + per-shard rows read by HitCollection's index; the zip stays
|
|
26
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
27
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-iec/"
|
|
24
28
|
|
|
25
29
|
class << self
|
|
26
30
|
# Returns hash of XML reammar
|
|
@@ -13,7 +13,11 @@ module Relaton
|
|
|
13
13
|
# @return [Relaton::Ieee::ItemData, nil]
|
|
14
14
|
#
|
|
15
15
|
def search(ref) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
|
16
|
-
index
|
|
16
|
+
# The machine index on the Pages site (relaton#206, the W3C
|
|
17
|
+
# pilot's contract): a parsed query reads only its own shard. A
|
|
18
|
+
# Pages failure raises `Relaton::RequestError`; the whole-index
|
|
19
|
+
# zip on the same site serves only the retry on a miss.
|
|
20
|
+
index = Relaton::Index.find_or_create :ieee, pages_url: PAGES_URL,
|
|
17
21
|
pubid_class: ::Pubid::Ieee::Identifier
|
|
18
22
|
# Pass the parsed pubid (not the raw String) so index-v2 narrows
|
|
19
23
|
# candidates by number via binary search before the block runs; the
|
data/lib/relaton/ieee.rb
CHANGED
|
@@ -17,6 +17,10 @@ module Relaton
|
|
|
17
17
|
class Error < StandardError; end
|
|
18
18
|
|
|
19
19
|
INDEXFILE = "index-v2".freeze
|
|
20
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
21
|
+
# manifest + per-shard rows read by Bibliography's index; the zip stays
|
|
22
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
23
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-ieee/"
|
|
20
24
|
|
|
21
25
|
# Returns hash of XML reammar
|
|
22
26
|
# @return [String]
|
data/lib/relaton/ietf/scraper.rb
CHANGED
|
@@ -47,10 +47,15 @@ module Relaton
|
|
|
47
47
|
get_page "#{IETF}#{row[:file]}" if row
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
#
|
|
51
|
+
# The machine index on the Pages site (relaton#206, the W3C pilot's
|
|
52
|
+
# contract): a parsed query reads only its own shard. A Pages failure
|
|
53
|
+
# raises `Relaton::RequestError`; the whole-index zip on the same site
|
|
54
|
+
# serves only the case-insensitive retry on a miss.
|
|
55
|
+
#
|
|
50
56
|
def index
|
|
51
57
|
Relaton::Index.find_or_create(
|
|
52
|
-
:IETF,
|
|
53
|
-
pubid_class: ::Pubid::Ietf::Identifier
|
|
58
|
+
:IETF, pages_url: PAGES_URL, pubid_class: ::Pubid::Ietf::Identifier
|
|
54
59
|
)
|
|
55
60
|
end
|
|
56
61
|
|
data/lib/relaton/ietf.rb
CHANGED
|
@@ -18,6 +18,10 @@ module Relaton
|
|
|
18
18
|
# (relaton#109). One constant again now that both sides are on it — the
|
|
19
19
|
# second one existed only while producer and consumer were split.
|
|
20
20
|
INDEXFILE = "index-v2".freeze
|
|
21
|
+
# The machine index on the data repo's Pages site (relaton#189, #206) —
|
|
22
|
+
# manifest + per-shard rows read by Scraper's index; the zip stays on the
|
|
23
|
+
# Pages site for the whole-index retry on a case-insensitive miss.
|
|
24
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-ietf/".freeze
|
|
21
25
|
# Returns hash of XML reammar
|
|
22
26
|
# @return [String]
|
|
23
27
|
def self.grammar_hash
|
|
@@ -85,10 +85,13 @@ module Relaton
|
|
|
85
85
|
private
|
|
86
86
|
|
|
87
87
|
def index
|
|
88
|
+
# The machine index on the Pages site (relaton#206): a parsed query
|
|
89
|
+
# reads only its own shard; a Pages failure raises
|
|
90
|
+
# `Relaton::RequestError`; the whole-index zip on the same site
|
|
91
|
+
# serves only the retry on a miss.
|
|
88
92
|
Relaton::Index.find_or_create(
|
|
89
93
|
:iho,
|
|
90
|
-
|
|
91
|
-
file: "#{INDEXFILE}.yaml",
|
|
94
|
+
pages_url: PAGES_URL,
|
|
92
95
|
pubid_class: ::Pubid::Iho::Identifier,
|
|
93
96
|
)
|
|
94
97
|
end
|
data/lib/relaton/iho.rb
CHANGED
|
@@ -12,6 +12,10 @@ require_relative "iho/bibliography"
|
|
|
12
12
|
module Relaton
|
|
13
13
|
module Iho
|
|
14
14
|
INDEXFILE = "index-v3".freeze
|
|
15
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
16
|
+
# manifest + per-shard rows read by the consumer's index; the zip stays
|
|
17
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
18
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-iho/"
|
|
15
19
|
|
|
16
20
|
class Error < StandardError; end
|
|
17
21
|
|
|
@@ -148,11 +148,16 @@ module Relaton
|
|
|
148
148
|
pubid.typed_stage.stage_code.to_s == "published"
|
|
149
149
|
end
|
|
150
150
|
|
|
151
|
+
#
|
|
152
|
+
# The machine index on the Pages site (relaton#206, the W3C pilot's
|
|
153
|
+
# contract): a parsed query reads only its own shard. A Pages failure
|
|
154
|
+
# raises `Relaton::RequestError`; the whole-index zip on the same site
|
|
155
|
+
# serves only the retry on a miss.
|
|
156
|
+
#
|
|
151
157
|
def index
|
|
152
158
|
@index ||= Relaton::Index.find_or_create(
|
|
153
159
|
:iso,
|
|
154
|
-
|
|
155
|
-
file: "#{INDEXFILE}.yaml",
|
|
160
|
+
pages_url: PAGES_URL,
|
|
156
161
|
pubid_class: ::Pubid::Iso::Identifier,
|
|
157
162
|
)
|
|
158
163
|
end
|
data/lib/relaton/iso.rb
CHANGED
|
@@ -19,6 +19,10 @@ require_relative "iso/bibliography"
|
|
|
19
19
|
module Relaton
|
|
20
20
|
module Iso
|
|
21
21
|
INDEXFILE = "index-v2"
|
|
22
|
+
# The machine index on the data repo's Pages site (relaton#206) —
|
|
23
|
+
# manifest + per-shard rows read by HitCollection's index; the zip stays
|
|
24
|
+
# on the Pages site for the whole-index retry on a miss.
|
|
25
|
+
PAGES_URL = "https://relaton.github.io/relaton-data-iso/"
|
|
22
26
|
|
|
23
27
|
def self.grammar_hash
|
|
24
28
|
# gem_path = File.expand_path "..", __dir__
|