relaton-omg 1.20.1 → 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 +2 -0
- data/.rubocop.yml +1 -1
- data/CLAUDE.md +51 -0
- data/README.adoc +39 -38
- data/grammars/basicdoc.rng +1559 -671
- data/grammars/biblio-standoc.rng +107 -46
- data/grammars/biblio.rng +1010 -375
- data/lib/relaton/omg/bibdata.rb +7 -0
- data/lib/relaton/omg/bibitem.rb +7 -0
- data/lib/{relaton_omg/omg_bibliography.rb → relaton/omg/bibliography.rb} +11 -9
- data/lib/relaton/omg/item.rb +7 -0
- data/lib/relaton/omg/processor.rb +34 -0
- data/lib/relaton/omg/scraper.rb +141 -0
- data/lib/relaton/omg/util.rb +8 -0
- data/lib/relaton/omg/version.rb +5 -0
- data/lib/relaton/omg.rb +22 -0
- data/relaton_omg.gemspec +7 -6
- metadata +32 -20
- data/lib/relaton_omg/hash_converter.rb +0 -6
- data/lib/relaton_omg/omg_bibliographic_item.rb +0 -44
- data/lib/relaton_omg/processor.rb +0 -40
- data/lib/relaton_omg/scraper.rb +0 -142
- data/lib/relaton_omg/util.rb +0 -6
- data/lib/relaton_omg/version.rb +0 -3
- data/lib/relaton_omg/xml_parser.rb +0 -24
- data/lib/relaton_omg.rb +0 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 225388efdbed90395039c1f28bd0694182730f06cd60e5afb8333985d1a7aa11
|
|
4
|
+
data.tar.gz: 62a961cd80770fd534128ddc36f42b3b465ffba58dfb668a15eacf8a0cb0ee71
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7b7956b637f1f53b723cb90d5db542c88c1c01cfc45191e211be05f25db63e9caaf75f3a72239bc51fa25058c59d5659ba8a17514031e6177d08663d3a417a5
|
|
7
|
+
data.tar.gz: 1c6493afcafb8b039b6836abf66802c10c0501239d86bbd8dbf9e58b5beab1dff9b0b0e2737a64cf89174a659c0e2790772f049c72225cbfced092e94891e88d
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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-omg is a Ruby gem that searches and fetches standards from The Object Management Group (OMG) at https://www.omg.org. It is part of the larger Relaton family of bibliographic data gems (v2.0.0-alpha.1).
|
|
8
|
+
|
|
9
|
+
## Commands
|
|
10
|
+
|
|
11
|
+
- **Run all tests:** `bundle exec rspec`
|
|
12
|
+
- **Run a single test:** `bundle exec rspec spec/relaton/omg/item_spec.rb`
|
|
13
|
+
- **Lint:** `bundle exec rubocop` (follows Ribose OSS style guide)
|
|
14
|
+
- **Lint with autofix:** `bundle exec rubocop -a`
|
|
15
|
+
- **Install deps:** `bundle install`
|
|
16
|
+
|
|
17
|
+
## Architecture
|
|
18
|
+
|
|
19
|
+
### Module structure
|
|
20
|
+
|
|
21
|
+
All source lives under `lib/relaton/omg/`. The main entry point is `lib/relaton/omg.rb` which loads everything under the `Relaton::Omg` module namespace.
|
|
22
|
+
|
|
23
|
+
### Class hierarchy
|
|
24
|
+
|
|
25
|
+
The gem extends `relaton-bib` (~> 2.0.0-alpha.1), the core Relaton bibliographic data library:
|
|
26
|
+
|
|
27
|
+
- `Relaton::Omg::Item` < `Bib::Item` — base item class, uses `Bib::ItemData` model
|
|
28
|
+
- `Relaton::Omg::Bibitem` < `Item` — includes `Bib::BibitemShared`, for `<bibitem>` XML
|
|
29
|
+
- `Relaton::Omg::Bibdata` < `Item` — includes `Bib::BibdataShared`, for `<bibdata>` XML
|
|
30
|
+
- `Relaton::Omg::Processor` < `Core::Processor` — relaton-core integration, delegates to `Bibliography`, `Bibitem`, `Item`
|
|
31
|
+
- `Relaton::Omg::Bibliography` — fetches standards via `Scraper`
|
|
32
|
+
- `Relaton::Omg::Scraper` — scrapes https://www.omg.org/spec for bibliographic data
|
|
33
|
+
|
|
34
|
+
### Serialization formats
|
|
35
|
+
|
|
36
|
+
Items can be serialized to/from YAML and XML. Tests verify round-trip fidelity for all three classes. XML output is validated against RELAX NG schemas in `grammars/`.
|
|
37
|
+
|
|
38
|
+
### Test patterns
|
|
39
|
+
|
|
40
|
+
- RSpec with `expect` syntax (monkey patching disabled)
|
|
41
|
+
- `equivalent-xml` for XML comparison
|
|
42
|
+
- `ruby-jing` for RELAX NG schema validation against `grammars/relaton-omg-compile.rng`
|
|
43
|
+
- VCR cassettes in `spec/vcr_cassettes/` for HTTP interaction recording
|
|
44
|
+
- Fixtures in `spec/fixtures/` (YAML and XML reference files)
|
|
45
|
+
- Tests follow a round-trip pattern: load fixture → parse → serialize → compare to fixture
|
|
46
|
+
|
|
47
|
+
## Style
|
|
48
|
+
|
|
49
|
+
- Ruby >= 3.1.0
|
|
50
|
+
- Rubocop inherits from Ribose OSS guide with `rubocop-rails` required but Rails cops disabled
|
|
51
|
+
- OMG document reference format: `OMG {ACRONYM} {VERSION}` (e.g., `OMG AMI4CCM 1.0`)
|
data/README.adoc
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
=
|
|
1
|
+
= Relaton::Omg
|
|
2
2
|
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-omg.svg["Gem Version", link="https://rubygems.org/gems/relaton-omg"]
|
|
4
4
|
image:https://github.com/relaton/relaton-omg/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-omg/actions?workflow=macos"]
|
|
@@ -10,7 +10,7 @@ image:https://img.shields.io/github/commits-since/relaton/relaton-omg/latest.svg
|
|
|
10
10
|
|
|
11
11
|
RelatonOmg is a Ruby gem that searches and fetches standards from https://www.omg.org[The Object Management Group (OMG)].
|
|
12
12
|
|
|
13
|
-
The standards
|
|
13
|
+
The standards are scraped from https://www.omg.org/spec
|
|
14
14
|
|
|
15
15
|
== Installation
|
|
16
16
|
|
|
@@ -36,23 +36,23 @@ Or install it yourself as:
|
|
|
36
36
|
Reference format is `OMG + {ACRONYM} + {VERSION}`
|
|
37
37
|
|
|
38
38
|
- `ACRONYM` is an acronym from the list of specs https://www.omg.org/spec/#all
|
|
39
|
-
- `VERSION` (optional) if omitted then the
|
|
39
|
+
- `VERSION` (optional) if omitted then the latest version is fetched
|
|
40
40
|
|
|
41
41
|
[source,ruby]
|
|
42
42
|
----
|
|
43
|
-
require '
|
|
43
|
+
require 'relaton/omg'
|
|
44
44
|
=> true
|
|
45
45
|
|
|
46
|
-
item =
|
|
47
|
-
[relaton-omg] (OMG AMI4CCM 1.0) Fetching from www.omg.org ...
|
|
48
|
-
[relaton-omg] (OMG AMI4CCM 1.0) Found: `AMI4CCM 1.0`
|
|
49
|
-
=> #<
|
|
46
|
+
item = Relaton::Omg::Bibliography.get 'OMG AMI4CCM 1.0'
|
|
47
|
+
[relaton-omg] INFO: (OMG AMI4CCM 1.0) Fetching from www.omg.org ...
|
|
48
|
+
[relaton-omg] INFO: (OMG AMI4CCM 1.0) Found: `OMG AMI4CCM 1.0`
|
|
49
|
+
=> #<Relaton::Bib::ItemData:0x0000000128bf7650
|
|
50
50
|
...
|
|
51
51
|
|
|
52
52
|
# Return nil if the document doesn't exist.
|
|
53
|
-
|
|
54
|
-
[relaton-omg] (OMG 1111) Fetching from www.omg.org ...
|
|
55
|
-
[relaton-omg] (OMG 1111) Not found.
|
|
53
|
+
Relaton::Omg::Bibliography.get 'OMG 1111'
|
|
54
|
+
[relaton-omg] INFO: (OMG 1111) Fetching from www.omg.org ...
|
|
55
|
+
[relaton-omg] INFO: (OMG 1111) Not found.
|
|
56
56
|
=> nil
|
|
57
57
|
----
|
|
58
58
|
|
|
@@ -61,54 +61,55 @@ RelatonOmg::OmgBibliography.get 'OMG 1111'
|
|
|
61
61
|
[source,ruby]
|
|
62
62
|
----
|
|
63
63
|
item.to_xml
|
|
64
|
-
=> "<bibitem id="
|
|
65
|
-
<fetched>
|
|
66
|
-
<title
|
|
64
|
+
=> "<bibitem id="OMGAMI4CCM10" schema-version="v1.4.1">
|
|
65
|
+
<fetched>2026-02-27</fetched>
|
|
66
|
+
<title language="en" script="Latn" type="main">Asynchronous Method Invocation for CCM</title>
|
|
67
67
|
<uri type="src">https://www.omg.org/spec/AMI4CCM/1.0/About-AMI4CCM</uri>
|
|
68
68
|
<uri type="pdf">https://www.omg.org/spec/AMI4CCM/1.0/PDF</uri>
|
|
69
|
-
<docidentifier type="OMG" primary="true">AMI4CCM 1.0</docidentifier>
|
|
69
|
+
<docidentifier type="OMG" primary="true">OMG AMI4CCM 1.0</docidentifier>
|
|
70
70
|
...
|
|
71
71
|
</bibitem>"
|
|
72
|
+
|
|
73
|
+
item.to_xml bibdata: true
|
|
74
|
+
=> "<bibdata schema-version="v1.4.1">
|
|
75
|
+
<fetched>2026-02-27</fetched>
|
|
76
|
+
<title language="en" script="Latn" type="main">Asynchronous Method Invocation for CCM</title>
|
|
77
|
+
<uri type="src">https://www.omg.org/spec/AMI4CCM/1.0/About-AMI4CCM</uri>
|
|
78
|
+
<uri type="pdf">https://www.omg.org/spec/AMI4CCM/1.0/PDF</uri>
|
|
79
|
+
<docidentifier type="OMG" primary="true">OMG AMI4CCM 1.0</docidentifier>
|
|
80
|
+
...
|
|
81
|
+
</bibdata>"
|
|
72
82
|
----
|
|
73
83
|
|
|
74
84
|
=== Typed links
|
|
75
85
|
|
|
76
|
-
OMG documents may have `src` and `pdf` link types.
|
|
86
|
+
OMG documents may have `src` and `pdf` link source types.
|
|
77
87
|
|
|
78
88
|
[source,ruby]
|
|
79
89
|
----
|
|
80
|
-
item.
|
|
81
|
-
=>
|
|
82
|
-
|
|
90
|
+
item.source[0].type
|
|
91
|
+
=> "src"
|
|
92
|
+
|
|
93
|
+
item.source[0].content
|
|
94
|
+
=> "https://www.omg.org/spec/AMI4CCM/1.0/About-AMI4CCM"
|
|
83
95
|
----
|
|
84
96
|
|
|
85
97
|
=== Create bibliographic item from XML
|
|
86
98
|
|
|
87
99
|
[source,ruby]
|
|
88
100
|
----
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
----
|
|
93
|
-
|
|
94
|
-
=== Create bibliographic item from Hash
|
|
95
|
-
[source,ruby]
|
|
96
|
-
----
|
|
97
|
-
hash = YAML.load_file 'spec/fixtures/omg_ami4ccm_1_0.yaml'
|
|
98
|
-
=> {"schema-version"=>"v1.2.9",
|
|
99
|
-
"id"=>"AMI4CCM1.0",
|
|
100
|
-
...
|
|
101
|
-
|
|
102
|
-
item = RelatonOmg::OmgBibliographicItem.from_hash hash
|
|
103
|
-
=> #<RelatonOmg::OmgBibliographicItem:0x007f85b0247ec0
|
|
101
|
+
xml = File.read 'spec/fixtures/omg_ami4ccm_1_0.xml', encoding: 'UTF-8'
|
|
102
|
+
item = Relaton::Omg::Bibitem.from_xml xml
|
|
103
|
+
=> #<Relaton::Bib::ItemData:0x00000001248f8c00
|
|
104
104
|
...
|
|
105
105
|
----
|
|
106
106
|
|
|
107
107
|
=== Create bibliographic item from YAML
|
|
108
108
|
[source,ruby]
|
|
109
109
|
----
|
|
110
|
-
|
|
111
|
-
|
|
110
|
+
yaml = File.read 'spec/fixtures/omg_ami4ccm_1_0.yaml', encoding: 'UTF-8'
|
|
111
|
+
item = Relaton::Omg::Item.from_yaml yaml
|
|
112
|
+
=> #<Relaton::Bib::ItemData:0x000000012813b180
|
|
112
113
|
...
|
|
113
114
|
----
|
|
114
115
|
|
|
@@ -118,8 +119,8 @@ RelatonOmg uses the relaton-logger gem for logging. By default, it logs to STDOU
|
|
|
118
119
|
|
|
119
120
|
== Contributing
|
|
120
121
|
|
|
121
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-
|
|
122
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-omg.
|
|
122
123
|
|
|
123
124
|
== License
|
|
124
125
|
|
|
125
|
-
The gem is available as open source under the terms of the
|
|
126
|
+
The gem is available as open source under the terms of the https://opensource.org/licenses/MIT[MIT License].
|