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

RelatonOasis is a Ruby gem that implements the 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

Configuration

Configuration is optional. The available option is logger which is a Logger instance. By default, the logger is Logger.new($stderr) with Logger::WARN level. To change the logger level, use RelatonOasis.configure block.

require 'relaton_oasis'
=> true

RelatonOasis.configure do |config|
  config.logger.level = Logger::DEBUG
end

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/.

item = RelatonOasis::OasisBibliography.get "OASIS amqp-core"
[relaton-oasis] (OASIS) amqp-core Fetching from Relaton repository ...
[relaton-oasis] (OASIS amqp-core) Found: `OASIS amqp-core`
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceea1aecb0
...

XML serialization

item.to_xml
=> "<bibitem id="OASISamqp-core" type="standard" schema-version="v1.2.8">
      <fetched>2022-12-05</fetched>
      <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
=> "<bibdata type="standard" schema-version="v1.2.8">
      <fetched>2022-12-05</fetched>
      <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>"

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

item.link
=> [#<RelatonBib::TypedUri:0x00007fceda0bf990
  @content=#<Addressable::URI:0xbe00 URI:http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-types-v1.0-os.html>,
  @type="src">]

Create bibliographic item from XML

RelatonOasis::XMLParser.from_xml File.read("spec/fixtures/oasis_bibdata.xml")
=> #<RelatonOasis::OasisBibliographicItem:0x00007f88ab9d1d78
...

Create bibliographic item from YAML

hash = YAML.load_file "spec/fixtures/oasis_bibdata.yaml"
=> {"schema-version"=>"v1.2.8",
 "id"=>"OASISamqp-core",
...

RelatonOasis::OasisBibliographicItem.from_hash hash
=> #<RelatonOasis::OasisBibliographicItem:0x00007fceea0b6628
...

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).

RelatonOasis::DataFetcher.fetch
Started at: 2022-03-18 18:34:06 +0100
Stopped at: 2022-03-18 18:34:12 +0100
Done in: 5 sec.
=> nil

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-oasis.

License

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