RelatonCen is a Ruby gem that implements the IsoBibliographicItem model.
Installation
Add this line to your application’s Gemfile:
gem 'relaton-cen'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install relaton-cen
Usage
For CENELEC standards, use references with the prefix CEN/CLC. For example, CEN/CLC Guide 6.
Search for a standard using keywords
require 'relaton/cen'
=> true
hit_collection = Relaton::Cen::Bibliography.search("CEN ISO/TS 21003-7")
=> <Relaton::Cen::HitCollection:0x00000000002560 @ref=CEN ISO/TS 21003-7 @fetched=false>
item = hit_collection[0].item
=> #<Relaton::Cen::ItemData:0x000000012a35c458
...
Get a standard by its code
Use Relaton::Cen::Bibliography.get(ref, year, options) to get a standard by its code.
-
refis the standard code, e.g.CEN ISO/TS 21003-7 -
yearis the year of the standard, e.g.2019(optional) -
optionsis a hash of options: -
keep_year- keep the year in ID if true (optional)
# With year in reference
Relaton::Cen::Bibliography.get "EN 10160:1999"
[relaton-cen] INFO: (EN 10160:1999) Fetching from standards.cencenelec.eu ...
[relaton-cen] INFO: (EN 10160:1999) Found: `EN 10160:1999`
=> #<Relaton::Cen::ItemData:0x00000001273d5b58
...
# With a year as a separate argument
Relaton::Cen::Bibliography.get "EN 10160", "1999"
[relaton-cen] INFO: (EN 10160:1999) Fetching from standards.cencenelec.eu ...
[relaton-cen] INFO: (EN 10160:1999) Found: `EN 10160:1999`
=> #<Relaton::Cen::ItemData:0x00000001274d58c8
...
# To get the most recent version of a standard by its code use reference without year
Relaton::Cen::Bibliography.get "CEN/CLC Guide 6"
[relaton-cen] INFO: (CEN/CLC Guide 6) Fetching from standards.cencenelec.eu ...
[relaton-cen] INFO: (CEN/CLC Guide 6) Found: `CEN/CLC Guide 6:2014`
=> #<Relaton::Cen::ItemData:0x000000012759a010
...
# To keep the year in ID use `keep_year` option
> RelatonCen::CenBibliography.get "CEN/CLC Guide 6", nil, keep_year: true
[relaton-cen] INFO: (CEN/CLC Guide 6) Fetching from standards.cencenelec.eu ...
[relaton-cen] INFO: (CEN/CLC Guide 6) Found: `CEN/CLC Guide 6`
=> #<Relaton::Cen::ItemData:0x000000012c629760
...
XML serialization
item.to_xml
=> "<bibitem id="CENISOTS2100372019" type="standard" schema-version="v1.5.6">
<fetched>2025-12-15</fetched>
<title language="en" script="Latn" type="title-main">Multilayer piping systems for hot and cold water installations inside buildings</title>
...
</bibitem>"
With bibdata: true option XML output wrapped with bibdata element and ext
element added.
item.to_xml bibdata: true
=> "<bibdata type="standard" schema-version="v1.5.6">
<fetched>2025-12-15</fetched>
<title language="en" script="Latn" type="title-main">Multilayer piping systems for hot and cold water installations inside buildings</title>
...
<ext schema-version="v1.0.1">
<doctype>international-standard</doctype>
<flavor>cen</flavor>
<ics>
<code>23.040.20</code>
<text>Plastics pipes</text>
</ics>
<ics>
<code>91.140.60</code>
<text>Water supply systems</text>
</ics>
<structuredidentifier>
<agency>CEN</agency>
<docnumber>21003</docnumber>
<partnumber>7</partnumber>
</structuredidentifier>
</ext>
</bibdata>"
Typed links
Each CEN document has src type source.
item.source
=> [#<Relaton::Bib::Uri:0x0000000126a80878
@content="https://standards.cencenelec.eu/ords/f?p=CEN:110:::::FSP_PROJECT,FSP_ORG_ID:68120,6137&cs=1AD0C0DDDE4500D5B9BFB0BCE76BB63F9",
@language=nil,
@locale=nil,
@script=nil,
@type="src">]
Create bibliographic item form YAML
Relaton::Cen::Item.from_yaml File.read('spec/fixtures/item.yaml')
=> #<Relaton::Cen::ItemData:0x00000001292f71d0
...
Create bibliographic item from XML
Relaton::Cen::Item.from_xml File.read("spec/fixtures/bibdata.xml")
=> #<Relaton::Cen::ItemData:0x0000000129353fc0
...
Logging
RelatonCen 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 the created tag, 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-cen.
License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).