relaton-nist 1.11.0 → 1.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/lib/relaton_nist/data_fetcher.rb +44 -14
- data/lib/relaton_nist/hit_collection.rb +2 -5
- data/lib/relaton_nist/series.yaml +49 -0
- data/lib/relaton_nist/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b0ce8787fdc41eb5b334df6e1d8f65c2bbfe6437ab8b36124d917c7549a869
|
4
|
+
data.tar.gz: d9b3bd1f467450a874ba8f9bc8d98c669a3296a0014c6083b248522bb4f6cd2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: beb5e04d0d431263d209e5172a419b940afe614888fd7a9158c360b7277d61312edf8824fef3989608a543c3bb36bd8612d1e737a07e7349d027aa9578d6c829
|
7
|
+
data.tar.gz: f46f37e146aedc51b9d91896ba38604af5bb95cc93e2d19c17e4f3894cffe5adac98fd05b176aa6830bed802b30e8163371d38caa25021742dc91fc8b0d11a10
|
data/Gemfile
CHANGED
@@ -75,7 +75,9 @@ module RelatonNist
|
|
75
75
|
t = doc.xpath("titles/title|titles/subtitle")
|
76
76
|
return [] unless t.any?
|
77
77
|
|
78
|
-
RelatonBib::TypedTitleString.from_string t.map(&:text).join, "en", "Latn"
|
78
|
+
# RelatonBib::TypedTitleString.from_string t.map(&:text).join, "en", "Latn"
|
79
|
+
[{ content: t.map(&:text).join, language: "en", script: "Latn",
|
80
|
+
format: "text/plain" }]
|
79
81
|
end
|
80
82
|
|
81
83
|
# @param doc [Nokogiri::XML::Element]
|
@@ -156,20 +158,37 @@ module RelatonNist
|
|
156
158
|
{ entity: person, role: [{ type: p["contributor_role"] }] }
|
157
159
|
end
|
158
160
|
contribs + doc.xpath("publisher").map do |p|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
161
|
+
{ entity: create_org(p), role: [{ type: "publisher" }] }
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
165
|
+
#
|
166
|
+
# Create publisher organization
|
167
|
+
#
|
168
|
+
# @param [Nokogiri::XML::Element] pub publisher element
|
169
|
+
#
|
170
|
+
# @return [RelatonBib::Organization] publisher organization
|
171
|
+
#
|
172
|
+
def create_org(pub)
|
173
|
+
name = pub.at("publisher_name").text
|
174
|
+
abbr = pub.at("../institution[institution_name[.='#{name}']]/institution_acronym")&.text
|
175
|
+
place = pub.at("./publisher_place") ||
|
176
|
+
pub.at("../institution[institution_name[.='#{name}']]/institution_place")
|
177
|
+
cont = []
|
178
|
+
if place
|
179
|
+
city, state = place.text.split(", ")
|
180
|
+
cont << RelatonBib::Address.new(street: [], city: city, state: state, country: "US")
|
170
181
|
end
|
182
|
+
RelatonBib::Organization.new name: name, abbreviation: abbr, contact: cont
|
171
183
|
end
|
172
184
|
|
185
|
+
#
|
186
|
+
# Create affiliation organization
|
187
|
+
#
|
188
|
+
# @param [Nokogiri::XML::Element] doc affiliation element
|
189
|
+
#
|
190
|
+
# @return [Array<RelatonBib::Affiliation>] affiliation
|
191
|
+
#
|
173
192
|
def affiliation(doc)
|
174
193
|
doc.xpath("./institution/institution_department").map do |id|
|
175
194
|
org = RelatonBib::Organization.new name: id.text
|
@@ -183,9 +202,20 @@ module RelatonNist
|
|
183
202
|
doc.xpath("institution/institution_place").map(&:text)
|
184
203
|
end
|
185
204
|
|
205
|
+
#
|
206
|
+
# Fetches series
|
207
|
+
#
|
208
|
+
# @param [Nokogiri::XML::Element] doc document element
|
209
|
+
#
|
210
|
+
# @return [Array<RelatonBib::Series>] series
|
211
|
+
#
|
186
212
|
def fetch_series(doc)
|
187
|
-
|
188
|
-
|
213
|
+
series_path = File.expand_path("series.yaml", __dir__)
|
214
|
+
series = YAML.load_file series_path
|
215
|
+
prf, srs, = pub_id(doc).split
|
216
|
+
sname = series[srs] || srs
|
217
|
+
title = RelatonBib::TypedTitleString.new(content: "#{prf} #{sname}")
|
218
|
+
[RelatonBib::Series.new(title: title, number: "#{prf} #{srs}")]
|
189
219
|
end
|
190
220
|
|
191
221
|
#
|
@@ -137,7 +137,7 @@ module RelatonNist
|
|
137
137
|
# @return [Hash]
|
138
138
|
def data
|
139
139
|
ctime = File.ctime DATAFILE if File.exist? DATAFILE
|
140
|
-
if !ctime || ctime.to_date < Date.today
|
140
|
+
if !ctime || ctime.to_date < Date.today || File.size(DATAFILE).zero?
|
141
141
|
fetch_data(ctime)
|
142
142
|
end
|
143
143
|
unzip
|
@@ -163,10 +163,7 @@ module RelatonNist
|
|
163
163
|
return @data if @data
|
164
164
|
|
165
165
|
Zip::File.open(DATAFILE) do |zf|
|
166
|
-
zf.
|
167
|
-
@data = JSON.parse f.get_input_stream.read
|
168
|
-
break
|
169
|
-
end
|
166
|
+
@data = JSON.parse zf.first.get_input_stream.read
|
170
167
|
end
|
171
168
|
@data
|
172
169
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
AMS: Advanced Manufacturing Series
|
3
|
+
BRPD: Basic Radio Propagation Predictions Series
|
4
|
+
BH: Building and Housing Reports
|
5
|
+
BMS: Building Materials and Structures Reports
|
6
|
+
BSS: Building Science Series
|
7
|
+
CRPL: CRPL Solar-Geophysical Data
|
8
|
+
IP: CRPL Ionospheric Predictions
|
9
|
+
CIRC: Circulars
|
10
|
+
CIS: Consumer Information Series
|
11
|
+
CS: Commercial Standards
|
12
|
+
CSM: Commercial Standards Monthly
|
13
|
+
CSWP: Cybersecurity White Papers
|
14
|
+
EAB: Economic Analysis Briefs
|
15
|
+
FIPS: Federal Information Processing Standards Publications
|
16
|
+
GCR: Grant/Contractor Reports
|
17
|
+
HB: Handbooks
|
18
|
+
HR: Hydraulic Research in the United States
|
19
|
+
IRPL: Interservice Radio Propagation Laboratory
|
20
|
+
LCIRC: Letter Circular
|
21
|
+
MONO: Monographs
|
22
|
+
MP: Miscellaneous Publications
|
23
|
+
NCSTAR: National Construction Safety Team Act Reports
|
24
|
+
NSRDS: National Standard Reference Data Series
|
25
|
+
IR: NISTIRs (Interagency/Internal Reports)
|
26
|
+
OWMWP: Office of Weights and Measures White Papers
|
27
|
+
PC: Photographic Circulars
|
28
|
+
RPT: NBS Reports
|
29
|
+
SIBS: Special Interior Ballistics Studies
|
30
|
+
SP: Special Publications (General)
|
31
|
+
SP250: 'SP 250: Calibration Services'
|
32
|
+
SP260: 'SP 260: Standard Reference Materials'
|
33
|
+
SP300: 'SP 300: Precision Measurement and Calibration'
|
34
|
+
SP400: 'SP 400: Semiconductor Measurement Technology'
|
35
|
+
SP480: 'SP 480: Law Enforcement Technology'
|
36
|
+
SP500: 'SP 500: Computer Systems Technology'
|
37
|
+
SP700: 'SP 700: Industrial Measurement Series'
|
38
|
+
SP800: 'SP 800: Computer Security Series'
|
39
|
+
SP823: 'SP 823: Integrated Services Digital Network Series'
|
40
|
+
SP960: 'SP 960: NIST Recommended Practice Guides'
|
41
|
+
SP1200: 'SP 1200: Protocols'
|
42
|
+
SP1500: 'SP 1500: Working Group Papers'
|
43
|
+
SP1800: 'SP 1800: NIST Cybersecurity Practice Guides'
|
44
|
+
SP1900: 'SP 1900: Cyber-Physical Systems'
|
45
|
+
SP2000: 'SP 2000: Standards Coordination'
|
46
|
+
SP2100: 'SP 2100: Conference Proceedings'
|
47
|
+
TIBM: Technical Information on Building Materials
|
48
|
+
TN: Technical Notes
|
49
|
+
TTB: Technology Transfer Brief
|
data/lib/relaton_nist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-nist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -185,6 +185,7 @@ files:
|
|
185
185
|
- lib/relaton_nist/nist_bibliography.rb
|
186
186
|
- lib/relaton_nist/processor.rb
|
187
187
|
- lib/relaton_nist/scrapper.rb
|
188
|
+
- lib/relaton_nist/series.yaml
|
188
189
|
- lib/relaton_nist/version.rb
|
189
190
|
- lib/relaton_nist/xml_parser.rb
|
190
191
|
- relaton_nist.gemspec
|