Gem Version Build Status (macOS) Build Status (Windows) Build Status (Ubuntu) Code Climate Pull Requests Commits since latest

RelatonPlateau is a Ruby gem that implements the ItemData model.

You can use it to retrieve metadata of Plateau Standards from the GitHub repository, and access such metadata through the Relaton::Plateau::ItemData object.

Installation

Add this line to your application’s Gemfile:

gem 'relaton-plateau'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton-plateau

Usage

Fetching

Fetching Technical Reports

require "relaton/plateau"

Relaton::Plateau::Bibliography.get("PLATEAU Technical Report #00")
[relaton-plateau] INFO: (PLATEAU Technical Report #00) Fetching ...
[relaton-plateau] INFO: (PLATEAU Technical Report #00) Found `PLATEAU Technical Report #00 1.0`
=> #<Relaton::Plateau::ItemData:0x00000001236204e8
...

Fetching Handbooks unversioned

Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00")
[relaton-plateau] INFO: (PLATEAU Handbook #00) Fetching ...
[relaton-plateau] INFO: (PLATEAU Handbook #00) Found `PLATEAU Handbook #00`
=> #<Relaton::Plateau::ItemData:0x00000001242bd200
...

Fetching Handbooks versioned

bib = Relaton::Plateau::Bibliography.get("PLATEAU Handbook #00 1.0")
[relaton-plateau] INFO: (PLATEAU Handbook #00 1.0) Fetching ...
[relaton-plateau] INFO: (PLATEAU Handbook #00 1.0) Found `PLATEAU Handbook #00 1.0`
=> #<Relaton::Plateau::ItemData:0x0000000124157320
...

Serializing

XML

puts bib.to_xml
=> "<bibitem id="PLATEAUHandbook0010" type="standard" schema-version="v1.4.1">
      <title language="en" script="Latn" type="main">PLATEAU Guidebook</title>
      <uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
      <docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.0</docidentifier>
      ...
    </bibitem>"

puts bib.to_xml bibdata: true
=> "<bibdata type="standard" schema-version="v1.4.1">
      <title language="en" script="Latn" type="main">PLATEAU Guidebook</title>
      <uri type="pdf">https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf</uri>
      <docidentifier type="PLATEAU" primary="true">PLATEAU Handbook #00 1.0</docidentifier>
      ...
      <ext schema-version="v0.0.2">
        <doctype>handbook</doctype>
        <flavor>plateau</flavor>
        <structuredidentifier type="Handbook">
          <agency>PLATEAU</agency>
          <docnumber>00</docnumber>
          <edition>1.0</edition>
        </structuredidentifier>
        <filesize>18381880</filesize>
      </ext>
    </bibdata>"

YAML

bib.to_yaml
=> "---
    id: PLATEAUHandbook0010
    type: standard
    schema_version: v1.4.1
    ..."

Create from XML

Relaton::Plateau::Item.from_xml File.read("spec/fixtures/handbook.xml")
=> #<Relaton::Plateau::ItemData:0x0000000123b99118
...

Create from YAML

Relaton::Plateau::Item.from_yaml File.read("spec/fixtures/item.yaml")
=> #<Relaton::Plateau::ItemData:0x00000001209fd208
...

Fetching data

Two datasets are available for fetching: plateau-handbooks and plateau-technical-reports. The format can be xml, yaml, or bibxml.

require "relaton/plateau/data_fetcher"

Relaton::Plateau::DataFetcher.fetch("plateau-handbooks", output: "dir", format: "xml")
Started at: 2026-03-02 15:36:03 -0500
Stopped at: 2026-03-02 15:36:04 -0500
Done in: 1 sec.

Logging

RelatonPlateau uses relaton-logger for logging. By default, it logs to STDERR. To change the log level and output, use Relaton.logger_pool and Relaton.logger.

Development

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.

To update the index test fixture (used by tests), run rake spec:update_index. This downloads the latest index-v1.zip from the relaton-data-plateau repository.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-plateau

License

The gem is available as open source under the terms of the MIT license.