= RelatonOasis: retrieve OASIS Standards for bibliographic use using the BibliographicItem model
image:https://img.shields.io/gem/v/relaton-oasis.svg["Gem Version", link="https://rubygems.org/gems/relaton-oasis"] image:https://github.com/relaton/relaton-oasis/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-oasis/actions?workflow=macos"] image:https://github.com/relaton/relaton-oasis/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-oasis/actions?workflow=windows"] image:https://github.com/relaton/relaton-oasis/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-oasis/actions?workflow=ubuntu"] image:https://codeclimate.com/github/relaton/relaton-oasis/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-oasis"] image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-oasis.svg["Pull Requests", link="https://github.com/relaton/relaton-oasis/pulls"] image:https://img.shields.io/github/commits-since/relaton/relaton-oasis/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-oasis/releases"]
RelatonOasis 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 OASIS Standards from https://www.oasis-open.org/standards/ and access such metadata through the OasisBibliographicItem
object.
== Installation
Add this line to your application's Gemfile:
gem 'relaton-oasis'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install relaton-oasis
== Usage
=== Get standard using reference.
All the OASIS documents are parsed from https://www.oasis-open.org/standards/ and stored in a GitHub repository https://github.com/relaton/relaton-data-oasis. You can find all possible references on the index page https://relaton.github.io/relaton-data-oasis/.
require 'relaton_oasis' => true
OASIS amqp-core
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceea1aecb0
...=== XML serialization
item.to_xml
=> "
<title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
<docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
...
</bibitem>"
With argument bibdata: true
it ouputs XML wrapped by bibdata
element and adds flavour ext
element.
item.to_xml bibdata: true
=> "
<title type="main" format="text/plain" language="en" script="Latn">Advanced Message Queueing Protocol (AMQP) v1.0</title>
<docidentifier type="OASIS" primary="true">OASIS amqp-core</docidentifier>
...
<ext schema-version="v1.0.1">
<doctype>standard</doctype>
<editorialgroup>
<technical-committee>OASIS Advanced Message Queuing Protocol (AMQP) TC</technical-committee>
</editorialgroup>
<technology-area>Messaging</technology-area>
</ext>
</bibdata>"
=== Typed links
Some OASIS documents have src
type link.
item = RelatonOasis::OasisBibliography.get "OASIS amqp-core-types-v1.0-Pt1"
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Fetching from Relaton repository ...
[relaton-oasis] (OASIS amqp-core-types-v1.0-Pt1) Found: OASIS amqp-core-types-v1.0-Pt1
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceda0c5e08
...
=== Create bibliographic item from XML
hash = YAML.load_file "spec/fixtures/oasis_bibdata.yaml" => {"schema-version"=>"v1.2.9", "id"=>"OASISamqp-core", ...
=== Fetch data
The OASIS documents can be fetched from https://www.oasis-open.org/standards/ and converted into RelatonXML/BibXML/BibYAML formats:
The method RelatonOasis::DataFetcher.fetch(output: "data", format: "yaml")
fetches and converts all the documents from the https://www.oasis-open.org/standards/ and save 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
).=== Logging
RelatonOasis 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.
== Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-oasis.
== License
The gem is available as open source under the terms of the MIT License.