Skip to content
NistBib: retrieve NIST Standards for bibliographic use using the BibliographicItem model
Ruby Shell
Branch: master
Clone or download
Latest commit f0e8a7e Oct 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin rename gem to relaton-nist May 31, 2019
lib bump new version Oct 14, 2019
spec "require" flavor logic fixing #34 Aug 27, 2019
.gitignore Rationalise keys for relaton objects Jul 24, 2019
.rspec
.rubocop.yml fix issue #7 May 1, 2019
.travis.yml metanorma/metanorma-build-scripts#18 add ruby 2.6 to CI matrix Jul 19, 2019
Gemfile rename gem to relaton-nist May 31, 2019
Gemfile.lock bump new version Oct 14, 2019
LICENSE.txt create gem Feb 5, 2019
README.adoc Move some functionality to relaton-bib Sep 10, 2019
Rakefile create gem Feb 5, 2019
appveyor.yml metanorma/metanorma-build-scripts#18 add ruby 2.6 to CI matrix Jul 19, 2019
relaton_nist.gemspec Rationalise keys for relaton objects Jul 24, 2019

README.adoc

RelatonNist: retrieve NIST Standards for bibliographic use using the BibliographicItem model

Gem Version Build Status Appveyor Build Status Code Climate

RelatonNist is a Ruby gem that implements the IsoBibliographicItem model.

You can use it to retrieve metadata of NIST Standards from https://csrc.nist.gov, and access such metadata through the IsoBibliographicItem object.

Installation

Add this line to your application’s Gemfile:

gem 'relaton_nist'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton_nist

Usage

Search for a standard using keywords

require 'relaton_nist'

hit_collection = RelatonNist::NistBibliography.search("8200")
=> [<RelatonNist::Hit:0x007f82b9b2b298 @text="8200" @fetched="false" @fullIdentifier="" @title="8200">,
 <RelatonNist::Hit:0x007f82b9b2a1e0 @text="8200" @fetched="false" @fullIdentifier="" @title="8200">]

 item = hit_collection[1].fetch
 => #<RelatonNist::NistBibliographicItem:0x007f82b986e668
 ...

XML serialization

item.to_xml
=> "<bibitem id="NISTIR8200(DRAFT)" type="standard">
      <fetched>2019-05-03</fetched>
      <title format="text/plain" language="en" script="Latn">
        Interagency Report on Status of International Cybersecurity Standardization for the Internet of Things (IoT)
      </title>
      ...
    <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">
    <fetched>2019-05-17</fetched>
    <title format="text/plain" language="en" script="Latn">
      Interagency Report on Status of International Cybersecurity Standardization for the Internet of Things (IoT)
    </title>
    ...
    <ext>
      <doctype>stadard</doctype>
      <keyword>cybersecurity</keyword>
      <keyword>cybersecurity objectives</keyword>
      ...
      <commentperiod>
        <from>2018-02-01</from>
        <to>2018-04-18</to>
      </commentperiod>
    </ext>
  </bibdata>"

Get code, and year

RelatonNist::NistBibliography.get("8200", "2018", {})
fetching 8200...
=> #<RelatonNist::NistBibliographicItem:0x007f82bb3370a8
...

Get short citation

Short citation is a convetion about a citation’s format. The format for NIST publications is:

NIST {abbrev(series)} {docnumber} {(edition), optional} {(stage), optioal}
# or
{abbrev(series)} {docnumber} {(edition), optional} {(stage), optioal}
  • (stage) is empty if the state is "final" (published)

  • (edition) is the date of publication or update

  • docnumber is the full NIST number, including revision, e.g., 800-52

The format for FIPS publications is:

FIPS {docnumber}
# or
NIST FIPS {docnumber}
RelatonNist::NistBibliography.get("8200", "2018", {})
fetching 8200...
=> #<RelatonNist::NistBibliographicItem:0x007f82bb3370a8
...

Create bibliographic item from YAML

hash = YAML.load_file 'spec/examples/nist_bib_item.yml'
=> {"id"=>"NISTIR 8011 Vol. 3",
...

bib_hash = RelatonNist::HashConverter.hash_to_bib hash
=> {:id=>"NISTIR 8011 Vol. 3",
...

RelatonNist::NistBibliographicItem.new bib_hash
=> #<RelatonNist::NistBibliographicItem:0x007f8b708505b8
...

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 tags, 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/metanorma/relaton-nist.

License

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

You can’t perform that action at this time.