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 BibliographicItem model.

You can use it to retrieve metadata of Plateau Standards from GitHub repositori, and access such metadata through the BibliographicItem 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`
 => #<Relaton::Plateau::BibItem:0x00000001238cfc98
...

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::BibItem:0x00000001238c7598
...

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::BibItem:0x0000000104afbcc0
...

Serializing

XML

# Render bibitem
puts bib.to_xml
<bibitem id="PLATEAUHandbook#001.0" type="standard" schema-version="v1.2.9">
  <title type="main" format="text/plain" language="ja" script="Jpan">3D都市モデルの導入ガイダンス</title>
  <title type="main" format="text/plain" language="en" script="Latn">Guidance on the Installation for 3D City Model</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>
  <date type="published">
    <on>2021-03-26</on>
  </date>
  <edition number="1.0">1.0</edition>
  <abstract format="text/plain" language="ja" script="Jpan">地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
</bibitem>

# Render bibdata
puts bib.to_xml(bibdata: true)
<bibdata type="standard" schema-version="v1.2.9">
  <title type="main" format="text/plain" language="ja" script="Jpan">3D都市モデルの導入ガイダンス</title>
  <title type="main" format="text/plain" language="en" script="Latn">Guidance on the Installation for 3D City Model</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.</docidentifier>
  <date type="published">
    <on>2021-03-26</on>
  </date>
  <edition number="1.0">1.0</edition>
  <abstract format="text/plain" language="ja" script="Jpan">地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
  <ext>
    <doctype>handbook</doctype>
    <structuredidentifier type="Handbook">
      <agency>PLATEAU</agency>
      <docnumber>00</docnumber>
      <edition>1.0</edition>
    </structuredidentifier>
    <cover>
      <image src="https://www.mlit.go.jp//plateau/uploads/2022/06/[email protected]" mimetype="image/jpeg"/>
    </cover>
    <filesize>18381880</filesize>
  </ext>
</bibdata>

YAML

puts bib.to_hash.to_yaml
---
schema-version: v1.2.9
id: PLATEAUHandbook#001.0
title:
- content: 3D都市モデルの導入ガイダンス
  language:
  - ja
  script:
  - Jpan
  format: text/plain
  type: main
- content: Guidance on the Installation for 3D City Model
  language:
  - en
  script:
  - Latn
  format: text/plain
  type: main
link:
- content: https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf
  type: pdf
type: standard
docid:
- id: 'PLATEAU Handbook #00 1.0'
  type: PLATEAU
  primary: true
date:
- type: published
  value: '2021-03-26'
edition:
  content: 1.0
  number: '1.0'
revdate: '2021-03-26'
abstract:
- content: 地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス
  language:
  - ja
  script:
  - Jpan
  format: text/plain
doctype:
  type: handbook
structuredidentifier:
- docnumber: '00'
  type: Handbook
  agency:
  - PLATEAU
  edition: 1.0
ext:
  cover:
    image:
      src: https://www.mlit.go.jp//plateau/uploads/2022/06/[email protected]
      mimetype: image/jpeg
  filesize: 18381880

BibXML

puts bib.to_bibxml
<reference anchor="PLATEAU.Handbook.#00.1.0">
  <front>
    <title>3D都市モデルの導入ガイダンス</title>
    <date year="2021" month="March" day="26"/>
    <abstract>地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス</abstract>
  </front>
</reference>

AsciiBib

puts bib.to_asciibib
[%bibitem]
== {blank}
id:: PLATEAUHandbook#001.0
title::
title.type:: main
title.content:: 3D都市モデルの導入ガイダンス
title.language:: ja
title.script:: Jpan
title.format:: text/plain
title::
title.type:: main
title.content:: Guidance on the Installation for 3D City Model
title.language:: en
title.script:: Latn
title.format:: text/plain
type:: standard
docid.type:: PLATEAU
docid.primary:: true
docid.id:: PLATEAU Handbook #00 1.0
edition.content:: 1.0
edition.number:: 1.0
date.type:: published
date.on:: 2021-03-26
abstract.content:: 地方自治体担当者や民間事業者等に向けた 3D都市モデル導入のためのガイダンス
abstract.language:: ja
abstract.script:: Jpan
abstract.format:: text/plain
link.type:: pdf
link.content:: https://www.mlit.go.jp/plateau/file/libraries/doc/plateau_doc_0000_ver01.pdf
doctype.type:: handbook
structured_identifier.docnumber:: 00
structured_identifier.agency:: PLATEAU
structured_identifier.type:: Handbook
structured_identifier.edition:: 1.0
cover.image.src:: https://www.mlit.go.jp//plateau/uploads/2022/06/[email protected]
cover.image.mimetype:: image/jpeg
filesize:: 18381880

Fetching data

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.

Relaton::Plateau::Fetcher.fetch("plateau-handbooks", output: "dir", format: "xml")

Contributing

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

License

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