relaton-bipm 2.0.0 → 2.1.0
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/CLAUDE.md +1 -0
- data/README.adoc +2 -0
- data/Rakefile +22 -0
- data/grammars/biblio.rng +4 -8
- data/lib/relaton/bipm/rawdata_bipm_metrologia/article_parser.rb +13 -3
- data/lib/relaton/bipm/si_brochure_parser.rb +8 -0
- data/lib/relaton/bipm/version.rb +1 -1
- data/{relaton_bipm.gemspec → relaton-bipm.gemspec} +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e37174de8c0a2e222fe3ba17b60860488f2c2b1a34e1fdb90e9098b9ba5c3a3
|
|
4
|
+
data.tar.gz: 8260ed3d205d39197b919671691b3763c72b393b465daf81c4dfd9e8e70ae26c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f46ac25806b9ed07a77968a1fa026788ffcdaa43d1786d7da4f8c4531c760a81c0c84fca30bcb4381b58f593e2d982f8ba33078fda1447dfc6cb631a4f2de21
|
|
7
|
+
data.tar.gz: 856d01e50884008f66e4e0bda00330080659a3a991e0d1c183bec11c98510b93e3ad677661c04714e498b12478f68968a9539b5afc6ea7b8f3148a14a491c056
|
data/CLAUDE.md
CHANGED
|
@@ -39,6 +39,7 @@ The gem fetches from three external datasets:
|
|
|
39
39
|
|
|
40
40
|
### Testing
|
|
41
41
|
|
|
42
|
+
- **Index fixture:** `spec/fixtures/index-v1.zip` is pre-loaded into `Relaton::Index` pool in `before(:suite)` (configured in `spec/support/webmock.rb`). Run `rake spec:update_index` to refresh from relaton-data-bipm.
|
|
42
43
|
Tests use RSpec with VCR cassettes (`spec/vcr_cassettes/`) to record/replay HTTP interactions. WebMock is used to prevent real HTTP requests during tests. Test fixtures are in `spec/fixtures/`.
|
|
43
44
|
|
|
44
45
|
### Dependencies
|
data/README.adoc
CHANGED
|
@@ -364,6 +364,8 @@ RelatonBipm uses the relaton-logger gem for logging. By default, it logs to STDO
|
|
|
364
364
|
|
|
365
365
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
366
366
|
|
|
367
|
+
To update the index test fixture (used by tests), run `rake spec:update_index`. This downloads the latest `index-v1.zip` from the https://github.com/relaton/relaton-data-bipm[relaton-data-bipm] repository.
|
|
368
|
+
|
|
367
369
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
368
370
|
|
|
369
371
|
== Contributing
|
data/Rakefile
CHANGED
|
@@ -4,3 +4,25 @@ require "rspec/core/rake_task"
|
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
|
5
5
|
|
|
6
6
|
task :default => :spec
|
|
7
|
+
|
|
8
|
+
namespace :spec do
|
|
9
|
+
desc "Download latest BIPM index fixture from relaton-data-bipm"
|
|
10
|
+
task :update_index do
|
|
11
|
+
require "net/http"
|
|
12
|
+
require "uri"
|
|
13
|
+
|
|
14
|
+
url = "https://raw.githubusercontent.com/relaton/relaton-data-bipm/data-v2/index-v1.zip"
|
|
15
|
+
dest = File.join(__dir__, "spec", "fixtures", "index-v1.zip")
|
|
16
|
+
|
|
17
|
+
puts "Downloading \#{url} ..."
|
|
18
|
+
uri = URI.parse(url)
|
|
19
|
+
response = Net::HTTP.get_response(uri)
|
|
20
|
+
|
|
21
|
+
if response.is_a?(Net::HTTPSuccess)
|
|
22
|
+
File.binwrite(dest, response.body)
|
|
23
|
+
puts "Updated \#{dest} (\#{response.body.bytesize} bytes)"
|
|
24
|
+
else
|
|
25
|
+
abort "Failed to download: HTTP \#{response.code}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/grammars/biblio.rng
CHANGED
|
@@ -2015,15 +2015,11 @@ provided that it is not the entire bibliographic item that is so related</a:docu
|
|
|
2015
2015
|
<a:documentation>A version of the bibliographic item (within an edition). Can be used for drafts</a:documentation>
|
|
2016
2016
|
<element name="version">
|
|
2017
2017
|
<optional>
|
|
2018
|
-
<
|
|
2019
|
-
<a:documentation>
|
|
2020
|
-
</
|
|
2021
|
-
</optional>
|
|
2022
|
-
<optional>
|
|
2023
|
-
<ref name="draft">
|
|
2024
|
-
<a:documentation>The identifier for the current draft of the bibliographic item</a:documentation>
|
|
2025
|
-
</ref>
|
|
2018
|
+
<attribute name="type">
|
|
2019
|
+
<a:documentation>Versioning scheme, in case of multiple versioning schemes</a:documentation>
|
|
2020
|
+
</attribute>
|
|
2026
2021
|
</optional>
|
|
2022
|
+
<text/>
|
|
2027
2023
|
</element>
|
|
2028
2024
|
</define>
|
|
2029
2025
|
<define name="vedition">
|
|
@@ -50,7 +50,6 @@ module Relaton::Bipm
|
|
|
50
50
|
# @return [Array<Relaton::Bib::DocumentIdentifier>] array of document identifiers
|
|
51
51
|
#
|
|
52
52
|
def parse_docidentifier
|
|
53
|
-
pubid = "#{journal_title} #{volume_issue_article}"
|
|
54
53
|
primary_id = create_docidentifier pubid, "BIPM", true
|
|
55
54
|
result = @meta.xpath("./article-id[@pub-id-type='doi']").each_with_object([primary_id]) do |id, m|
|
|
56
55
|
m << create_docidentifier(id.text, id["pub-id-type"])
|
|
@@ -59,6 +58,15 @@ module Relaton::Bipm
|
|
|
59
58
|
result
|
|
60
59
|
end
|
|
61
60
|
|
|
61
|
+
#
|
|
62
|
+
# Build primary publication identifier string (e.g. "Metrologia 55 1 125")
|
|
63
|
+
#
|
|
64
|
+
# @return [String] pubid
|
|
65
|
+
#
|
|
66
|
+
def pubid
|
|
67
|
+
@pubid ||= "#{journal_title} #{volume_issue_article}"
|
|
68
|
+
end
|
|
69
|
+
|
|
62
70
|
#
|
|
63
71
|
# Parse volume, issue and page
|
|
64
72
|
#
|
|
@@ -326,7 +334,7 @@ module Relaton::Bipm
|
|
|
326
334
|
rels = dates do |d, t|
|
|
327
335
|
Relaton::Bib::Relation.new(type: "hasManifestation", bibitem: bibitem(d, t))
|
|
328
336
|
end
|
|
329
|
-
@errors[:article_relation] &&=
|
|
337
|
+
@errors[:article_relation] &&= rels.empty?
|
|
330
338
|
rels + parse_references
|
|
331
339
|
end
|
|
332
340
|
|
|
@@ -392,7 +400,9 @@ module Relaton::Bipm
|
|
|
392
400
|
dt = Relaton::Bib::Date.new(type: type, at: date)
|
|
393
401
|
carrier = type == "epub" ? "online" : "print"
|
|
394
402
|
medium = Relaton::Bib::Medium.new carrier: carrier
|
|
395
|
-
|
|
403
|
+
fref = Relaton::Bib::Formattedref.new(content: pubid)
|
|
404
|
+
docid = [create_docidentifier(pubid, "BIPM", true)]
|
|
405
|
+
ItemData.new(formattedref: fref, docidentifier: docid, date: [dt], medium: medium)
|
|
396
406
|
end
|
|
397
407
|
|
|
398
408
|
#
|
|
@@ -35,6 +35,14 @@ module Relaton::Bipm
|
|
|
35
35
|
xml = File.read(f, encoding: "UTF-8")
|
|
36
36
|
xml = xml.force_encoding("UTF-8") if xml.encoding != Encoding::UTF_8
|
|
37
37
|
item1 = Bibdata.from_xml(xml)
|
|
38
|
+
# Workaround for relaton-bib Version#content bug: whitespace between
|
|
39
|
+
# legacy <revision-date>/<draft> children gets captured as @content,
|
|
40
|
+
# blocking the legacy-fold path. Clear it so the getter recomputes.
|
|
41
|
+
item1.version.each do |v|
|
|
42
|
+
c = v.instance_variable_get(:@content)
|
|
43
|
+
next unless c.is_a?(Array) || (c.is_a?(String) && c.strip.empty?)
|
|
44
|
+
v.instance_variable_set(:@content, nil)
|
|
45
|
+
end
|
|
38
46
|
@data_fetcher.errors[:si_brochure_title] &&= item1.title.empty?
|
|
39
47
|
@data_fetcher.errors[:si_brochure_docidentifier] &&= item1.docidentifier.empty?
|
|
40
48
|
unless has_committee_contributor?(item1)
|
data/lib/relaton/bipm/version.rb
CHANGED
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec| # rubocop:disable Metrics/BlockLength
|
|
|
35
35
|
spec.add_dependency "faraday", "~> 2.7.0"
|
|
36
36
|
spec.add_dependency "mechanize", "~> 2.10"
|
|
37
37
|
spec.add_dependency "parslet", "~> 2.0.0"
|
|
38
|
-
spec.add_dependency "relaton-bib", "~> 2.
|
|
38
|
+
spec.add_dependency "relaton-bib", "~> 2.1.0"
|
|
39
39
|
spec.add_dependency "relaton-index", "~> 0.2.2"
|
|
40
40
|
spec.add_dependency "relaton-core", "~> 0.0.12"
|
|
41
41
|
spec.add_dependency "rubyzip", "~> 2.3.0"
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bipm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-05-04 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: faraday
|
|
@@ -57,14 +58,14 @@ dependencies:
|
|
|
57
58
|
requirements:
|
|
58
59
|
- - "~>"
|
|
59
60
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.
|
|
61
|
+
version: 2.1.0
|
|
61
62
|
type: :runtime
|
|
62
63
|
prerelease: false
|
|
63
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
65
|
requirements:
|
|
65
66
|
- - "~>"
|
|
66
67
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 2.
|
|
68
|
+
version: 2.1.0
|
|
68
69
|
- !ruby/object:Gem::Dependency
|
|
69
70
|
name: relaton-index
|
|
70
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -154,13 +155,14 @@ files:
|
|
|
154
155
|
- lib/relaton/bipm/si_brochure_parser.rb
|
|
155
156
|
- lib/relaton/bipm/util.rb
|
|
156
157
|
- lib/relaton/bipm/version.rb
|
|
157
|
-
-
|
|
158
|
+
- relaton-bipm.gemspec
|
|
158
159
|
homepage: https://github.com/relaton/relaton-bipm
|
|
159
160
|
licenses:
|
|
160
161
|
- BSD-2-Clause
|
|
161
162
|
metadata:
|
|
162
163
|
homepage_uri: https://github.com/relaton/relaton-bipm
|
|
163
164
|
source_code_uri: https://github.com/relaton/relaton-bipm
|
|
165
|
+
post_install_message:
|
|
164
166
|
rdoc_options: []
|
|
165
167
|
require_paths:
|
|
166
168
|
- lib
|
|
@@ -175,7 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
175
177
|
- !ruby/object:Gem::Version
|
|
176
178
|
version: '0'
|
|
177
179
|
requirements: []
|
|
178
|
-
rubygems_version: 3.
|
|
180
|
+
rubygems_version: 3.5.22
|
|
181
|
+
signing_key:
|
|
179
182
|
specification_version: 4
|
|
180
183
|
summary: 'Relaton::Bipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem
|
|
181
184
|
model'
|