Gem Version Build Status (macOS) Build Status (Windows) Build Status (Ubuntu) Code Climate Pull Requests Commits since latest

Relaton::Ogc is a Ruby gem that implements the IsoBibliographicItem model.

You can use it to retrieve metadata of OGC Standards from the relaton-data-ogc dataset, and access such metadata through the Relaton::Ogc::ItemData object.

Installation

Add this line to your application’s Gemfile:

gem 'relaton-ogc'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton-ogc

Usage

Search for a standard using keywords

require 'relaton/ogc'
=> true

hits = Relaton::Ogc::Bibliography.search("OGC 19-025r1")
=> <Relaton::Ogc::HitCollection:0x00000000001230 @ref=19-025r1 @fetched=false>

item = hits[0].item
=> #<Relaton::Ogc::ItemData:0x0000000127b1d870
...

XML serialization

item.to_xml
=> "<bibitem id="19025r1" type="standard" schema-version="v1.4.1">
      <fetched>2026-02-27</fetched>
      <title language="en" script="Latn" type="title-main">Development of Spatial Data Infrastructures for Marine Data Management</title>
      <title language="en" script="Latn" type="main">Development of Spatial Data Infrastructures for Marine Data Management</title>
      <uri type="src">http://www.opengis.net/doc/per/marine-sdi</uri>
      <uri type="pdf">https://portal.ogc.org/files/?artifact_id=88037</uri>
      <docidentifier type="OGC" primary="true">19-025r1</docidentifier>
      ...
    </bibitem>"

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

item.to_xml bibdata: true
=> "<bibdata type="standard" schema-version="v1.4.1">
      <fetched>2026-02-27</fetched>
      <title language="en" script="Latn" type="title-main">Development of Spatial Data Infrastructures for Marine Data Management</title>
      <title language="en" script="Latn" type="main">Development of Spatial Data Infrastructures for Marine Data Management</title>
      <uri type="src">http://www.opengis.net/doc/per/marine-sdi</uri>
      <uri type="pdf">https://portal.ogc.org/files/?artifact_id=88037</uri>
      <docidentifier type="OGC" primary="true">19-025r1</docidentifier>
      ...
      <ext schema-version="v1.0.1">
        <doctype>engineering-report</doctype>
        <flavor>ogc</flavor>
      </ext>
    </bibdata>"

Get code, and year

Relaton::Ogc::Bibliography.get "OGC 19-025r1", "2019"
[relaton-ogc] INFO: (OGC 19-025r1) Fetching from Relaton repository ...
[relaton-ogc] INFO: (OGC 19-025r1) Found: `19-025r1`
=> #<Relaton::Ogc::ItemData:0x00000001283d6f48
...

Create bibliographic item from XML

Relaton::Ogc::Item.from_xml File.read('spec/fixtures/12_128r14.xml')
=> #<Relaton::Ogc::ItemData:0x000000012835e610
...

Each OGC document has scr type source link.

item.source[0].type
=> "obp"

item.source[0].content
=> "http://www.opengis.net/doc/per/marine-sdi"

Create bibliographic item from YAML

Relaton::Ogc::Item.from_yaml File.read('spec/fixtures/item.yaml')
=> #<Relaton::Ogc::ItemData:0x0000000124b19d90
...

Fetch data

This gem uses the OGC NamingAuthority dataset as a data source.

The method Relaton::Ogc::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 (default yaml).

require "relaton/ogc/data_fetcher"

Relaton::Ogc::DataFetcher.fetch
Started at: 2026-02-27 11:21:46 +0200
Stopped at: 2026-02-27 11:21:48 +0200
=> nil

Logging

Relaton::Ogc 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 bundle exec rspec 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-ogc 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-ogc.

License

The gem is available as open source under the terms of the MIT License.