relaton-bipm 2.0.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3713af26bfc8755bed28d78022cee0542649400e3767a3f9892c5744a60e85db
4
- data.tar.gz: fde22355a20e15e6d8a146b62957628bc694ae181b23169fa6f09b11c2d4f974
3
+ metadata.gz: 42080c1c3ebb7eab76de1fc1b18bb91da064ac175581633c34b0c8daa2361282
4
+ data.tar.gz: 340d032da2900d7873da399c2711587b38ccd99307a0a401b1a4b3ba8201db5a
5
5
  SHA512:
6
- metadata.gz: 1253a0d2392e246f5e7c85cd5f36ef84e0f960f5f97ffba01650a7ec324399c14be7edbb7e6470464564ca1ecf481d21a5eacc2d5175b20c2cc0b4dec4627f15
7
- data.tar.gz: 7ab0323f511ef6c20243cbfb81b75077d7adb2c6e236a8e6f6118d6719ac545b8438a5eed6d403d0506502455f096c82cbf51f02efb91aef2b0dcc5be13635c5
6
+ metadata.gz: 9292924b806016e99034be78d609420b96be057745499ef4f7c006682325fdb4ef38a80369398bc6c882379b703fd7debeb4ad4b26a6daad12a1be5893d70aec
7
+ data.tar.gz: 5c7908cdb8d6943da712d3a1a43c91310efed866530504434b7377f18e50f6f871798e95efb16b04a5c88bd2f6ada1c8aab3c30836c546d1a6b3ed5e4d4206be
@@ -4,7 +4,7 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master, main ]
7
+ branches: [ master, main, lutaml-integration ]
8
8
  tags: [ v* ]
9
9
  pull_request:
10
10
 
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
- <ref name="revision-date">
2019
- <a:documentation>The date at which the current version of the bibliographic item was produced</a:documentation>
2020
- </ref>
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">
@@ -437,7 +437,7 @@ module Relaton::Bipm
437
437
  did.content.sub!(regex) { "#{$1}-#{part}" }
438
438
  # did.instance_variable_set(:@id, id)
439
439
  end
440
- hash[:ext].structuredidentifier.instance_variable_set :@part, part
440
+ hash[:ext].structuredidentifier.part = part
441
441
  end
442
442
 
443
443
  #
@@ -10,7 +10,6 @@ module Relaton
10
10
  kg_h_c_deltanu kg_h m_c_deltanu m_c mol_NA s_deltanu
11
11
  ]
12
12
 
13
- attribute :schema_version, method: :get_schema_version
14
13
  attribute :doctype, Doctype
15
14
  attribute :comment_period, CommentPeriod
16
15
  attribute :si_aspect, :string, values: SI_ASPECTS
@@ -24,6 +23,12 @@ module Relaton
24
23
  map_element "structuredidentifier", to: :structuredidentifier
25
24
  end
26
25
 
26
+ key_value do
27
+ map_element "comment_period", to: :comment_period
28
+ map_element "si_aspect", to: :si_aspect
29
+ map_element "meeting_note", to: :meeting_note
30
+ end
31
+
27
32
  def get_schema_version
28
33
  Relaton.schema_versions["relaton-model-bipm"]
29
34
  end
@@ -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
  #
@@ -291,7 +299,7 @@ module Relaton::Bipm
291
299
  next unless from
292
300
 
293
301
  owner = l.at("./copyright-statement").text.split(" & ").map do |c|
294
- /(?<name>[A-z]+(?:\s[A-z]+)*)/ =~ c
302
+ /(?<name>\p{L}+(?:\s\p{L}+)*)/ =~ c
295
303
  org_name = Relaton::Bib::TypedLocalizedString.new(content: name, language: "en", script: "Latn")
296
304
  org = Relaton::Bib::Organization.new name: [org_name]
297
305
  Relaton::Bib::ContributionInfo.new(organization: org)
@@ -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] &&= refs.empty?
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
- ItemData.new title: parse_title, date: [dt], medium: medium
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)
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Bipm
3
- VERSION = "2.0.0".freeze
3
+ VERSION = "2.1.1".freeze
4
4
  end
5
5
  end
@@ -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.0.0"
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.0.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
+ autorequire:
8
9
  bindir: exe
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2026-05-05 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.0.0
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.0.0
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
- - relaton_bipm.gemspec
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.6.9
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'