0.01
The project is in a healthy, maintained state
RelatonBipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem model
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.10
~> 1.20.0
~> 2.3.0
~> 2.7.0
~> 2.0.0
 Project Readme

RelatonBipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem model

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

RelatonBipm is a Ruby gem that implements the IsoBibliographicItem model.

You can use it to retrieve metadata of BIPM Standards from https://www.bipm.org, and access such metadata through the BipmBibliographicItem object.

Installation

Add this line to your application’s Gemfile:

gem 'relaton-bipm'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install relaton-bipm

Usage

Search for a standard using keywords

References for Si-Brochure documents

BIPM {DOCUMENT_NAME}

Allowed document names are:

  • CCEM-GD-RSI-1

  • CCL-GD-MeP-1

  • CCL-GD-MeP-2

  • CCL-GD-MeP-3

  • CCM-GD-RSI-1

  • CCM-GD-RSI-2

  • SI MEP A1

  • SI MEP Cd1

  • Rapport BIPM-2019/05

  • SI MEP KUPRTM

  • SI MEP KAPRT

  • SI MEP K1

  • SI MEP KLJNT

  • SI MEP KRPRT

  • SI MEP Kg1

  • SI MEP M1

  • SI MEP Mol1

  • SI MEP S1

  • SI Brochure

  • SI Brochure, Appendix 4

Reference structure for Metrologia documents

BIPM Metrologia {JOURNAL} {VOLUME} {ISSUE}

  • {JOURNAL} - journal number, optional

  • {VOLUME} - volume number, optional

  • {ISSUE} - issue number, optional

Reference structures for Outcomes documents

Basic pattern
Long:
{group name} -- {type} {number} ({year})
{group name} {type} {number} ({year})
{group name} {type} {year}-{zero_leading_number}

Short:
{group name} -- {type-abbrev} {number} ({year}, {lang})
{group name} {type-abbrev} {number} ({year}, {lang})
  • group name - a name of the group, required. A full list of group names is available here.

  • type - a type of document, required. A list of types is: Resolution (Résolution), Recommendation (Recommandation), Decision (Décision), Meeting (Réunion), Declaration (Déclaration).

  • type-abbrev - an abbreviation of the type, required. A list of abbreviations: RES (Resolution), REC (Recommendation), DECN (Decision).

  • number - a number of the document, optional. Can be with part, e.g. 1-2.

  • zero_leading_number - a number of the document with a leading zero, required. Can be used when a document has a 1 or 2 digits number. It’s 00 for documents without a number.

  • year - a year of the document, optional.

  • lang - a language of the document, optional. Can be EN or FR.

Special case pattern

The basic pattern works fine for all, except for these 2 cases:

  • Decisions of the CIPM (since 2012)

  • Recommendations/Resolutions/Decisions of the JCRB

Where the committee name is part of the outcome identifier.
Special cases:

Decision CIPM/111-10 (2022) / Décision CIPM/111-10 (2022)
Recommendation JCRB/43-1 (2021) / Recommandation JCRB/43-1 (2021)
Single language version (English)

type can be:

  • Resolution (RES)

  • Recommendation (REC)

  • Decision (DECN)

  • Statement (DECL)

e.g.

CCTF -- Recommendation 2 (1970)
CCTF -- REC 2 (1970, EN)

Special cases:

Decision CIPM/111-10 (2022)
CIPM DECN CIPM/111-10 (2022, EN)
Recommendation JCRB/43-1 (2021)
JCRB REC JCRB/43-1 (2021, EN)
Single language version (French)

type can be:

  • Résolution (RES)

  • Recommandation (REC)

  • Décision (DECN)

  • Déclaration (DECL)

e.g.

CCTF -- Recommandation 2 (1970)
CCTF -- REC 2 (1970, FR)

Special cases:

Décision CIPM/111-10 (2022)
CIPM DECN CIPM/111-10 (2022, FR)
Recommandation JCRB/43-1 (2021)
JCRB REC JCRB/43-1 (2021, FR)
Dual language version (language independent version)

type can be in their respective languages or the following abbreviations:

  • RES

  • REC

  • DECN

  • DECL

CCTF -- Recommandation 2 (1970) / Recommendation 2 (1970)
CCTF REC 2 (1970)

Special cases:

Decision CIPM/110-10 (2022) / Décision CIPM/111-10 (2022)
CIPM DECN CIPM/110-10 (2022)
Recommendation JCRB/43-1 (2021) / Recommandation JCRB/43-1 (2021)
JCRB REC JCRB/43-1 (2021)

Examples

require "relaton_bipm"
=> true

# get BIPM brochure
item = RelatonBipm::BipmBibliography.get "BIPM SI Brochure"
[relaton-bipm] (BIPM SI Brochure) Fetching from Relaton repository ...
[relaton-bipm] (BIPM SI Brochure) Found: `BIPM SI Brochure`
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb83982fe8
...

# get BIPM Metrologia page
bib = RelatonBipm::BipmBibliography.get "BIPM Metrologia 29 6 001"
[relaton-bipm] (BIPM Metrologia 29 6 001) Fetching from Relaton repository ...
[relaton-bipm] (BIPM Metrologia 29 6 001) Found: `Metrologia 29 6 001`
=> #<RelatonBipm::BipmBibliographicItem:0x007f8857f94d40
...

# get CGPM meetings
RelatonBipm::BipmBibliography.get "CGPM 1st Meeting (1889)"
[relaton-bipm] (CGPM 1st Meeting (1889)) Fetching from Relaton repository ...
[relaton-bipm] (CGPM 1st Meeting (1889)) Found: `CGPM 1th meeting (1889)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f7fd02aba28
...

# get CGPM resolutions
RelatonBipm::BipmBibliography.get "CGPM RES (1889, E)"
[relaton-bipm] (CGPM RES (1889, E)) Fetching from Relaton repository ...
[relaton-bipm] (CGPM RES (1889, E)) Found: `CGPM RES (1889)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f80421f93d8
...

RelatonBipm::BipmBibliography.get "CGPM Resolution (1889)"
[relaton-bipm] (CGPM Resolution (1889)) Fetching from Relaton repository ...
[relaton-bipm] (CGPM Resolution (1889)) Found: `CGPM RES (1889)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f60c18
...

RelatonBipm::BipmBibliography.get "CGPM Résolution (1889)"
[relaton-bipm] (CGPM Résolution (1889)) Fetching from Relaton repository ...
[relaton-bipm] (CGPM Résolution (1889)) Found: `CGPM RES (1889)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f492e8
...

# get CIPM decision by year and decision number
RelatonBipm::BipmBibliography.get "BIPM Decision CIPM/101-1 (2012)"
[relaton-bipm] (BIPM Decision CIPM/101-1 (2012)) Fetching from Relaton repository ...
[relaton-bipm] (BIPM Decision CIPM/101-1 (2012)) Found: `CIPM DECN 101-1 (2012)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f2bd88
...

RelatonBipm::BipmBibliography.get "BIPM DECN CIPM/101-1 (2012, E)"
[relaton-bipm] (BIPM DECN CIPM/101-1 (2012, E)) Fetching from Relaton repository ...
[relaton-bipm] (BIPM DECN CIPM/101-1 (2012, E)) Found: `CIPM DECN 101-1 (2012)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f39438
...

# get CIPM recommendation
RelatonBipm::BipmBibliography.get "CIPM Recommendation 1 (2005)"
[relaton-bipm] (CIPM Recommendation 1 (2005)) Fetching from Relaton repository ...
[relaton-bipm] (CIPM Recommendation 1 (2005)) Found: `CIPM REC 1 (2005)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f8017f31da0
...

RelatonBipm::BipmBibliography.get "CIPM REC 1 (2005, FR)"
[relaton-bipm] (CIPM REC 1 (2005, FR)) Fetching from Relaton repository ...
[relaton-bipm] (CIPM REC 1 (2005, FR)) Found: `CIPM REC 1 (2005)`
=> #<RelatonBipm::BipmBibliographicItem:0x00007f80422100d8
...

XML serialization

item.to_xml
=> "<bibitem id="BIPMSIBrochurePart1" type="standard" schema-version="v1.2.1">
      <fetched>2022-12-02</fetched>
      <title type="main" format="text/plain" language="en">The International System of Units</title>
      <title type="cover" format="text/plain" language="en">The International System of Units (SI)</title>
      <title type="main" format="text/plain" language="fr">Le Système international d’unités</title>
      <title type="cover" format="text/plain" language="fr">Le Système international d’unités (SI)</title>
      <docidentifier type="BIPM" primary="true">BIPM SI Brochure</docidentifier>
      ...
    </bibitem>"

With argument bibdata: true it outputs XML wrapped by bibdata element and adds flavor ext element.

item.to_xml bibdata: true
=> "<bibdata type="standard" schema-version="v1.2.1">
      <fetched>2022-12-02</fetched>
      <title type="main" format="text/plain" language="en">The International System of Units</title>
      <title type="cover" format="text/plain" language="en">The International System of Units (SI)</title>
      <title type="main" format="text/plain" language="fr">Le Système international d’unités</title>
      <title type="cover" format="text/plain" language="fr">Le Système international d’unités (SI)</title>
      <docidentifier type="BIPM" primary="true">BIPM SI Brochure</docidentifier>
      ...
      <ext schema-version="v1.0.0">
        <doctype>brochure</doctype>
        ...
      </ext>
    </bibdata>"

Each BIPM document has src type link and an optional doi type link.

bib.link
=> [#<RelatonBib::TypedUri:0x00007fa6d6a51728 @content=#<Addressable::URI:0xc29c URI:https://iopscience.iop.org/article/10.1088/0026-1394/29/6/001>, @type="src">,
 #<RelatonBib::TypedUri:0x00007fa6d6a29250 @content=#<Addressable::URI:0xc2b0 URI:https://doi.org/10.1088/0026-1394/29/6/001>, @type="doi">]

Create a bibliographic item from XML

RelatonBipm::XMLParser.from_xml File.read('spec/fixtures/bipm_item.xml')
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb83827a90
...

Create a bibliographic item from YAML

hash = YAML.load_file 'spec/fixtures/bipm_item.yml'
=> {"id"=>"Draft-Agenda-NMI-Dir-Meeting-2017-v10",
...

RelatonBipm::BipmBibliographicItem.from_hash hash
=> #<RelatonBipm::BipmBibliographicItem:0x007ffb668755a0
...

Fetch data

This gem uses the following datasets as data sources: - bipm-data-outcomes - looking for a local directory with the repository https://github.com/metanorma/bipm-data-outcomes - bipm-si-brochute - looking for a local directory with the repository https://github.com/metanorma/bipm-si-brochure - rawdata-bipm-metrologia - looking for a local directory with the repository https://github.com/relaton/rawdata-bipm-metrologia

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

  • source - the name of the source dataset

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

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

RelatonBipm::DataFetcher.fetch "bipm-data-outcomes"
Started at: 2022-06-23 09:36:55 +0200
Stopped at: 2022-06-23 09:36:58 +0200
Done in: 2 sec.
=> nil

RelatonBipm::DataFetcher.fetch "bipm-si-brochure"
Started at: 2022-06-23 09:37:12 +0200
Stopped at: 2022-06-23 09:37:12 +0200
Done in: 0 sec.
=> nil

RelatonBipm::DataFetcher.fetch "rawdata-bipm-metrologia"
Started at: 2022-06-23 09:39:12 +0200
Stopped at: 2022-06-23 09:40:34 +0200
Done in: 82 sec.
=> nil

Logging

RelatonBipm 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 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/relaton/relaton-bipm.

License

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