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
Search for a standard using keywords
require 'relaton_etsi'
=> true
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>"
Typed links
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
(defaultyaml
).
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
Logging
RelatonEtsi 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 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).