relaton-oasis 1.20.0 → 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 +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +1 -1
- data/CLAUDE.md +55 -0
- data/README.adoc +33 -37
- data/grammars/basicdoc.rng +1559 -671
- data/grammars/biblio-standoc.rng +107 -46
- data/grammars/biblio.rng +1010 -375
- data/grammars/relaton-oasis.rng +1 -3
- data/lib/relaton/oasis/bibdata.rb +7 -0
- data/lib/relaton/oasis/bibitem.rb +7 -0
- data/lib/relaton/oasis/bibliography.rb +60 -0
- data/lib/relaton/oasis/data_fetcher.rb +64 -0
- data/lib/relaton/oasis/data_parser.rb +273 -0
- data/lib/relaton/oasis/data_parser_utils.rb +227 -0
- data/lib/relaton/oasis/data_part_parser.rb +193 -0
- data/lib/relaton/oasis/doctype.rb +7 -0
- data/lib/relaton/oasis/ext.rb +23 -0
- data/lib/relaton/oasis/item.rb +11 -0
- data/lib/relaton/oasis/item_data.rb +6 -0
- data/lib/relaton/oasis/processor.rb +68 -0
- data/lib/relaton/oasis/util.rb +8 -0
- data/lib/relaton/oasis/version.rb +7 -0
- data/lib/relaton/oasis.rb +28 -0
- data/relaton_oasis.gemspec +7 -6
- metadata +40 -27
- data/lib/relaton_oasis/data_fetcher.rb +0 -97
- data/lib/relaton_oasis/data_parser.rb +0 -252
- data/lib/relaton_oasis/data_parser_utils.rb +0 -193
- data/lib/relaton_oasis/data_part_parser.rb +0 -159
- data/lib/relaton_oasis/document_type.rb +0 -16
- data/lib/relaton_oasis/hash_converter.rb +0 -26
- data/lib/relaton_oasis/index.rb +0 -80
- data/lib/relaton_oasis/oasis_bibliographic_item.rb +0 -101
- data/lib/relaton_oasis/oasis_bibliography.rb +0 -51
- data/lib/relaton_oasis/processor.rb +0 -58
- data/lib/relaton_oasis/util.rb +0 -6
- data/lib/relaton_oasis/version.rb +0 -5
- data/lib/relaton_oasis/xml_parser.rb +0 -29
- data/lib/relaton_oasis.rb +0 -31
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9617d28b6700da9cc85d247956e91ee888bf37609b6de1ca796f54fdf41b78a4
|
|
4
|
+
data.tar.gz: b1eb7089e7a5843b7a17a166936812c4ba5c2fc258d1191522ffbcfbab2d43ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 10a9463219ef29826ca68b2df9a080c2bd83cd9fc65757e427ccd490069e799d3543e390cebba00fa6a0b67db95224870fd4ef0f63035969b1a54abaa9a077b5
|
|
7
|
+
data.tar.gz: 7dc39c8a6aff319a422c84b2ba4b5ec2c37044dfd27807fc1d97e3b2627822f8364be5e1c75728ce3e50465a893740d6bc90b449e1b8dad095e377e5fb3e75fb
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
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-oasis is a Ruby gem for retrieving and serializing OASIS Standards bibliographic metadata. It is part of the Relaton family of gems and implements the IsoBibliographicItem model for OASIS standards. Uses the lutaml-model pattern on the `lutaml-integration` branch.
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bundle exec rake spec # Run all tests (default rake task)
|
|
13
|
+
bundle exec rake rubocop # Run linter
|
|
14
|
+
bundle exec rspec # Run tests directly
|
|
15
|
+
bundle exec rspec spec/relaton/oasis/bibitem_spec.rb # Run a single test file
|
|
16
|
+
bin/console # Interactive IRB with gem loaded
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Architecture
|
|
20
|
+
|
|
21
|
+
### Class Hierarchy (under `Relaton::Oasis`)
|
|
22
|
+
|
|
23
|
+
All model classes use the lutaml-model pattern from `relaton-bib`:
|
|
24
|
+
|
|
25
|
+
- **ItemData** (`lib/relaton/oasis/item_data.rb`) — Data model class extending `Bib::ItemData`
|
|
26
|
+
- **Item** (`lib/relaton/oasis/item.rb`) — Base class extending `Bib::Item`, uses `ItemData` model, adds `ext` attribute of type `Ext`
|
|
27
|
+
- **Bibitem** (`lib/relaton/oasis/bibitem.rb`) — Extends `Item`, includes `Bib::BibitemShared` for individual bibliography entries
|
|
28
|
+
- **Bibdata** (`lib/relaton/oasis/bibdata.rb`) — Extends `Item`, includes `Bib::BibdataShared` for complete bibliography records
|
|
29
|
+
- **Ext** (`lib/relaton/oasis/ext.rb`) — Extends `Bib::Ext`, OASIS-specific metadata: `doctype`, `technology_area`, `schema_version`
|
|
30
|
+
- **Doctype** (`lib/relaton/oasis/doctype.rb`) — Extends `Bib::Doctype`, valid values: `specification`, `memorandum`, `resolution`, `standard`
|
|
31
|
+
|
|
32
|
+
### Bibliography (under `Relaton::Oasis`)
|
|
33
|
+
|
|
34
|
+
- **Bibliography** (`lib/relaton/oasis/bibliography.rb`) — Module with `search`/`get` class methods for fetching OASIS standards from the relaton-data-oasis GitHub repository. Delegates to private methods: `find_index_entry`, `fetch_yaml`, `parse_item`
|
|
35
|
+
|
|
36
|
+
### Data Fetching (under `Relaton::Oasis`)
|
|
37
|
+
|
|
38
|
+
These classes scrape https://www.oasis-open.org/standards/ to produce YAML/XML data files. Loaded separately via `require "relaton/oasis/data_fetcher"`.
|
|
39
|
+
|
|
40
|
+
- **DataFetcher** (`lib/relaton/oasis/data_fetcher.rb`) — Extends `Core::DataFetcher`, orchestrates fetching all OASIS standards
|
|
41
|
+
- **DataParser** (`lib/relaton/oasis/data_parser.rb`) — Parses individual OASIS document nodes into `ItemData`
|
|
42
|
+
- **DataPartParser** (`lib/relaton/oasis/data_part_parser.rb`) — Parses multi-part OASIS document nodes into `ItemData`
|
|
43
|
+
- **DataParserUtils** (`lib/relaton/oasis/data_parser_utils.rb`) — Shared module included by both parsers; provides contributor parsing, docid construction, retry logic, and doctype detection
|
|
44
|
+
|
|
45
|
+
### Serialization
|
|
46
|
+
|
|
47
|
+
Supports XML (with RELAX NG schema validation via `grammars/`) and YAML round-trip serialization. Classes use `from_xml`/`to_xml` and `from_yaml`/`to_yaml` class methods inherited from the lutaml-model base.
|
|
48
|
+
|
|
49
|
+
### Test Conventions
|
|
50
|
+
|
|
51
|
+
Tests are round-trip based: parse a fixture file, serialize back, and compare output to input. XML tests also validate against the RELAX NG schema (`grammars/relaton-oasis-compile.rng`) using the `ruby-jing` gem. Fixtures live in `spec/fixtures/`. VCR cassettes record HTTP interactions in `spec/vcr_cassettes/`. Private methods are tested via `send(:method_name, ...)`.
|
|
52
|
+
|
|
53
|
+
## Style
|
|
54
|
+
|
|
55
|
+
RuboCop config inherits from the Ribose OSS style guide. Target Ruby version: 3.4. Rails cops are required but disabled.
|
data/README.adoc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
=
|
|
1
|
+
= Relaton::Oasis: retrieve OASIS Standards for bibliographic use using the BibliographicItem model
|
|
2
2
|
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-oasis.svg["Gem Version", link="https://rubygems.org/gems/relaton-oasis"]
|
|
4
4
|
image:https://github.com/relaton/relaton-oasis/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-oasis/actions?workflow=macos"]
|
|
@@ -10,7 +10,7 @@ image:https://img.shields.io/github/commits-since/relaton/relaton-oasis/latest.s
|
|
|
10
10
|
|
|
11
11
|
RelatonOasis is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
|
|
12
12
|
|
|
13
|
-
You can use it to retrieve metadata of OASIS Standards from https://www.oasis-open.org/standards/ and access such metadata through the `
|
|
13
|
+
You can use it to retrieve metadata of OASIS Standards from https://www.oasis-open.org/standards/ and access such metadata through the `Relaton::Oasis::ItemData` object.
|
|
14
14
|
|
|
15
15
|
== Installation
|
|
16
16
|
|
|
@@ -36,13 +36,13 @@ All the OASIS documents are parsed from https://www.oasis-open.org/standards/ an
|
|
|
36
36
|
|
|
37
37
|
[source,ruby]
|
|
38
38
|
----
|
|
39
|
-
require '
|
|
39
|
+
require 'relaton/oasis'
|
|
40
40
|
=> true
|
|
41
41
|
|
|
42
|
-
item =
|
|
43
|
-
[relaton-oasis] (OASIS
|
|
44
|
-
[relaton-oasis] (OASIS amqp-core) Found: `OASIS amqp-core`
|
|
45
|
-
=> #<
|
|
42
|
+
item = Relaton::Oasis::Bibliography.get "OASIS amqp-core"
|
|
43
|
+
[relaton-oasis] INFO: (OASIS amqp-core) Fetching from Relaton repository ...
|
|
44
|
+
[relaton-oasis] INFO: (OASIS amqp-core) Found: `OASIS amqp-core`
|
|
45
|
+
=> #<Relaton::Oasis::ItemData:0x0000000120db0fa8
|
|
46
46
|
...
|
|
47
47
|
----
|
|
48
48
|
|
|
@@ -51,29 +51,27 @@ item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
|
|
|
51
51
|
[source,ruby]
|
|
52
52
|
----
|
|
53
53
|
item.to_xml
|
|
54
|
-
=> "<bibitem id="
|
|
55
|
-
<fetched>
|
|
56
|
-
<title
|
|
54
|
+
=> "<bibitem id="OASISamqpcore" type="standard" schema-version="v1.4.1">
|
|
55
|
+
<fetched>2026-02-27</fetched>
|
|
56
|
+
<title language="en" script="Latn" type="main">Advanced Message Queueing Protocol (AMQP) v1.0</title>
|
|
57
57
|
<docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
|
|
58
58
|
...
|
|
59
59
|
</bibitem>"
|
|
60
60
|
----
|
|
61
61
|
|
|
62
|
-
With argument `bibdata: true` it
|
|
62
|
+
With argument `bibdata: true` it outputs XML wrapped by `bibdata` element and adds flavour `ext` element.
|
|
63
63
|
|
|
64
64
|
[source,ruby]
|
|
65
65
|
----
|
|
66
66
|
item.to_xml bibdata: true
|
|
67
|
-
=> "<bibdata type="standard" schema-version="v1.
|
|
68
|
-
<fetched>
|
|
69
|
-
<title
|
|
67
|
+
=> "<bibdata type="standard" schema-version="v1.4.1">
|
|
68
|
+
<fetched>2026-02-27</fetched>
|
|
69
|
+
<title language="en" script="Latn" type="main">Advanced Message Queueing Protocol (AMQP) v1.0</title>
|
|
70
70
|
<docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
|
|
71
71
|
...
|
|
72
72
|
<ext schema-version="v1.0.1">
|
|
73
73
|
<doctype>standard</doctype>
|
|
74
|
-
<
|
|
75
|
-
<technical-committee>OASIS Advanced Message Queuing Protocol (AMQP) TC</technical-committee>
|
|
76
|
-
</editorialgroup>
|
|
74
|
+
<flavor>oasis</flavor>
|
|
77
75
|
<technology-area>Messaging</technology-area>
|
|
78
76
|
</ext>
|
|
79
77
|
</bibdata>"
|
|
@@ -81,41 +79,37 @@ item.to_xml bibdata: true
|
|
|
81
79
|
|
|
82
80
|
=== Typed links
|
|
83
81
|
|
|
84
|
-
Some OASIS documents have `src` type link.
|
|
82
|
+
Some OASIS documents have `src` type source link.
|
|
85
83
|
|
|
86
84
|
[source,ruby]
|
|
87
85
|
----
|
|
88
|
-
item =
|
|
89
|
-
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Fetching from Relaton repository ...
|
|
90
|
-
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Found: `OASIS amqp-core-types-v1.0-Pt1`
|
|
91
|
-
=> #<
|
|
86
|
+
item = Relaton::Oasis::Bibliography.get "OASIS amqp-core-types-v1.0-Pt1"
|
|
87
|
+
[relaton-oasis] INFO: (OASIS amqp-core-types-v1.0-Pt1) Fetching from Relaton repository ...
|
|
88
|
+
[relaton-oasis] INFO: (OASIS amqp-core-types-v1.0-Pt1) Found: `OASIS amqp-core-types-v1.0-Pt1`
|
|
89
|
+
=> #<Relaton::Oasis::ItemData:0x0000000123ff12d8
|
|
92
90
|
...
|
|
93
91
|
|
|
94
|
-
item.
|
|
95
|
-
=>
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
item.source[0].type
|
|
93
|
+
=> "src"
|
|
94
|
+
|
|
95
|
+
item.source[0].content
|
|
96
|
+
=> "http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html"
|
|
98
97
|
----
|
|
99
98
|
|
|
100
99
|
=== Create bibliographic item from XML
|
|
101
100
|
|
|
102
101
|
[source,ruby]
|
|
103
102
|
----
|
|
104
|
-
|
|
105
|
-
=> #<
|
|
103
|
+
Relaton::Oasis::Item.from_xml File.read("spec/fixtures/oasis_bibdata.xml")
|
|
104
|
+
=> #<Relaton::Oasis::ItemData:0x0000000123ffeb18
|
|
106
105
|
...
|
|
107
106
|
----
|
|
108
107
|
|
|
109
108
|
=== Create bibliographic item from YAML
|
|
110
109
|
[source,ruby]
|
|
111
110
|
----
|
|
112
|
-
|
|
113
|
-
=>
|
|
114
|
-
"id"=>"OASISamqp-core",
|
|
115
|
-
...
|
|
116
|
-
|
|
117
|
-
RelatonOasis::OasisBibliographicItem.from_hash hash
|
|
118
|
-
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceea0b6628
|
|
111
|
+
Relaton::Oasis::Item.from_yaml File.read("spec/fixtures/item.yaml")
|
|
112
|
+
=> #<Relaton::Oasis::ItemData:0x000000012119a290
|
|
119
113
|
...
|
|
120
114
|
----
|
|
121
115
|
|
|
@@ -123,7 +117,7 @@ RelatonOasis::OasisBibliographicItem.from_hash hash
|
|
|
123
117
|
|
|
124
118
|
The OASIS documents can be fetched from https://www.oasis-open.org/standards/ and converted into RelatonXML/BibXML/BibYAML formats:
|
|
125
119
|
|
|
126
|
-
The method `
|
|
120
|
+
The method `Relaton::Oasis::DataFetcher.fetch(output: "data", format: "yaml")` fetches and converts all the documents from the https://www.oasis-open.org/standards/ and saves them to the `./data` folder in YAML format.
|
|
127
121
|
|
|
128
122
|
Arguments:
|
|
129
123
|
|
|
@@ -132,7 +126,9 @@ Arguments:
|
|
|
132
126
|
|
|
133
127
|
[source,ruby]
|
|
134
128
|
----
|
|
135
|
-
|
|
129
|
+
require "relaton/oasis/data_fetcher"
|
|
130
|
+
|
|
131
|
+
Relaton::Oasis::DataFetcher.fetch
|
|
136
132
|
Started at: 2022-03-18 18:34:06 +0100
|
|
137
133
|
Stopped at: 2022-03-18 18:34:12 +0100
|
|
138
134
|
Done in: 5 sec.
|