= RelatonCcsds
RelatonCcsds is a Ruby gem that implements the https://github.com/relaton/relaton-models#bibliographic-item[BibliographicItem model].
You can use it to retrieve metadata of CCSDS Standards from https://public.ccsds.org/Publications/AllPubs.aspx, and access such metadata through the RelatonCcsds::BibliographicItem
object.
== Installation
Add this line to your application's Gemfile:
And then execute:
$ bundle
Or install it yourself as:
$ gem install relaton-ccsds
== Usage
=== Search for a standard using keywords
require 'relaton_ccsds' => true
hits = RelatonCcsds::Bibliography.search("CCSDS 230.2-G-1") => <RelatonCcsds::HitCollection:0x00000000001770 @ref=CCSDS 230.2-G-1 @fetched=false>
=== XML serialization
item.to_xml
=> "
<title format="text/plain" language="en" script="Latn">Next Generation Uplink</title>
<uri type="pdf">https://public.ccsds.org/Pubs/230x2g1.pdf</uri>
<docidentifier type="CCSDS" primary="true">CCSDS 230.2-G-1</docidentifier>
...
</bibitem>"
bibdata: true
it outputs XML wrapped by bibdata
element and adds flavour ext
element.
[source,ruby]item.to_xml bibdata: true
=> "
<title format="text/plain" language="en" script="Latn">Next Generation Uplink</title>
<uri type="pdf">https://public.ccsds.org/Pubs/230x2g1.pdf</uri>
...
<ext>
<doctype>report</doctype>
<editorialgroup>
<technical-committee>SLS-NGU</technical-committee>
</editorialgroup>
<technology-area>Space Link Services Area</technology-area>
</ext>
</bibdata>"
=== Typed links
All the CCSDS documents have PDF links. Some of them have additional DOC links. The gem provides a way to access these links through the RelatonBib::TypedUri
object.
item.link => [#<RelatonBib::TypedUri:0x000000011420d950 @content=#<Addressable::URI:0xc1c URI:https://public.ccsds.org/Pubs/230x2g1.pdf>, @language=nil, @script=nil, @type="pdf">]
RelatonCcsds::Bibliography.get("CCSDS 720.6-Y-1").link
[relaton-ccsds] (CCSDS 720.6-Y-1) Fetching from Relaton repository ...
[relaton-ccsds] (CCSDS 720.6-Y-1) Found: CCSDS 720.6-Y-1
.
=> [#<RelatonBib::TypedUri:0x0000000114183bb0
@content=#<Addressable::URI:0xca8 URI:https://public.ccsds.org/Pubs/720x6y1.pdf>,
@language=nil,
@script=nil,
@type="pdf">,
CCSDS 230.2-G-1
.
=> #<RelatonCcsds::BibliographicItem:0x00000001135dade0
...=== Get specific format
item = RelatonCcsds::Bibliography.get("CCSDS 720.4-Y-1 (DOC)")
[relaton-ccsds] (CCSDS 720.4-Y-1 (DOC)) Fetching from Relaton repository ...
[relaton-ccsds] (CCSDS 720.4-Y-1 (DOC)) Found: CCSDS 720.4-Y-1
.
=> #<RelatonCcsds::BibliographicItem:0x000000011100dfe0
...
item.link.size => 1
item.link[0].type => "doc"
pry(main)> item.link[0].content.to_s => "https://public.ccsds.org/Pubs/720x4y1.doc"
item = RelatonCcsds::Bibliography.get("CCSDS 720.4-Y-1 (PDF)")
[relaton-ccsds] (CCSDS 720.4-Y-1 (PDF)) Fetching from Relaton repository ...
[relaton-ccsds] (CCSDS 720.4-Y-1 (PDF)) Found: CCSDS 720.4-Y-1
.
=> #<RelatonCcsds::BibliographicItem:0x0000000111004620
...
item.link.size => 1
item.link[0].type => "pdf"
hash = YAML.load_file 'spec/fixtures/ccsds_230_2-g-1.yaml' => {"schema-version"=>"v1.2.4", "id"=>"CCSDS230.2-G-1", ...
=== Fetch data
This gem uses the https://public.ccsds.org/Publications/AllPubs.aspx as a data source.
The method RelatonCcsds::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
).=== Logging
RelatonCcsds uses the relaton-logger gem for logging. By default, it logs to STDOUT. To change the log levels and add other loggers, read the https://github.com/relaton/relaton-logger#usage[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.
== Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-ccsds.
== License
The gem is available as open source under the terms of the MIT License.