relaton-plateau 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85ebde0fa8fd57e9635b608f8801e9b52f8b38f43813c9efb4743729fe40257a
4
- data.tar.gz: 2690299660afb7250b4b4d8a3d07e248c969fa20aaf43c68f4b25313d5dabd3a
3
+ metadata.gz: fb3cc6cdfa3cd0363255bab96606035fb447b921604c6e1714eadda34aefe7de
4
+ data.tar.gz: c11916205329861dfc3f39a4a3f2d0850c6befff87fa8e9e42597fefb8b26ffa
5
5
  SHA512:
6
- metadata.gz: 32edddbb7987e669e8892a40ab5b9ae3267293c4fd3048cc73dae30bbbff944dc93d58bf70fdb83e6292562d1789cbfc38f46b0d2ff8548a431163e148f214ef
7
- data.tar.gz: 0ab2386c6640a57cf65fe83bee34d2528990353b7f294cfc4ab872a4a42c14547f8b2e8f5f37679ad85559445e8faf2aea15164bb2eb54dec19970ae2a31275b
6
+ metadata.gz: e5302a8675a7ffc39319b8dddbc784cc7e63984ed516b4aaeae5fcf28625fc34e03b1251b655df91f731f968d17da98d1c47453c2f140307f6ce409daebd6eb0
7
+ data.tar.gz: 80f019f1da353cf7dc1bdebba2d20a1eee0b49205d892d7d703f43def4f59c9eeedfe67397f73f0683a9b2d2f131df7cfcfea336a7dc0be69e424214ff013607
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  .rspec_status
13
13
  Gemfile.lock
14
14
  .vscode/
15
+ .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: 3.0
10
+ TargetRubyVersion: 3.2
11
11
  Rails:
12
12
  Enabled: false
data/CLAUDE.md ADDED
@@ -0,0 +1,78 @@
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-plateau is a Ruby gem for retrieving and managing bibliographic metadata for Project PLATEAU (Japanese 3D city model standards published by MLIT). It is part of the Relaton ecosystem of bibliographic gems.
8
+
9
+ ## Commands
10
+
11
+ ```bash
12
+ # Install dependencies
13
+ bundle install
14
+
15
+ # Run all tests
16
+ bundle exec rake spec
17
+
18
+ # Run a single test file
19
+ bundle exec rspec spec/relaton/plateau/bibitem_spec.rb
20
+
21
+ # Run a specific test by line number
22
+ bundle exec rspec spec/relaton/plateau/bibitem_spec.rb:15
23
+
24
+ # Lint
25
+ bundle exec rake rubocop
26
+
27
+ # Default rake task (runs specs)
28
+ bundle exec rake
29
+ ```
30
+
31
+ ## Architecture
32
+
33
+ All code lives in `lib/relaton/plateau/`. The gem uses LutaML::Model::Serializable for data modeling with automatic XML/YAML serialization.
34
+
35
+ ### Models
36
+ - **Item** (`item.rb`) — base Plateau item extending `Bib::Item`, declares `model ItemData` and adds `ext` attribute
37
+ - **ItemData** (`item_data.rb`) — data class extending `Bib::ItemData`, returned by `Item.from_xml`, `Item.from_yaml`, and `Bibliography.get`
38
+ - **Bibitem** (`bibitem.rb`) — bibliographic item variant (includes `Bib::BibitemShared`)
39
+ - **Bibdata** (`bibdata.rb`) — bibliographic data variant (includes `Bib::BibdataShared`)
40
+ - **Ext** (`ext.rb`) — extension element: doctype, subdoctype, flavor, editorialgroup, stagename, filesize, etc.
41
+ - **Doctype** (`doctype.rb`) — extends `Bib::Doctype`, valid values: `handbook`, `technical-report`, `annex`
42
+
43
+ ### Retrieval & Data Fetching
44
+ - **Bibliography** (`bibliography.rb`) — module with `get(code)` for index-based document retrieval, returns `ItemData`
45
+ - **HitCollection** / **Hit** — search the relaton-data-plateau index and fetch YAML documents
46
+ - **DataFetcher** (`data_fetcher.rb`) — extends `Core::DataFetcher`, scrapes MLIT JSON APIs for handbooks and technical reports
47
+ - **Parser** / **HandbookParser** / **TechnicalReportParser** — parse JSON into `ItemData` objects
48
+ - **Processor** (`processor.rb`) — standard Relaton processor plugin (`get`, `from_xml`, `from_yaml`, `fetch_data`, `grammar_hash`)
49
+
50
+ ### Serialization Methods
51
+ - `bib.to_xml` — XML (bibitem format)
52
+ - `Item.to_yaml(bib)` — YAML (class method)
53
+ - `bib.to_rfcxml` — BibXML/RFC XML
54
+ - `Item.from_xml(xml)` — parse XML into `ItemData`
55
+ - `Item.from_yaml(yaml)` — parse YAML into `ItemData`
56
+
57
+ ### Data Sources
58
+ - Handbooks: `https://www.mlit.go.jp/plateau/_next/data/1.3.0/libraries/handbooks.json`
59
+ - Technical Reports: `https://www.mlit.go.jp/plateau/_next/data/1.3.0/libraries/technical-reports.json`
60
+ - Pre-fetched index: `https://raw.githubusercontent.com/relaton/relaton-data-plateau/data-v2/`
61
+
62
+ ### Schema Validation
63
+ RNG grammar files in `grammars/` define the XML schema. Tests validate fixtures against `relaton-plateau-compile.rng` using the `ruby-jing` gem.
64
+
65
+ ## Testing
66
+
67
+ - RSpec with `expect` syntax (no monkey-patching)
68
+ - VCR cassettes record HTTP interactions (in `spec/fixtures/vcr_cassettes/`)
69
+ - `equivalent-xml` for XML comparison assertions
70
+ - `jing` matcher for RNG schema validation
71
+ - SimpleCov for code coverage
72
+
73
+ ## Key Conventions
74
+
75
+ - Document identifiers follow pattern: `PLATEAU Handbook #XX Y.Z` or `PLATEAU Technical Report #XX Y.Z`
76
+ - The gem supports multi-format serialization: XML, YAML, BibXML (RFC XML)
77
+ - RuboCop follows Ribose OSS style guide; target Ruby version is 3.0
78
+ - The `ext` element in XML/YAML carries PLATEAU-specific metadata (doctype, flavor, editorialgroup, etc.)
data/Gemfile CHANGED
@@ -9,6 +9,7 @@ gem "equivalent-xml", "~> 0.6"
9
9
  gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
  gem "rubocop", "~> 1.21"
12
+ gem "ruby-jing", "~> 0.0.3"
12
13
  gem "simplecov", "~> 0.22"
13
14
  gem "vcr", "~> 6.0"
14
15
  gem "webmock", "~> 3.0"
data/README.adoc CHANGED
@@ -1,16 +1,16 @@
1
- = RelatonPlateau: retrieve Project PLATEAU Standards for bibliographic use using the BibliographicItem model
1
+ = Relaton::Plateau: retrieve Project PLATEAU Standards for bibliographic use using the ItemData model
2
2
 
3
3
  image:https://img.shields.io/gem/v/relaton-plateau.svg["Gem Version", link="https://rubygems.org/gems/relaton-plateau"]
4
4
  image:https://github.com/relaton/relaton-plateau/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-plateau/actions?workflow=macos"]
5
5
  image:https://github.com/relaton/relaton-plateau/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-plateau/actions?workflow=windows"]
6
6
  image:https://github.com/relaton/relaton-plateau/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-plateau/actions?workflow=ubuntu"]
7
- image:https://codeclimate.com/github/relaton/relaton-plateau/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-plateau"]
7
+ image:https://codeclimate.com/github/relaton/relaton-plateau/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-plateau"]
8
8
  image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-plateau.svg["Pull Requests", link="https://github.com/relaton/relaton-plateau/pulls"]
9
9
  image:https://img.shields.io/github/commits-since/relaton/relaton/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-plateau/releases"]
10
10
 
11
- RelatonPlateau is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-plateau#iso-bibliographic-item[BibliographicItem model].
11
+ RelatonPlateau is a Ruby gem that implements the https://github.com/relaton/relaton-model-plateau[ItemData model].
12
12
 
13
- You can use it to retrieve metadata of Plateau Standards from GitHub repositori, and access such metadata through the `BibliographicItem` object.
13
+ You can use it to retrieve metadata of Plateau Standards from the GitHub repository, and access such metadata through the `Relaton::Plateau::ItemData` object.
14
14
 
15
15
  == Installation
16
16
 
@@ -38,10 +38,11 @@ Or install it yourself as:
38
38
  [source,ruby]
39
39
  ----
40
40
  require "relaton/plateau"
41
+
41
42
  Relaton::Plateau::Bibliography.get("PLATEAU Technical Report #00")
42
43
  [relaton-plateau] INFO: (PLATEAU Technical Report #00) Fetching ...
43
44
  [relaton-plateau] INFO: (PLATEAU Technical Report #00) Found `PLATEAU Technical Report #00 1.0`
44
- => #<Relaton::Plateau::BibItem:0x00000001238cfc98
45
+ => #<Relaton::Plateau::ItemData:0x00000001236204e8
45
46
  ...
46
47
  ----
47
48
 
@@ -52,7 +53,7 @@ Relaton::Plateau::Bibliography.get("PLATEAU Technical Report #00")
52
53
  Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00")
53
54
  [relaton-plateau] INFO: (PLATEAU Handbook #00) Fetching ...
54
55
  [relaton-plateau] INFO: (PLATEAU Handbook #00) Found `PLATEAU Handbook #00`
55
- => #<Relaton::Plateau::BibItem:0x00000001238c7598
56
+ => #<Relaton::Plateau::ItemData:0x00000001242bd200
56
57
  ...
57
58
  ----
58
59
 
@@ -63,7 +64,7 @@ Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00")
63
64
  bib = Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00 1.0")
64
65
  [relaton-plateau] INFO: (PLATEAU Handbook #00 1.0) Fetching ...
65
66
  [relaton-plateau] INFO: (PLATEAU Handbook #00 1.0) Found `PLATEAU Handbook #00 1.0`
66
- => #<Relaton::Plateau::BibItem:0x0000000104afbcc0
67
+ => #<Relaton::Plateau::ItemData:0x0000000124157320
67
68
  ...
68
69
  ----
69
70
 
@@ -73,216 +74,88 @@ bib = Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00 1.0")
73
74
 
74
75
  [source,ruby]
75
76
  ----
76
- # Render bibitem
77
77
  puts bib.to_xml
78
- <bibitem id="PLATEAUHandbook#001.0" type="standard" schema-version="v1.2.9">
79
- <fetched>2024-08-25</fetched>
80
- <title type="main" format="text/plain" language="ja" script="Jpan">3D都市モデルの導入ガイダンス</title>
81
- <title type="main" format="text/plain" language="en" script="Latn">Guidance on the Installation for 3D City Model</title>
82
- <uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
83
- <docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.0</docidentifier>
84
- <docnumber>Handbook #00 1.0</docnumber>
85
- <date type="published">
86
- <on>2021-03-26</on>
87
- </date>
88
- <contributor>
89
- <role type="publisher"/>
90
- <organization>
91
- <name language="ja" script="Jpan">国土交通省</name>
92
- <name language="en" script="Latn">Japanese Ministry of Land, Infrastructure, Transport and Tourism</name>
93
- <abbreviation>MLIT</abbreviation>
94
- </organization>
95
- </contributor>
96
- <edition number="1.0">1.0</edition>
97
- <abstract format="text/plain" language="ja" script="Jpan">地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
98
- </bibitem>
99
-
100
- # Render bibdata
101
- puts bib.to_xml(bibdata: true)
102
- <bibdata type="standard" schema-version="v1.2.9">
103
- <fetched>2024-08-25</fetched>
104
- <title type="main" format="text/plain" language="ja" script="Jpan">3D都市モデルの導入ガイダンス</title>
105
- <title type="main" format="text/plain" language="en" script="Latn">Guidance on the Installation for 3D City Model</title>
106
- <uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
107
- <docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.</docidentifier>
108
- <docnumber>Handbook #00 1.0</docnumber>
109
- <date type="published">
110
- <on>2021-03-26</on>
111
- </date>
112
- <contributor>
113
- <role type="publisher"/>
114
- <organization>
115
- <name language="ja" script="Jpan">国土交通省</name>
116
- <name language="en" script="Latn">Japanese Ministry of Land, Infrastructure, Transport and Tourism</name>
117
- <abbreviation>MLIT</abbreviation>
118
- </organization>
119
- </contributor>
120
- <edition number="1.0">1.0</edition>
121
- <abstract format="text/plain" language="ja" script="Jpan">地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
122
- <ext>
123
- <doctype>handbook</doctype>
124
- <structuredidentifier type="Handbook">
125
- <agency>PLATEAU</agency>
126
- <docnumber>00</docnumber>
127
- <edition>1.0</edition>
128
- </structuredidentifier>
129
- <cover>
130
- <image src="https://www.mlit.go.jp//plateau/uploads/2022/06/1@2x.jpg" mimetype="image/jpeg"/>
131
- </cover>
132
- <filesize>18381880</filesize>
133
- </ext>
134
- </bibdata>
78
+ => "<bibitem id="PLATEAUHandbook0010" type="standard" schema-version="v1.4.1">
79
+ <title language="en" script="Latn" type="main">PLATEAU Guidebook</title>
80
+ <uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
81
+ <docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.0</docidentifier>
82
+ ...
83
+ </bibitem>"
84
+
85
+ puts bib.to_xml bibdata: true
86
+ => "<bibdata type="standard" schema-version="v1.4.1">
87
+ <title language="en" script="Latn" type="main">PLATEAU Guidebook</title>
88
+ <uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
89
+ <docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.0</docidentifier>
90
+ ...
91
+ <ext schema-version="v0.0.2">
92
+ <doctype>handbook</doctype>
93
+ <flavor>plateau</flavor>
94
+ <structuredidentifier type="Handbook">
95
+ <agency>PLATEAU</agency>
96
+ <docnumber>00</docnumber>
97
+ <edition>1.0</edition>
98
+ </structuredidentifier>
99
+ <filesize>18381880</filesize>
100
+ </ext>
101
+ </bibdata>"
135
102
  ----
136
103
 
137
104
  ==== YAML
105
+
138
106
  [source,ruby]
139
107
  ----
140
- puts bib.to_hash.to_yaml
141
- ---
142
- schema-version: v1.2.9
143
- id: PLATEAUHandbook#001.0
144
- title:
145
- - content: 3D都市モデルの導入ガイダンス
146
- language:
147
- - ja
148
- script:
149
- - Jpan
150
- format: text/plain
151
- type: main
152
- - content: Guidance on the Installation for 3D City Model
153
- language:
154
- - en
155
- script:
156
- - Latn
157
- format: text/plain
158
- type: main
159
- link:
160
- - content: https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf
161
- type: pdf
162
- type: standard
163
- docid:
164
- - id: 'PLATEAU Handbook #00 1.0'
165
- type: PLATEAU
166
- primary: true
167
- docnumber: 'Handbook #00 1.0'
168
- date:
169
- - type: published
170
- value: '2021-03-26'
171
- contributor:
172
- - organization:
173
- name:
174
- - content: 国土交通省
175
- language:
176
- - ja
177
- script:
178
- - Jpan
179
- - content: Japanese Ministry of Land, Infrastructure, Transport and Tourism
180
- language:
181
- - en
182
- script:
183
- - Latn
184
- abbreviation:
185
- content: MLIT
186
- role:
187
- - type: publisher
188
- edition:
189
- content: 1.0
190
- number: '1.0'
191
- revdate: '2021-03-26'
192
- abstract:
193
- - content: 地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス
194
- language:
195
- - ja
196
- script:
197
- - Jpan
198
- format: text/plain
199
- fetched: '2024-08-25'
200
- doctype:
201
- type: handbook
202
- structuredidentifier:
203
- - docnumber: '00'
204
- type: Handbook
205
- agency:
206
- - PLATEAU
207
- edition: 1.0
208
- ext:
209
- cover:
210
- image:
211
- src: https://www.mlit.go.jp//plateau/uploads/2022/06/1@2x.jpg
212
- mimetype: image/jpeg
213
- filesize: 18381880
108
+ bib.to_yaml
109
+ => "---
110
+ id: PLATEAUHandbook0010
111
+ type: standard
112
+ schema_version: v1.4.1
113
+ ..."
214
114
  ----
215
115
 
216
- ==== BibXML
116
+ === Create from XML
217
117
 
218
118
  [source,ruby]
219
119
  ----
220
- puts bib.to_bibxml
221
- <reference anchor="PLATEAU.Handbook.#00.1.0">
222
- <front>
223
- <title>3D都市モデルの導入ガイダンス</title>
224
- <date year="2021" month="March" day="26"/>
225
- <abstract>地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
226
- </front>
227
- </reference>
120
+ Relaton::Plateau::Item.from_xml File.read("spec/fixtures/handbook.xml")
121
+ => #<Relaton::Plateau::ItemData:0x0000000123b99118
122
+ ...
228
123
  ----
229
124
 
230
- ==== AsciiBib
125
+ === Create from YAML
231
126
 
232
127
  [source,ruby]
233
128
  ----
234
- puts bib.to_asciibib
235
- [%bibitem]
236
- == {blank}
237
- id:: PLATEAUHandbook#001.0
238
- title::
239
- title.type:: main
240
- title.content:: 3D都市モデルの導入ガイダンス
241
- title.language:: ja
242
- title.script:: Jpan
243
- title.format:: text/plain
244
- title::
245
- title.type:: main
246
- title.content:: Guidance on the Installation for 3D City Model
247
- title.language:: en
248
- title.script:: Latn
249
- title.format:: text/plain
250
- type:: standard
251
- docid.type:: PLATEAU
252
- docid.primary:: true
253
- docid.id:: PLATEAU Handbook #00 1.0
254
- edition.content:: 1.0
255
- edition.number:: 1.0
256
- date.type:: published
257
- date.on:: 2021-03-26
258
- abstract.content:: 地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス
259
- abstract.language:: ja
260
- abstract.script:: Jpan
261
- abstract.format:: text/plain
262
- link.type:: pdf
263
- link.content:: https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf
264
- doctype.type:: handbook
265
- structured_identifier.docnumber:: 00
266
- structured_identifier.agency:: PLATEAU
267
- structured_identifier.type:: Handbook
268
- structured_identifier.edition:: 1.0
269
- cover.image.src:: https://www.mlit.go.jp//plateau/uploads/2022/06/1@2x.jpg
270
- cover.image.mimetype:: image/jpeg
271
- filesize:: 18381880
129
+ Relaton::Plateau::Item.from_yaml File.read("spec/fixtures/item.yaml")
130
+ => #<Relaton::Plateau::ItemData:0x00000001209fd208
131
+ ...
272
132
  ----
273
133
 
274
134
  === Fetching data
275
135
 
276
- Two datasets are available for fetching: `platau-handbooks` and `plateau-technical-reports`. The data is stored in the `data` directory. The format can be `xml`, 'yaml', or `bibxml`.
136
+ Two datasets are available for fetching: `plateau-handbooks` and `plateau-technical-reports`. The format can be `xml`, `yaml`, or `bibxml`.
277
137
 
278
138
  [source,ruby]
279
139
  ----
280
- Relaton::Plateau::Fetcher.fetch("plateau-handbooks", output: "dir", format: "xml")
140
+ require "relaton/plateau/data_fetcher"
141
+
142
+ Relaton::Plateau::DataFetcher.fetch("plateau-handbooks", output: "dir", format: "xml")
143
+ Started at: 2026-03-02 15:36:03 -0500
144
+ Stopped at: 2026-03-02 15:36:04 -0500
145
+ Done in: 1 sec.
281
146
  ----
282
147
 
148
+ == Logging
149
+
150
+ RelatonPlateau uses https://github.com/relaton/relaton-logger[relaton-logger] for logging. By default, it logs to STDERR. To change the log level and output, use `Relaton.logger_pool` and `Relaton.logger`.
151
+
152
+ == Development
153
+
154
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
155
+
283
156
  == Contributing
284
157
 
285
- Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-plateau
158
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-plateau
286
159
 
287
160
  == License
288
161