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.8.0
~> 1.18.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

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

require 'relaton_xsf'
=> true

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

Search for a standard using keywords

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

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.