Gem Version Build Status, link= Code Climate Pull Requests Commits since latest

RelatonJis is a Ruby gem that implements the IsoBibliographicItem model.

You can use it to retrieve metadata of JIS Standards from https://webdesk.jsa.or.jp, and access such metadata through the Relaton::Jis::ItemData object.

Installation

Install the gem and add to the application’s Gemfile by executing:

$ bundle add relaton-jis

If bundler is not being used to manage dependencies, install the gem by executing:

$ gem install relaton-jis

Usage

Search for standards using keywords

require 'relaton/jis'
=> true

hit_collection = Relaton::Jis::Bibliography.search("JIS X 0208")
=> <Relaton::Jis::HitCollection:0x000000000014a0 @ref=JIS X 0208 @fetched=false>

hit_collection.first
=> <Relaton::Jis::Hit:0x00000000001a20 @reference="JIS X 0208" @fetched="false" @docidentifier="">

item = hit_collection[1].item
=> #<Relaton::Jis::ItemData:0x000000012a880790
...

item.docidentifier[0].type
=> "JIS"

item.docidentifier[0].content
=> "JIS X 0208:1997/AMENDMENT 1:2012"

Fetch document by reference and year

item = Relaton::Jis::Bibliography.get "JIS X 0208:1997"
[relaton-jis] INFO: (JIS X 0208:1997) Fetching from webdesk.jsa.or.jp ...
[relaton-jis] INFO: (JIS X 0208:1997) Found: `JIS X 0208:1997`
=> #<Relaton::Jis::ItemData:0x000000012c0f2440
...

item = Relaton::Jis::Bibliography.get "JIS X 0208", "1997"
[relaton-jis] INFO: (JIS X 0208) Fetching from webdesk.jsa.or.jp ...
[relaton-jis] INFO: (JIS X 0208) Found: `JIS X 0208:1997`
=> #<Relaton::Jis::ItemData:0x000000012c1d7810
...

item.docidentifier[0].content
=> "JIS X 0208:1997"

Fetch all parts of a standard

item = Relaton::Jis::Bibliography.get "JIS B 0060 (all parts)"
[relaton-jis] INFO: (JIS B 0060 (all parts)) Fetching from webdesk.jsa.or.jp ...
[relaton-jis] INFO: (JIS B 0060 (all parts)) Found: `JIS B 0060 (all parts)`
=> #<Relaton::Jis::ItemData:0x00000001273c8840
...

item.docidentifier[0].content
=> "JIS B 0060 (all parts)"

item = Relaton::Jis::Bibliography.get "JIS B 0060 (規格群)"
[relaton-jis] INFO: (JIS B 0060 (規格群)) Fetching from webdesk.jsa.or.jp ...
[relaton-jis] INFO: (JIS B 0060 (規格群)) Found: `JIS B 0060 (all parts)`
=> #<Relaton::Jis::ItemData:0x000000012cb367d0
...

item.docidentifier[0].content
=> "JIS B 0060 (all parts)"

XML serialization

Possible options:

  • bibdata - If true then wrapp item with bibdata element and add ext element.

item.to_xml
=> "<bibitem id="JISB006012015" type="standard" schema-version="v1.4.1">
      <fetched>2026-02-25</fetched>
      <title language="ja" script="Jpan">デジタル製品技術文書情報―第1部:総則</title>
      <title language="en" script="Latn">Digital technical product documentation (DTPD) -- Part 1: General code of practices</title>
      <uri type="src">https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+B+0060-1%3A2015</uri>
      <docidentifier type="JIS" primary="true">JIS B 0060 (all parts)</docidentifier>
      ...
    </bibitem>"

item.to_xml bibdata: true
=> "<bibdata type="standard" schema-version="v1.4.1">
      <fetched>2026-02-25</fetched>
      <title language="ja" script="Jpan">デジタル製品技術文書情報―第1部:総則</title>
      <title language="en" script="Latn">Digital technical product documentation (DTPD) -- Part 1: General code of practices</title>
      <uri type="src">https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+B+0060-1%3A2015</uri>
      <docidentifier type="JIS" primary="true">JIS B 0060 (all parts)</docidentifier>
      ...
      <ext schema-version="v0.0.1">
        <doctype>japanese-industrial-standard</doctype>
        <flavor>jis</flavor>
        <ics>
          <code>01.110</code>
          <text>Technical product documentation</text>
        </ics>
        <structuredidentifier type="JIS">
          <project-number>B0060 (all parts)</project-number>
        </structuredidentifier>
      </ext>
    </bibdata>"

Each JIS document has src type source link and optional pdf.

item.source[0].type
=> "src"

item.source[0].content
=> "https://webdesk.jsa.or.jp/books/W11M0090/index/?bunsyo_id=JIS+B+0060-1%3A2015"

Fetch data

This gem scrapes the https://webdesk.jsa.or.jp/books/W11M0270 pages to fetch the JIS Standards metadata. By default the data is saved in the ./data folder in YAML format.

The method Relaton::Jis::DataFetcher.fetch(output: "data", format: "yaml") fetches all the documents from the dataset and saves them to the ./data folder in YAML format. Arguments:

  • output - folder to save documents (default './data').

  • format - the format in which the documents are saved. Possible formats are: yaml, xml, bibxml (default yaml).

require "relaton/jis/data_fetcher"

Relaton::Jis::DataFetcher.fetch
Started at: 2024-09-27 17:49:40 -0400
Done in: 3031 sec.
=> nil

Logging

RelatonJis uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the relaton-logger documentation.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run 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-jis repository.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to [rubygems.org](https://rubygems.org).

Contributing

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

License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).