RelatonCie is a Ruby gem that searches and fetches standards from the International Commision on Illuminantion.
Installation
Add this line to your application’s Gemfile:
gem 'relaton-cie'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install relaton-cie
Usage
Search document
require 'relaton/cie'
=> true
item = Relaton::Cie::Bibliography.get 'CIE 001-1980'
[relaton-cie] INFO: (CIE 001-1980) Fetching from Relaton repository ...
[relaton-cie] INFO: (CIE 001-1980) Found: `CIE 001-1980`
=> #<Relaton::Bib::ItemData:0x0000000123b05300
...
# Return nil if a document doesn't exist.
Relaton::Cie::Bibliography.get '1111'
[relaton-cie] INFO: (1111) Fetching from Relaton repository ...
[relaton-cie] INFO: (1111) Not found.
=> nil
Serialization
item.to_xml
=> "<bibitem id="CIE0011980" type="standard" schema-version="v1.5.6">
<fetched>2025-12-23</fetched>
<title type="title-main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
<title type="main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
<uri type="src">https://store.accuristech.com/standards/cie-001-1980?product_id=1210107</uri>
...
</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.5.6">
<fetched>2025-12-23</fetched>
<title type="title-main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
<title type="main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
<uri type="src">https://store.accuristech.com/standards/cie-001-1980?product_id=1210107</uri>
...
<ext schema-version="v1.0.0">
<doctype>document</doctype>
<flavor>cie</flavor>
</ext>
</bibdata>
=== Typed links
Each CIE document has src type source link.
item.source
=> [#<Relaton::Bib::Uri:0x0000000123cc2990
@content="https://store.accuristech.com/standards/cie-001-1980?product_id=1210107",
@language=nil,
@locale=nil,
@script=nil,
@type="src">]
Parse a file locally
item = Relaton::Cie::Item.from_xml File.read("spec/fixtures/bibdata.xml")
=> #<Relaton::Cie::ItemData:0x000000010d00d0d0
...
Fetch data
This gem uses the https://www.techstreet.com/cie/searches/31156444 dataset as one of the data sources.
The method Relaton::Cie::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,bibxml(defaultyaml).
require "relaton/cie/data_fetcher"
=> true
Relaton::Cie::DataFetcher.fetch
Started at: 2021-09-08 16:37:53 +0200
Stopped at: 2021-09-08 16:49:17 +0200
Done in: 684 sec.
=> nil
Logging
RelatonCie 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-cie 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](https://rubygems.org).
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-cie.
License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).