0.0
The project is in a healthy, maintained state
RelatonIso: retrieve ISO Standards for bibliographic use using the IsoBibliographicItem 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
 Project Readme

Relaton-XSF: bibliographic retrieval of XMPP XEP specifications

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

Purpose

relaton-xsf provides bibliographic information of XMPP XEP specifications using the BibliographicItem model.

Data sources

Relaton-XSF retrieves bibliographic information from XMPP dataset.

The XSF Library dataset provides documents listed in the index.

Installation

Add this line to your application’s Gemfile:

gem 'relaton-xsf'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton-xsf

Usage

Search for a standard using keywords

require 'relaton_xsf'
=> true

hit_collection = RelatonXsf::Bibliography.search("XEP 0001")
=> <RelatonXsf::HitCollection:0x00000000019780 @ref=XEP 0001 @fetched=false>

item = hit_collection[0].fetch
=> #<RelatonXsf::BibliographicItem:0x000000011167a518
 ...

XML serialization

item.to_xml
=> "<bibitem id="XEP0001" type="standard" schema-version="v1.2.9">
      <fetched>2023-07-18</fetched>
      <title format="text/plain" language="en" script="Latn">XMPP Extension Protocols</title>
      ...
    <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.9">
      <fetched>2023-07-18</fetched>
      <title format="text/plain" language="en" script="Latn">XMPP Extension Protocols</title>
      ...
      <ext>
        <doctype>rfc</doctype>
      </ext>
  </bibdata>"

Get document by reference

item = RelatonXsf::Bibliography.get "XEP 0001"
[relaton-xsf] (XEP 0001) Fetching from Relaton repository ...
[relaton-xsf] (XEP 0001) Found `XEP 0001`
=> #<RelatonXsf::BibliographicItem:0x000000011275cd18
...

item.docidentifier.first.id
=> "XEP 0001"

XSF publications have src type link.

item.link
=> [#<RelatonBib::TypedUri:0x0000000113ad5ca0
  @content=#<Addressable::URI:0xcc24 URI:http://xmpp.org/extensions/xep-0001.html>,
  @language=nil,
  @script=nil,
  @type="src">]

Fetch data

This gem uses the https://xmpp.org/extensions/refs/ dataset as a data source.

The method RelatonXsf::DataFetcher.fetch(output: "data", format: "yaml") fetches all the documents from the dataset and saves 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, bibxxml (default yaml).

RelatonXsf::DataFetcher.fetch
Started at: 2021-09-01 18:01:01 +0200
Stopped at: 2021-09-01 18:01:43 +0200
Done in: 42 sec.
=> nil

Logging

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

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/relaton-xsf.

License

The gem is available as open source under the terms of the 2-Clause BSD License.