relaton-nist 1.11.1 → 1.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -5
- data/.rubocop.yml +1 -1
- data/lib/relaton_nist/data_fetcher.rb +49 -17
- data/lib/relaton_nist/series.yaml +49 -0
- data/lib/relaton_nist/version.rb +1 -1
- data/relaton_nist.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd5360f481616f8a73bdc1f9be82bb5f94bb71a5d3d6c495e301862d7e445c4b
|
4
|
+
data.tar.gz: 0563adfa8d462ec73b9546902d426e347c36ef2d286f518dd7dcf25225ad9238
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade1d018045194a89b6f9e34e7f78ef4979b33c73a9a1dd6a3cbe65101040bc734c188c4e9e658b59412d2c5071d0ea80c74e05c73dde050d795381f685cd023
|
7
|
+
data.tar.gz: cb6339da72a21fb733f5abe3922b2c9e62b1d01214400a872db7244b39a0db52af04233463f0a3093f50c03227cc21a709a86c18b6aff1842340dffee447b75d
|
data/.github/workflows/rake.yml
CHANGED
@@ -16,7 +16,7 @@ jobs:
|
|
16
16
|
strategy:
|
17
17
|
fail-fast: false
|
18
18
|
matrix:
|
19
|
-
ruby: [ '3.0', '2.7', '2.6'
|
19
|
+
ruby: [ '3.0', '2.7', '2.6' ]
|
20
20
|
os: [ ubuntu-latest, windows-latest, macos-latest ]
|
21
21
|
experimental: [ false ]
|
22
22
|
steps:
|
@@ -24,10 +24,6 @@ jobs:
|
|
24
24
|
with:
|
25
25
|
submodules: true
|
26
26
|
|
27
|
-
# https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
|
28
|
-
- if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
|
29
|
-
run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
|
30
|
-
|
31
27
|
- uses: ruby/setup-ruby@v1
|
32
28
|
with:
|
33
29
|
ruby-version: ${{ matrix.ruby }}
|
data/.rubocop.yml
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]
|
@@ -101,12 +103,14 @@ module RelatonNist
|
|
101
103
|
|
102
104
|
# @param doc [Nokogiri::XML::Element]
|
103
105
|
# @return [Array<Hash>]
|
104
|
-
def fetch_relation(doc)
|
106
|
+
def fetch_relation(doc) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
105
107
|
ns = "http://www.crossref.org/relations.xsd"
|
106
108
|
doc.xpath("./ns:program/ns:related_item", ns: ns).map do |rel|
|
107
109
|
rdoi = rel.at_xpath("ns:intra_work_relation|ns:inter_work_relation", ns: ns)
|
108
|
-
|
109
|
-
|
110
|
+
id = rdoi.text.split("/")[1..].join("/").gsub(".", " ")
|
111
|
+
fref = RelatonBib::FormattedRef.new content: id
|
112
|
+
docid = RelatonBib::DocumentIdentifier.new(type: "NIST", id: id, primary: true)
|
113
|
+
bibitem = RelatonBib::BibliographicItem.new formattedref: fref, docid: [docid]
|
110
114
|
type = RELATION_TYPES[rdoi["relationship-type"]]
|
111
115
|
warn "Relation type #{rdoi['relationship-type']} not found" unless type
|
112
116
|
{ type: type, bibitem: bibitem }
|
@@ -156,20 +160,37 @@ module RelatonNist
|
|
156
160
|
{ entity: person, role: [{ type: p["contributor_role"] }] }
|
157
161
|
end
|
158
162
|
contribs + doc.xpath("publisher").map do |p|
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
163
|
+
{ entity: create_org(p), role: [{ type: "publisher" }] }
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
#
|
168
|
+
# Create publisher organization
|
169
|
+
#
|
170
|
+
# @param [Nokogiri::XML::Element] pub publisher element
|
171
|
+
#
|
172
|
+
# @return [RelatonBib::Organization] publisher organization
|
173
|
+
#
|
174
|
+
def create_org(pub)
|
175
|
+
name = pub.at("publisher_name").text
|
176
|
+
abbr = pub.at("../institution[institution_name[.='#{name}']]/institution_acronym")&.text
|
177
|
+
place = pub.at("./publisher_place") ||
|
178
|
+
pub.at("../institution[institution_name[.='#{name}']]/institution_place")
|
179
|
+
cont = []
|
180
|
+
if place
|
181
|
+
city, state = place.text.split(", ")
|
182
|
+
cont << RelatonBib::Address.new(street: [], city: city, state: state, country: "US")
|
170
183
|
end
|
184
|
+
RelatonBib::Organization.new name: name, abbreviation: abbr, contact: cont
|
171
185
|
end
|
172
186
|
|
187
|
+
#
|
188
|
+
# Create affiliation organization
|
189
|
+
#
|
190
|
+
# @param [Nokogiri::XML::Element] doc affiliation element
|
191
|
+
#
|
192
|
+
# @return [Array<RelatonBib::Affiliation>] affiliation
|
193
|
+
#
|
173
194
|
def affiliation(doc)
|
174
195
|
doc.xpath("./institution/institution_department").map do |id|
|
175
196
|
org = RelatonBib::Organization.new name: id.text
|
@@ -183,9 +204,20 @@ module RelatonNist
|
|
183
204
|
doc.xpath("institution/institution_place").map(&:text)
|
184
205
|
end
|
185
206
|
|
207
|
+
#
|
208
|
+
# Fetches series
|
209
|
+
#
|
210
|
+
# @param [Nokogiri::XML::Element] doc document element
|
211
|
+
#
|
212
|
+
# @return [Array<RelatonBib::Series>] series
|
213
|
+
#
|
186
214
|
def fetch_series(doc)
|
187
|
-
|
188
|
-
|
215
|
+
series_path = File.expand_path("series.yaml", __dir__)
|
216
|
+
series = YAML.load_file series_path
|
217
|
+
prf, srs, = pub_id(doc).split
|
218
|
+
sname = series[srs] || srs
|
219
|
+
title = RelatonBib::TypedTitleString.new(content: "#{prf} #{sname}")
|
220
|
+
[RelatonBib::Series.new(title: title, number: "#{prf} #{srs}")]
|
189
221
|
end
|
190
222
|
|
191
223
|
#
|
@@ -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
data/relaton_nist.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
24
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
|
25
25
|
|
26
26
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
27
27
|
spec.add_development_dependency "pry-byebug"
|
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.4
|
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-05-
|
11
|
+
date: 2022-05-10 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
|
@@ -201,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
202
|
requirements:
|
202
203
|
- - ">="
|
203
204
|
- !ruby/object:Gem::Version
|
204
|
-
version: 2.
|
205
|
+
version: 2.6.0
|
205
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
207
|
requirements:
|
207
208
|
- - ">="
|