= RelatonJis: retrieve JIS Standards for bibliographic use using the BibliographicItem model image:https://img.shields.io/gem/v/relaton-jis.svg["Gem Version", link="https://rubygems.org/gems/relaton-jis"] image:https://github.com/relaton/relaton-jis/workflows/macos/badge.svg["Build Status, link="https://github.com/relaton/relaton-jis/actions?workflow=rake"] image:https://codeclimate.com/github/relaton/relaton-jis/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-jis"] image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-jis.svg["Pull Requests", link="https://github.com/relaton/relaton-jis/pulls"] image:https://img.shields.io/github/commits-since/relaton/relaton-jis/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-jis/releases"] RelatonJis is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model]. You can use it to retrieve metadata of JIS Standards from https://webdesk.jsa.or.jp, and access such metadata through the `RelatonJis::BibliographicItem` 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 [source,ruby] ---- require 'relaton_jis' => true hit_collection = RelatonJis::Bibliography.search("JIS X 0208") => hit_collection.first => item = hit_collection[2].fetch => # [#] ---- === Fetch document by reference and year [source,ruby] ---- item = RelatonJis::Bibliography.get "JIS X 0208:1997" [relaton-jis] (JIS X 0208:1997) Fetching from webdesk.jsa.or.jp ... [relaton-jis] (JIS X 0208:1997) Found: `JIS X 0208:1997` => # # "JIS X 0208:1997" ---- === Fetch all parts of a standard [source,ruby] ---- item = RelatonJis::Bibliography.get "JIS B 0060 (all parts)" [relaton-jis] (JIS B 0060 (all parts)) Fetching from webdesk.jsa.or.jp ... [relaton-jis] (JIS B 0060 (all parts)) Found: `JIS B 0060 (all parts)` => # [#] item = RelatonJis::Bibliography.get "JIS B 0060 (規格群)" [relaton-jis] (JIS B 0060 (規格群)) Fetching from webdesk.jsa.or.jp ... [relaton-jis] (JIS B 0060 (規格群)) Found: `JIS B 0060 (all parts)` => # [#] ---- === XML serialization Possible options: - *bibdata* - If true then wrapp item with _bibdata_ element and add _ext_ element. [source,ruby] ---- item.to_xml => " 2023-03-18 7ビット及び8ビットの2バイト情報交換用符号化漢字集合 7-bit and 8-bit double byte coded KANJI sets for information interchange ... " item.to_xml bibdata: true => " 2023-03-18 7ビット及び8ビットの2バイト情報交換用符号化漢字集合 7-bit and 8-bit double byte coded KANJI sets for information interchange ... standard 一般財団法人 日本規格協会 35.040 Information coding X0208 " ---- === Typed links Each JIS document has `src` type link and optional `pdf`. [source,ruby] ---- item.link => [#, @language=nil, @script=nil, @type="src">, #, @language=nil, @script=nil, @type="pdf">] ---- === 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 `RelatonJis::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`). [source,ruby] ---- RelatonJis::DataFetcher.fetch Start fetching JIS data at 2024-09-27 17:49:40 -0400 Fetching JIS data finished at 2024-09-27 18:40:11 -0400. It took 3031.0 seconds. => 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 https://github.com/relaton/relaton-logger#usage[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 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).