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 = Relaton::Xsf::Bibliography.search("XEP 0001")
=> <Relaton::Xsf::HitCollection:0x000000000013c0 @ref=XEP 0001 @fetched=false>
item = hit_collection[0].item
=> #<Relaton::Bib::ItemData:0x0000000124d510b8
...
XML serialization
item.to_xml
=> "<bibitem id="XEP0001" type="standard" schema-version="v1.4.1">
<fetched>2026-03-04</fetched>
<title language="en" script="Latn">XMPP Extension Protocols</title>
<uri type="src">http://xmpp.org/extensions/xep-0001.html</uri>
<uri type="HTML">http://xmpp.org/extensions/xep-0001.html</uri>
<docidentifier type="XEP" primary="true">XEP 0001</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.4.1">
<fetched>2026-03-04</fetched>
<title language="en" script="Latn">XMPP Extension Protocols</title>
<uri type="src">http://xmpp.org/extensions/xep-0001.html</uri>
<uri type="HTML">http://xmpp.org/extensions/xep-0001.html</uri>
<docidentifier type="XEP" primary="true">XEP 0001</docidentifier>
...
<ext>
<doctype>rfc</doctype>
<flavor>xsf</flavor>
</ext>
</bibdata>"
Get document by reference
item = Relaton::Xsf::Bibliography.get "XEP 0001"
[relaton-xsf] INFO: (XEP 0001) Fetching from Relaton repository ...
[relaton-xsf] INFO: (XEP 0001) Found: `XEP 0001`
=> #<Relaton::Bib::ItemData:0x0000000125036f58
...
item.docidentifier.first.content
=> "XEP 0001"
Typed source links
XSF publications have src type source link.
item.source[0].type
=> "src"
item.source[0].content
=> "http://xmpp.org/extensions/xep-0001.html"
Fetch data
This gem uses the https://xmpp.org/extensions/refs/ dataset as a data source.
The method Relaton::Xsf::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(defaultyaml).
require 'relaton/xsf/data_fetcher'
Relaton::Xsf::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
Relaton::Xsf 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 update the index test fixture (used by tests), run rake spec:update_index. This downloads the latest index-v1.zip from the relaton-data-xsf repository.
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.