relaton-etsi 1.20.2 → 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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9db12fcd09fa10052380fe87eac90777880e224594c4f47487b6010283cf5d82
4
- data.tar.gz: b33c26ffb892562a8a46eb07f2e10cfe50d83585596f6331baa93f360894f6c5
3
+ metadata.gz: af47d7cc7e2e22171fad2500c4b5018c06afa0efe05a3a613980a9d7eee72257
4
+ data.tar.gz: e48dc2964425154e9bedff060231c66d490435a450b1ddc1216fe2d1ec7db893
5
5
  SHA512:
6
- metadata.gz: 227db6b7da0fd223ad0f272fbf4c7da06dcbe587dc973cafd32af8d3de9a09ef0d2600f427a14f56945dac93fb5f65d486c02b7ba61ad09e659f8d36b9b49b4a
7
- data.tar.gz: ebeec237a1f36122db9d6178201ab44b2dcc347cd0141e3b12e418d35b45f7eb31999dbf1710b911ef041964b0aeded269ff4231f17bf490292598211d3f7949
6
+ metadata.gz: 125bdcdc240940e0717bb633c200af84b978c6d700e887505fd7a285ec917a18793ac0506de389ccda329f685e9d2871431ccf1cc2ed8c77ddfa0c1e7b952d57
7
+ data.tar.gz: 901a093a9f9e7b443fb3e6270c6f1eb4fa8bcea76a4e7deea14889c4d013b94e08f16c6789a68bae32960e8be7cab3fe8885c8474528c02b78772a32d508b729
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 CHANGED
@@ -2,66 +2,68 @@
2
2
 
3
3
  This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
 
5
- ## Build and Test Commands
5
+ ## Project Overview
6
+
7
+ relaton-etsi is a Ruby gem that retrieves ETSI (European Telecommunications Standards Institute) standards metadata using the Relaton bibliographic item model. It fetches data from the ETSI website and the relaton-data-etsi GitHub repository.
8
+
9
+ ## Commands
6
10
 
7
11
  ```bash
8
12
  # Install dependencies
9
13
  bin/setup
10
14
 
11
15
  # Run all tests
12
- bundle exec rake spec
16
+ rake spec
13
17
 
14
- # Run a single test file
15
- bundle exec rspec spec/relaton_etsi/bibliography_spec.rb
18
+ # Run a specific test file
19
+ rspec spec/relaton/etsi/bibliography_spec.rb
16
20
 
17
- # Run a single test by line number
18
- bundle exec rspec spec/relaton_etsi/bibliography_spec.rb:15
21
+ # Run a specific test by line number
22
+ rspec spec/relaton/etsi/bibliography_spec.rb:15
19
23
 
20
24
  # Run linter
21
- bundle exec rubocop
25
+ rake rubocop
22
26
 
23
- # Run linter with auto-fix
24
- bundle exec rubocop -a
25
-
26
- # Interactive console for experimentation
27
+ # Interactive console
27
28
  bin/console
29
+
30
+ # Install gem locally
31
+ bundle exec rake install
28
32
  ```
29
33
 
30
34
  ## Architecture
31
35
 
32
- This gem is part of the [Relaton](https://github.com/relaton) ecosystem for retrieving and managing bibliographic data from standards organizations. It specifically handles ETSI (European Telecommunications Standards Institute) standards.
36
+ The codebase is transitioning from `RelatonEtsi` namespace to `Relaton::Etsi` namespace.
33
37
 
34
- ### Core Dependencies
35
- - `relaton-bib` - Base bibliographic classes that this gem extends
36
- - `relaton-index` - Document indexing for search functionality
38
+ ### New Architecture (lib/relaton/etsi/)
37
39
 
38
- ### Key Classes
40
+ Uses Lutaml for serialization:
41
+ - `Item` - base bibliographic item inheriting from `Bib::Item`
42
+ - `Bibitem` - for `<bibitem>` XML output (includes `Bib::BibitemShared`)
43
+ - `Bibdata` - for `<bibdata>` XML output (includes `Bib::BibdataShared`)
44
+ - `Ext` - ETSI-specific extension data (marker, frequency, mandate, custom_collection)
45
+ - `Doctype` - ETSI document type with abbreviations (EN, ES, GS, TS, TR, etc.)
39
46
 
40
- **Entry Points:**
41
- - `Bibliography` - Main API: `RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")` searches the Relaton index and returns a `BibliographicItem`
42
- - `Processor` - Relaton integration point, registered with the main relaton gem
47
+ ### Legacy Architecture (lib/relaton_etsi/)
43
48
 
44
- **Data Model:**
45
- - `BibliographicItem` extends `RelatonBib::BibliographicItem` with ETSI-specific fields: `marker`, `frequency`, `mandate`, `custom_collection`
46
- - `DocumentType` - ETSI document type abbreviations (EN, ES, EG, TS, GS, GR, TR, etc.) and their full names
47
- - `PubId` - Parser for ETSI document identifiers, extracting type, docnumber, version, edition, and date
49
+ - `BibliographicItem` - extends `RelatonBib::BibliographicItem`
50
+ - `XMLParser` - parses XML into bibliographic items
51
+ - `HashConverter` - converts hashes to bibliographic items
52
+ - `DocumentType` - document type with type/abbreviation mapping
48
53
 
49
- **Data Fetching:**
50
- - `DataFetcher` - Bulk fetches all documents from www.etsi.org CSV export
51
- - `DataParser` - Transforms CSV rows into `BibliographicItem` objects
54
+ ### Core Components
52
55
 
53
- **Serialization:**
54
- - `XMLParser` extends `RelatonBib::XMLParser` for ETSI-specific XML parsing
55
- - `HashConverter` includes `RelatonBib::HashConverter` for YAML/Hash conversion
56
+ - `Bibliography` - searches and retrieves standards from relaton-data-etsi index
57
+ - `DataFetcher` - fetches all documents from ETSI website CSV export
58
+ - `DataParser` - parses CSV rows into bibliographic items
59
+ - `Processor` - Relaton processor for integration with the relaton ecosystem
56
60
 
57
61
  ### Data Flow
58
- 1. `Bibliography.search` queries the GitHub-hosted index (`relaton-data-etsi`)
59
- 2. Matching documents are fetched as YAML from the data repository
60
- 3. `HashConverter` transforms YAML to constructor arguments
61
- 4. `BibliographicItem` is instantiated and returned
62
62
 
63
- For bulk data generation, `DataFetcher` downloads CSV from etsi.org, parses each row with `DataParser`, and saves to files.
63
+ 1. `Bibliography.get(ref)` searches the relaton-data-etsi index
64
+ 2. Fetches YAML from GitHub, converts to `Item` using `from_yaml`
65
+ 3. `DataFetcher.fetch` pulls CSV from etsi.org, parses with `DataParser`, saves to output folder
64
66
 
65
67
  ## Testing
66
68
 
67
- Tests use VCR cassettes in `spec/vcr_cassettes/` to record/replay HTTP interactions. When updating tests that make HTTP calls, delete the relevant cassette to re-record.
69
+ Uses RSpec with VCR for HTTP interaction recording. VCR cassettes are in `spec/vcr_cassettes/`. When tests make new HTTP requests, VCR will record them.
data/README.adoc CHANGED
@@ -1,8 +1,8 @@
1
- = RelatonEtsi
1
+ = Relaton::Etsi
2
2
 
3
- RelatonEtsi is a Ruby gem that implements the https://github.com/relaton/relaton-models#bibliographic-item[BibliographicItem model].
3
+ Relaton::Etsi is a Ruby gem that implements the https://github.com/relaton/relaton-models#bibliographic-item[BibliographicItem model].
4
4
 
5
- You can use it to retrieve metadata of ETSI Standards and access such metadata through the `RelatonEtsi::BibliographicItem` object.
5
+ You can use it to retrieve metadata of ETSI Standards and access such metadata through the `Relaton::Etsi::Item` object.
6
6
 
7
7
  == Installation
8
8
 
@@ -27,13 +27,13 @@ Or install it yourself as:
27
27
 
28
28
  [source,ruby]
29
29
  ----
30
- require 'relaton_etsi'
30
+ require "relaton/etsi"
31
31
  => true
32
32
 
33
- item = RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
34
- [relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Fetching from Relaton repository ...
35
- [relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Found: `ETSI GS ZSM 012 V1.1.1 (2022-12)`
36
- => #<RelatonEtsi::BibliographicItem:0x000000010686fa18
33
+ item = Relaton::Etsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
34
+ [relaton-etsi] INFO: (ETSI GS ZSM 012 V1.1.1) Fetching from Relaton repository ...
35
+ [relaton-etsi] INFO: (ETSI GS ZSM 012 V1.1.1) Found: `ETSI GS ZSM 012 V1.1.1 (2022-12)`
36
+ => #<Relaton::Etsi::ItemData:0x0000000125869dd8
37
37
  ...
38
38
  ----
39
39
 
@@ -42,9 +42,9 @@ item = RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
42
42
  [source,ruby]
43
43
  ----
44
44
  item.to_xml
45
- => "<bibitem id="ETSIGSZSM012V1.1.12022-12" schema-version="v1.2.7">
46
- <fetched>2023-12-05</fetched>
47
- <title format="text/plain" language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
45
+ => "<bibitem id="ETSIGSZSM012V111202212" schema-version="v1.4.1">
46
+ <fetched>2026-01-24</fetched>
47
+ <title language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
48
48
  <uri type="src">http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010</uri>
49
49
  <uri type="pdf">http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf</uri>
50
50
  <docidentifier type="ETSI" primary="true">ETSI GS ZSM 012 V1.1.1 (2022-12)</docidentifier>
@@ -55,74 +55,59 @@ With argument `bibdata: true` it outputs XML wrapped by `bibdata` element and ad
55
55
  [source,ruby]
56
56
  ----
57
57
  item.to_xml bibdata: true
58
- => "<bibdata schema-version="v1.2.7">
59
- <fetched>2023-12-05</fetched>
60
- <title format="text/plain" language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
58
+ => "<bibdata schema-version="v1.4.1">
59
+ <fetched>2026-01-24</fetched>
60
+ <title language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
61
61
  <uri type="src">http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010</uri>
62
62
  <uri type="pdf">http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf</uri>
63
63
  <docidentifier type="ETSI" primary="true">ETSI GS ZSM 012 V1.1.1 (2022-12)</docidentifier>
64
64
  ...
65
65
  <ext schema-version="v0.0.3">
66
66
  <doctype abbreviation="GS">Group Specification</doctype>
67
- <editorialgroup>
68
- <technical-committee>Zero-touch network and Service Management</technical-committee>
69
- </editorialgroup>
70
67
  </ext>
71
68
  </bibdata>"
72
69
  ----
73
70
 
74
- === Typed links
71
+ === Typed source links
75
72
 
76
73
  All the ETSI documents have SRC and PDF links. The gem provides a way to access these links through the `RelatonBib::TypedUri` object.
77
74
 
78
75
  [source,ruby]
79
76
  ----
80
- item.link
81
- => [#<RelatonBib::TypedUri:0x00000001083da780
82
- @content=#<Addressable::URI:0xb40 URI:http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010>,
83
- @language=nil,
84
- @script=nil,
85
- @type="src">,
86
- #<RelatonBib::TypedUri:0x00000001083da690
87
- @content=#<Addressable::URI:0xb54 URI:http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf>,
88
- @language=nil,
89
- @script=nil,
90
- @type="pdf">]
91
-
92
- item.link.size
77
+ item.source
78
+ =>
79
+ [#<Relaton::Bib::Uri:0x0000000129ea7b38 @content="http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010", @language=nil, @locale=nil, @script=nil, @type="src">,
80
+ #<Relaton::Bib::Uri:0x0000000129ea76d8 @content="http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf", @language=nil, @locale=nil, @script=nil, @type="pdf">]
81
+
82
+ item.source.size
93
83
  => 2
94
84
 
95
- item.link[0].type
85
+ item.source[0].type
96
86
  => "src"
97
87
 
98
- item.link[0].content.to_s
88
+ item.source[0].content
99
89
  => "http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010"
100
90
 
101
- item.link[1].type
91
+ item.source[1].type
102
92
  => "pdf"
103
93
 
104
- item.link[1].content.to_s
94
+ item.source[1].content
105
95
  => "http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf"
106
96
  ----
107
97
 
108
98
  === Create bibliographic item from XML
109
99
  [source,ruby]
110
100
  ----
111
- RelatonEtsi::XMLParser.from_xml File.read('spec/fixtures/bibdata.xml')
112
- => #<RelatonEtsi::BibliographicItem:0x000000010a7644d0
101
+ Relaton::Etsi::Item.from_xml File.read('spec/fixtures/bibdata.xml')
102
+ => #<Relaton::Etsi::ItemData:0x000000012b68f660
113
103
  ...
114
104
  ----
115
105
 
116
106
  === Create bibliographic item from YAML
117
107
  [source,ruby]
118
108
  ----
119
- hash = YAML.load_file 'spec/fixtures/item_hash.yaml'
120
- => {"schema-version"=>"v1.2.7",
121
- "id"=>"ETSIEN319532-4V1.3.02023-10",
122
- ...
123
-
124
- RelatonEtsi::BibliographicItem.from_hash hash
125
- => #<RelatonEtsi::BibliographicItem:0x000000010a76cf90
109
+ Relaton::Etsi::Item.from_yaml File.read('spec/fixtures/item.yaml')
110
+ => #<Relaton::Etsi::ItemData:0x0000000126e34c58
126
111
  ...
127
112
  ----
128
113
 
@@ -130,7 +115,7 @@ RelatonEtsi::BibliographicItem.from_hash hash
130
115
 
131
116
  This gem uses the https://www.etsi.org as a data source.
132
117
 
133
- The method `RelatonEtsi::DataFetcher.fetch(output: "data", format: "yaml")` fetches all the documents from the data source and saves them to the `./data` folder in YAML format.
118
+ The method `Relaton::Etsi::DataFetcher.fetch(output: "data", format: "yaml")` fetches all the documents from the data source and saves them to the `./data` folder in YAML format.
134
119
  Arguments:
135
120
 
136
121
  - `output` - folder to save documents (default './data').
@@ -138,7 +123,10 @@ Arguments:
138
123
 
139
124
  [source,ruby]
140
125
  ----
141
- RelatonEtsi::DataFetcher.fetch
126
+ require 'relaton/etsi/data_fetcher'
127
+ => true
128
+
129
+ Relaton::Etsi::DataFetcher.fetch
142
130
  Started at: 2023-12-05 22:44:32 -0500
143
131
  Stopped at: 2023-12-05 22:47:55 -0500
144
132
  Done in: 204 sec.
@@ -147,7 +135,7 @@ Done in: 204 sec.
147
135
 
148
136
  === Logging
149
137
 
150
- RelatonEtsi uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
138
+ Relaton::Etsi uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[relaton-logger] documentation.
151
139
 
152
140
  == Development
153
141