0.0
The project is in a healthy, maintained state
RelatonEtsi: retrieve ETSI Standards for bibliographic using the BibliographicItem model
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.18.0
 Project Readme

RelatonEtsi

RelatonEtsi is a Ruby gem that implements the BibliographicItem model.

You can use it to retrieve metadata of ETSI Standards and access such metadata through the RelatonEtsi::BibliographicItem object.

Installation

Add this line to your application’s Gemfile:

gem 'relaton-etsi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton-etsi

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

require 'relaton_etsi'
=> true

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

Search for a standard using keywords

item = RelatonEtsi::Bibliography.get("ETSI GS ZSM 012 V1.1.1")
[relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Fetching from Relaton repository ...
[relaton-etsi] (ETSI GS ZSM 012 V1.1.1) Found: `ETSI GS ZSM 012 V1.1.1 (2022-12)`
=> #<RelatonEtsi::BibliographicItem:0x000000010686fa18
...

XML serialization

item.to_xml
=> "<bibitem id="ETSIGSZSM012V1.1.12022-12" schema-version="v1.2.7">
      <fetched>2023-12-05</fetched>
      <title format="text/plain" language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
      <uri type="src">http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010</uri>
      <uri type="pdf">http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf</uri>
      <docidentifier type="ETSI" primary="true">ETSI GS ZSM 012 V1.1.1 (2022-12)</docidentifier>
      ...
    </bibitem>"

With argument bibdata: true it outputs XML wrapped by bibdata element and adds flavour ext element.

item.to_xml bibdata: true
=> "<bibdata schema-version="v1.2.7">
      <fetched>2023-12-05</fetched>
      <title format="text/plain" language="en" script="Latn">Zero-touch network and Service Management (ZSM); Enablers for Artificial Intelligence-based Network and Service Automation</title>
      <uri type="src">http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010</uri>
      <uri type="pdf">http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf</uri>
      <docidentifier type="ETSI" primary="true">ETSI GS ZSM 012 V1.1.1 (2022-12)</docidentifier>
      ...
      <ext schema-version="v0.0.3">
        <doctype abbreviation="GS">Group Specification</doctype>
        <editorialgroup>
          <technical-committee>Zero-touch network and Service Management</technical-committee>
        </editorialgroup>
      </ext>
    </bibdata>"

All the ETSI documents have SRC and PDF links. The gem provides a way to access these links through the RelatonBib::TypedUri object.

item.link
=> [#<RelatonBib::TypedUri:0x00000001083da780
  @content=#<Addressable::URI:0xb40 URI:http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010>,
  @language=nil,
  @script=nil,
  @type="src">,
 #<RelatonBib::TypedUri:0x00000001083da690
  @content=#<Addressable::URI:0xb54 URI:http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf>,
  @language=nil,
  @script=nil,
  @type="pdf">]

item.link.size
=> 2

item.link[0].type
=> "src"

item.link[0].content.to_s
=> "http://webapp.etsi.org/workprogram/Report_WorkItem.asp?WKI_ID=62010"

item.link[1].type
=> "pdf"

item.link[1].content.to_s
=> "http://www.etsi.org/deliver/etsi_gs/ZSM/001_099/012/01.01.01_60/gs_ZSM012v010101p.pdf"

Create bibliographic item from XML

RelatonEtsi::XMLParser.from_xml File.read('spec/fixtures/bibdata.xml')
=> #<RelatonEtsi::BibliographicItem:0x000000010a7644d0
...

Create bibliographic item from YAML

hash = YAML.load_file 'spec/fixtures/item_hash.yaml'
=> {"schema-version"=>"v1.2.7",
 "id"=>"ETSIEN319532-4V1.3.02023-10",
...

RelatonEtsi::BibliographicItem.from_hash hash
=> #<RelatonEtsi::BibliographicItem:0x000000010a76cf90
...

Fetch data

This gem uses the https://www.etsi.org as a data source.

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

RelatonEtsi::DataFetcher.fetch
Started at: 2023-12-05 22:44:32 -0500
Stopped at: 2023-12-05 22:47:55 -0500
Done in: 204 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](https://rubygems.org).

Contributing

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

License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).