DEPRECATION NOTICE
This gem is deprecated and no longer maintained. The code now lives in
the relaton monogem — relaton/relaton
(RubyGems: relaton >= 3.0) — which
bundles every former relaton-* flavor gem. This repository is archived
and read-only; issues and pull requests are disabled.
How to do what this gem did, with relaton
Install once:
# Gemfile
gem "relaton", "~> 3.0"Fetch bibliographic data — one entry point routes to the right dataset automatically; you never pick a flavor:
require "relaton"
db = Relaton::Db.new(nil, nil) # (global_cache, local_cache)
item = db.fetch("ISO 8601-1", "2019")
# [relaton-iso] INFO: (ISO 8601-1:2019) Found: `ISO 8601-1:2019`
item.docidentifier.first.content # => "ISO 8601-1:2019"
db.fetch("IEC 60050-112:2020") # => routed to the IEC dataset
db.fetch("ITU-T G.711") # => routed to the ITU dataset
db.fetch("JIS Z 8301:2019") # => routed to the JIS datasetThe router recognises every former flavor (ISO, IEC, IEEE, ITU, IETF, BIPM, NIST, OGC, W3C, IHO, JIS, GB, UN, CEN, ETSI, 3GPP, OASIS, Calconnect, CCSDS, CIE, ECMA, DOI, ISBN, IANA, XSF, Plateau, OIML and the rest) — all registered automatically.
Transform what you fetched — every fetched item serializes:
item.to_xml # => "<bibitem id=\"ISO860112019\" type=\"standard\" …>"
item.to_yaml # => the YAML rendering of the itemRender citations in your citation style (ISO 690 and its variants —
author-date, APA, MLA, Chicago, LNCS, IEEE-SA, JIS en/ja) via
relaton-render, which ships in the monogem’s ecosystem:
require "relaton/render"
r = Relaton::Render::General.new(language: "en", style: "author-date")
r.render(item, embedded: true)
# => "INTERNATIONAL ORGANIZATION FOR STANDARDIZATION (ISO). <em>Date and time …</em>"
Relaton::Render::General.new(language: "en", style: "mla")
.render(item, embedded: true) # => the MLA formShipped styles: author-date (ISO 690), apa, chicago, mla, lncs, ieee-sa,
jis-en, jis-ja. Whole-references rendering: r.render_all(bib, type:
"author-date").
Your existing Relaton::Iso::Bibliography, Relaton::Iec::*,
Relaton::Db, Relaton::Bib::* calls resolve exactly as before — the
flavors moved into the monogem under the same paths. Per-flavor VERSION
constants are gone; use Relaton::VERSION. Any relaton-* ~> 1.x/2.x
pin becomes relaton ~> 3.0 — the monogem is the only line receiving
updates. relaton-bib and relaton-cli remain separate, maintained
gems.
- :
-
= RelatonIetf
Formerly known as rfcbib.
RelatonIetf is a Ruby gem that searches and fetches standards from the Internet Engineering Task Force (IETF), including RFCs.
The standards scrape form https://www.rfc-editor.org/search/rfc_search.php
Installation
Add this line to your application’s Gemfile:
gem 'relaton-ietf'And then execute:
$ bundle
Or install it yourself as:
$ gem install relaton-ietf
Usage
Fetching documents
require 'relaton_ietf'
=> true
# Fetch RFC document
item = RelatonIetf::IetfBibliography.get 'IETF RFC 8341'
[relaton-ietf] (IETF RFC 8341) Fetching from Relaton repository ...
[relaton-ietf] (IETF RFC 8341) Found: `RFC 8341`
=> #<RelatonIetf::IetfBibliographicItem:0x007fd1875e7f58
...
# Fetch Internet-Draft document
RelatonIetf::IetfBibliography.get 'IETF I-D.draft-abarth-cake-01'
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Fetching from Relaton repository ...
[relaton-ietf] (IETF I-D.draft-abarth-cake-01) Found: `draft-abarth-cake-01`
=> #<RelatonIetf::IetfBibliographicItem:0x00007fdd129bbeb8
...
# Return nil if a document doesn't exist.
RelatonIetf::IetfBibliography.get 'IETF 1111'
[relaton-ietf] (IETF 1111) Fetching from Relaton repository ...
[relaton-ietf] (IETF 1111) Not found.
=> nilSerialization
item.to_xml
=> "<bibitem id="RFC8341" type="standard" schema-version="v1.2.1">
<fetched>2022-12-03</fetched>
<title type="main" format="text/plain">Network Configuration Access Control Model</title>
<uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
<docidentifier type="IETF" primary="true">RFC 8341</docidentifier>
....
</bibitem>"With bibdata: true option XML output is wrapped with bibdata element and ext element added.
item.to_xml bibdata: true
=> "<bibdata type="standard" schema-version="v1.2.1">
<fetched>2022-12-03</fetched>
<title type="main" format="text/plain">Network Configuration Access Control Model</title>
<uri type="src">https://www.rfc-editor.org/info/rfc8341</uri>
<docidentifier type="IETF" primary="true">RFC 8341</docidentifier>
<docidentifier type="DOI">10.17487/RFC8341</docidentifier>
...
<ext schema-version="v1.0.1">
<editorialgroup>
<committee>netconf</committee>
</editorialgroup>
</ext>
</bibdata>"Typed links
IETF documents may have src, xml, and doi link types.
-
src- web publication -
xml- BibXML publication -
doi- DOI reference
item.link
=> [#<RelatonBib::TypedUri:0x00007fe8b287a120 @content=#<Addressable::URI:0x7e4 URI:https://raw.githubusercontent.com/relaton/relaton-data-rfcs/main/data/reference.RFC.8341.xml>, @type="xml">,
#<RelatonBib::TypedUri:0x00007fe8b2237ec0 @content=#<Addressable::URI:0x7f8 URI:https://www.rfc-editor.org/info/rfc8341>, @type="src">]Parse a file locally
item = Relaton::Provider::Ietf.from_rfcxml File.read("spec/examples/rfc.xml")
=> #<RelatonIetf::IetfBibliographicItem:0x007fa8cda79ab8
...Create bibliographic item from YAML
hash = YAML.load_file 'spec/examples/ietf_bib_item.yml'
=> {"id"=>"RFC 8341",
...
RelatonIetf::IetfBibliographicItem.from_hash hash
=> #<RelatonIetf::IetfBibliographicItem:0x007f9a929dde40
...Fetch data
There are IETF datasets that can be converted into RelatonXML/BibXML/BibYAML formats:
-
ietf-rfcsubseries- https://www.rfc-editor.org/rfc-index.xml (<bcp-entry>,<fyi-entry>,<std-entry>) -
ietf-internet-drafts- convert files from local directory./bibxml-ids. Usersync -avcizxL rsync.ietf.org::bibxml-ids ./bibxml-idscommand to fetch the files. -
ietf-rfc-entries- https://www.rfc-editor.org/rfc-index.xml (<rfc-entry>)
The method RelatonIetf::DataFetcher.fetch(source, output: "data", format: "yaml") converts all the documents from the dataset and saves them to the ./data folder in YAML format.
Arguments:
-
source- dataset name (ietf-rfcsubseriesorietf-internet-drafts) -
output- folder to save documents (default './data'). -
format- the format in which the documents are saved. Possible formats are:yaml,xml,bibxml(defaultyaml).
RelatonIetf::DataFetcher.fetch "ietf-internet-drafts"
Started at: 2021-12-17 10:23:20 +0100
Stopped at: 2021-12-17 10:29:19 +0100
Done in: 360 sec.
=> nilLogging
RelatonIetf 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.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-ietf.
License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).