relaton-bipm 1.20.4 → 2.0.0.pre.alpha.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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +1 -1
  4. data/CLAUDE.md +46 -0
  5. data/bin/console +1 -1
  6. data/grammars/basicdoc.rng +1559 -668
  7. data/grammars/biblio-standoc.rng +107 -46
  8. data/grammars/biblio.rng +1010 -375
  9. data/grammars/relaton-bipm.rng +19 -68
  10. data/lib/{relaton_bipm/bipm_bibliography.rb → relaton/bipm/bibliography.rb} +11 -11
  11. data/lib/relaton/bipm/converter/asciibib.rb +64 -0
  12. data/lib/relaton/bipm/data_fetcher.rb +52 -0
  13. data/lib/{relaton_bipm → relaton/bipm}/data_outcomes_parser.rb +108 -83
  14. data/lib/relaton/bipm/id_parser.rb +254 -0
  15. data/lib/relaton/bipm/item_data.rb +47 -0
  16. data/lib/relaton/bipm/model/bibdata.rb +9 -0
  17. data/lib/relaton/bipm/model/bibitem.rb +9 -0
  18. data/lib/relaton/bipm/model/comment_period.rb +13 -0
  19. data/lib/relaton/bipm/model/doctype.rb +12 -0
  20. data/lib/relaton/bipm/model/ext.rb +32 -0
  21. data/lib/relaton/bipm/model/item.rb +11 -0
  22. data/lib/relaton/bipm/model/structured_identifier.rb +15 -0
  23. data/lib/relaton/bipm/processor.rb +69 -0
  24. data/lib/{relaton_bipm → relaton/bipm}/rawdata_bipm_metrologia/affiliations.rb +17 -17
  25. data/lib/{relaton_bipm → relaton/bipm}/rawdata_bipm_metrologia/article_parser.rb +71 -66
  26. data/lib/{relaton_bipm → relaton/bipm}/rawdata_bipm_metrologia/fetcher.rb +20 -30
  27. data/lib/{relaton_bipm/bipm_si_brochure_parser.rb → relaton/bipm/si_brochure_parser.rb} +41 -37
  28. data/lib/relaton/bipm/util.rb +8 -0
  29. data/lib/relaton/bipm/version.rb +5 -0
  30. data/lib/relaton/bipm.rb +30 -0
  31. data/relaton_bipm.gemspec +7 -6
  32. metadata +44 -35
  33. data/lib/relaton_bipm/acronyms.yaml +0 -59
  34. data/lib/relaton_bipm/bibliographic_date.rb +0 -5
  35. data/lib/relaton_bipm/bipm_bibliographic_item.rb +0 -110
  36. data/lib/relaton_bipm/comment_periond.rb +0 -41
  37. data/lib/relaton_bipm/committee.rb +0 -67
  38. data/lib/relaton_bipm/data_fetcher.rb +0 -75
  39. data/lib/relaton_bipm/document_relation.rb +0 -5
  40. data/lib/relaton_bipm/document_type.rb +0 -29
  41. data/lib/relaton_bipm/editorial_group.rb +0 -50
  42. data/lib/relaton_bipm/hash_converter.rb +0 -115
  43. data/lib/relaton_bipm/id_parser.rb +0 -252
  44. data/lib/relaton_bipm/processor.rb +0 -62
  45. data/lib/relaton_bipm/structured_identifier.rb +0 -51
  46. data/lib/relaton_bipm/util.rb +0 -6
  47. data/lib/relaton_bipm/version.rb +0 -3
  48. data/lib/relaton_bipm/workgroup.rb +0 -46
  49. data/lib/relaton_bipm/xml_parser.rb +0 -103
  50. data/lib/relaton_bipm.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4f22d6e95a7abfb3746767ce7563d0e92a562856d3e8ced8831a77fa05624349
4
- data.tar.gz: 2c30572b6d1f260dc51c7fa280dd56a79565b8d30bfed8c4d60537a73bb95ebf
3
+ metadata.gz: 66989948c2f106bc44e73e393c6a472e316583f10e706f72d38291d56d7444d8
4
+ data.tar.gz: 49a6b8a07c938e00d457b99cc1dc0b68444669285c409c767d284f5ed67dad1d
5
5
  SHA512:
6
- metadata.gz: 15f75a91447405b02707631ca6a3e744d62ef623767da504f08f0a33a0f770bb0731cdc03cde57769871bb4ab2e1c662ad79dcfa4c6a21e6f9a883b1cc05bd87
7
- data.tar.gz: efd882bc871d9fb20cb1305bc0ff1a9e6f90a57ceb4cb1a419e0358c54d3c498b54cacf7821df6baf82948a2544483cdbb17fdf7114480252f27b5b7e650578b
6
+ metadata.gz: 50df0724589ad037136ed2a0fb4cfb18853824889c195bb8dc10c775814ecfe26d461760bd7524f5f2ab8efd790896368a93a51fb156b8566662992d1316435f
7
+ data.tar.gz: 713992adb1d5dcdecdeee048eee071f02d94cab99c426ea35f54d2e90e47c68b01f412faebd1ce165dd93f115d209e0afd0b5ed8d895bd8f9674765d31b406da
data/.gitignore CHANGED
@@ -14,3 +14,4 @@
14
14
  Gemfile.lock
15
15
  .vscode/
16
16
  rawdata-bipm-metrologia
17
+ .claude/
data/.rubocop.yml CHANGED
@@ -7,6 +7,6 @@ require: rubocop-rails
7
7
  inherit_from:
8
8
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
9
9
  AllCops:
10
- TargetRubyVersion: 2.7
10
+ TargetRubyVersion: 3.2
11
11
  Rails:
12
12
  Enabled: false
data/CLAUDE.md ADDED
@@ -0,0 +1,46 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ relaton-bipm is a Ruby gem that retrieves BIPM (Bureau International des Poids et Mesures) standards metadata for bibliographic use. It's part of the larger Relaton family of gems that handle bibliographic data for standards organizations.
8
+
9
+ ## Common Commands
10
+
11
+ - **Install dependencies:** `bundle install`
12
+ - **Run all tests:** `bundle exec rake spec`
13
+ - **Run a single test file:** `bundle exec rspec spec/relaton/bipm/bibliography_spec.rb`
14
+ - **Run a single test by line:** `bundle exec rspec spec/relaton/bipm/bibliography_spec.rb:42`
15
+ - **Interactive console:** `bin/console`
16
+
17
+ ## Architecture
18
+
19
+ ### Namespace & Module Structure
20
+
21
+ All code lives under `Relaton::Bipm` (in `lib/relaton/bipm/`). The gem name is `relaton-bipm`, the require path is `relaton/bipm`.
22
+
23
+ ### Key Components
24
+
25
+ - **`Bibliography`** (`bibliography.rb`) - Main entry point for fetching standards. Searches a relaton-data-bipm GitHub repository index to find and retrieve YAML bibliographic records.
26
+ - **`Id`** (`id_parser.rb`) - Parses BIPM reference strings into structured hashes using regex matching. Handles multiple reference formats: outcomes (resolutions, recommendations, decisions), SI Brochure, Metrologia journal articles, and JCGM documents. The `TYPES` hash maps full type names (English/French) to abbreviations (RES, REC, DECN, DECL).
27
+ - **`Processor`** (`processor.rb`) - Relaton framework integration point (extends `Relaton::Core::Processor`). Registers prefix `BIPM` and default prefix pattern matching BIPM, CCTF, CCDS, CGPM, CIPM, JCRB, JCGM.
28
+ - **`DataFetcher`** (`data_fetcher.rb`) - Bulk fetches from three data sources: `bipm-data-outcomes`, `bipm-si-brochure`, `rawdata-bipm-metrologia`. Delegates to specialized parsers.
29
+ - **`Item`** / **`ItemData`** (`model/item.rb`, `item_data.rb`) - The bibliographic item model, extending `Relaton::Bib::Item`. Supports XML, YAML, and JSON serialization.
30
+ - **`model/`** directory - Lutaml model classes (Bibdata, Bibitem, Ext, etc.) for XML/YAML serialization.
31
+
32
+ ### Data Sources
33
+
34
+ The gem fetches from three external datasets:
35
+
36
+ 1. **bipm-data-outcomes** - CGPM/CIPM/committee resolutions, recommendations, decisions
37
+ 2. **bipm-si-brochure** - SI Brochure documents
38
+ 3. **rawdata-bipm-metrologia** - Metrologia journal articles (parsed from CrossRef-style data)
39
+
40
+ ### Testing
41
+
42
+ 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
+ ### Dependencies
45
+
46
+ Key runtime dependencies: `relaton-bib` (core bibliographic model), `relaton-index` (index management), `relaton-core` (framework base), `parslet` (PEG parser), `mechanize` (HTTP), `faraday`, `rubyzip`.
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "relaton_bipm"
4
+ require "relaton/bipm"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.