Gem Version Build Status Appveyor Build Status Code Climate

RelatonIso is a Ruby gem that implements the IsoBibliographicItem model.

You can use it to retrieve metadata of ISO Standards from https://www.iso.org, and access such metadata through the IsoBibliographicItem object.

Installation

Add this line to your application’s Gemfile:

gem 'relaton-iso'

And then execute:

$ bundle

Or install it yourself as:

$ gem install relaton-iso

Usage

Search for a standard using keywords

hit_pages = RelatonIso::IsoBibliography.search("19115")
=> [[<RelatonIso::Hit:0x007f9a049df0d0 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO 19115-2:2019 Geographic information -- Metadata -- Part 2: Extensions for acquisition and processing">,
  <RelatonIso::Hit:0x007f9a049df0a8 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO 19115-1:2014 Geographic information -- Metadata -- Part 1: Fundamentals">,
  ...
  <RelatonIso::Hit:0x007f9a049deec8 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO/TS 19157-2:2016 Geographic information  -- Data quality -- Part 2: XML schema implementation">]]

hit_collection = hit_pages.first
=> [<RelatonIso::Hit:0x007f9a049df0d0 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO 19115-2:2019 Geographic information -- Metadata -- Part 2: Extensions for acquisition and processing">,
 <RelatonIso::Hit:0x007f9a049df0a8 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO 19115-1:2014 Geographic information -- Metadata -- Part 1: Fundamentals">,
 ...
  <RelatonIso::Hit:0x007f9a049deef0 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO/TS 19139-2:2012 Geographic information -- Metadata -- XML schema implementation -- Part 2: Extensions for imagery and gridded data">,
 <RelatonIso::Hit:0x007f9a049deec8 @text="19115" @fullIdentifier="" @matchedWords=["19115"] @category="standard" @title="ISO/TS 19157-2:2016 Geographic information  -- Data quality -- Part 2: XML schema implementation">]

item = hit_collection[1].fetch
=> #<RelatonIsoBib::IsoBibliographicItem:0x007f9a030a9d90
 @abstract=
  [#<RelatonBib::FormattedString:0x007f9a030a2518
    @content=
     "ISO 19115-1:2014 defines the schema required for describing geographic information and services by means of metadata. It provides information about the identification, the
     ...

XML serialization

Possible options:

  • bibdata - If true then wrapp item with bibdata element and add ext element.

  • note - Array of hashes { text: "Note", type: "note" }. These notes will be added to XML.

item.to_xml
=>"<bibitem id="ISO19115-1-2014">
  <title type="title-main" format="text/plain" language="en" script="Latn">Metadata</title>
  <title type="title-intro" format="text/plain" language="en" script="Latn">Geographic information</title>
  <title type="title-part" format="text/plain" language="en" script="Latn">Part 1: Fundamentals</title>
  <title type="main" format="text/plain" language="en" script="Latn">Metadata - Geographic information - Part 1: Fundamentals</title>
  <title type="title-main" format="text/plain" language="fr" script="Latn">Métadonnées</title>
  <title type="title-intro" format="text/plain" language="fr" script="Latn">Information géographique</title>
  <title type="title-part" format="text/plain" language="fr" script="Latn">Partie 1: Principes de base</title>
  <title type="main" format="text/plain" language="fr" script="Latn">Métadonnées - Information géographique - Partie 1: Principes de base</title>
  <uri type="src">https://www.iso.org/standard/53798.html</uri>
  <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:53798:en</uri>
  <uri type="rss">https://www.iso.org/contents/data/standard/05/37/53798.detail.rss</uri>
  <docidentifier type="ISO">ISO 19115-1:2014</docidentifier>
  <date type="published">
    <on>2014</on>
  </date>
  <contributor>
    <role type="publisher"/>
    <organization>
      <name>International Organization for Standardization</name>
      <abbreviation>ISO</abbreviation>
      <uri>www.iso.org</uri>
    </organization>
  </contributor>
  <edition>1</edition>
  <language>en</language>
  <language>fr</language>
  <script>Latn</script>
  <abstract format="text/plain" language="en" script="Latn">ISO 19115-1:2014 defines the schema required for describing geographic information and services by means of metadata. It provides information about the identification, the extent, the quality, the spatial and temporal aspects, the content, the spatial reference, the portrayal, distribution, and other properties of digital geographic data and services.ISO 19115-1:2014 is applicable to:-the cataloguing of all types of resources, clearinghouse activities, and the full description of datasets and services;-geographic services, geographic datasets, dataset series, and individual geographic features and feature properties.ISO 19115-1:2014 defines:-mandatory and conditional metadata sections, metadata entities, and metadata elements;-the minimum set of metadata required to serve most metadata applications (data discovery, determining data fitness for use, data access, data transfer, and use of digital data and services);-optional metadata elements to allow for a more extensive standard description of resources, if required;-a method for extending metadata to fit specialized needs.Though ISO 19115-1:2014 is applicable to digital data and services, its principles can be extended to many other types of resources such as maps, charts, and textual documents as well as non-geographic data. Certain conditional metadata elements might not apply to these other forms of data.</abstract>
  <abstract format="text/plain" language="fr" script="Latn">L'ISO 19115-1:2014 définit le schéma requis pour décrire des informations géographiques et des services au moyen de métadonnées. Elle fournit des informations concernant l'identification, l'étendue, la qualité, les aspects spatiaux et temporels, le contenu, la référence spatiale, la représentation des données, la distribution et d'autres propriétés des données géographiques numériques et des services.L'ISO 19115-1:2014 est applicable:-au catalogage de tous les types de ressources, des activités des centres d'informations et à la description complète des jeux de données et des services,-aux services géographiques, jeux de données géographiques, séries de jeux de données, entités géographiques individuelles et propriétés d'entités.L'ISO 19115-1:2014 définit:-des sections relatives aux métadonnées obligatoires et facultatives, aux entités de métadonnées et aux éléments de métadonnées,-le jeu minimal de métadonnées requis pour répondre au besoin de la plupart des applications des métadonnées (la découverte des données, la détermination de l'adéquation des données à une utilisation, l'accès aux données, le transfert des données et l'utilisation des données numériques et des services),-les éléments de métadonnées facultatifs pour permettre une description standard plus poussée des ressources, si cela est nécessaire,-un procédé d'extension des métadonnées pour s'adapter aux besoins spéciaux.L'ISO 19115-1:2014 est applicable aux données numériques et services, ses principes peuvent être étendus à bien d'autres types de ressources telles que les cartes, les graphes et les documents textes, de même qu'à des données non géographiques. Certains éléments de métadonnées conditionnels peuvent ne pas s'appliquer à ces autres formes de données.</abstract>
  <status>
    <stage>90</stage>
    <substage>20</substage>
  </status>
  <copyright>
    <from>2014</from>
    <owner>
      <organization>
        <name>ISO</name>
      </organization>
    </owner>
  </copyright>
  <relation type="obsoletes">
    <bibitem>
      <formattedref format="text/plain">ISO 19115:2003</formattedref>
    </bibitem>
  </relation>
  <relation type="obsoletes">
    <bibitem>
      <formattedref format="text/plain">ISO 19115:2003/Cor 1:2006</formattedref>
    </bibitem>
  </relation>
  <relation type="updates">
    <bibitem>
      <formattedref format="text/plain">ISO 19115-1:2014/Amd 1:2018</formattedref>
    </bibitem>
  </relation>
</bibitem>"

item.to_xml bibdata: true
=>"<bibdata>
  ...
  <ext>
    <doctype>international-standard</doctype>
    <editorialgroup>
      <technical_committee number="211" type="TC">ISO/TC 211Geographic information/Geomatics</technical_committee>
    </editorialgroup>
    <ics>
      <code>35.240.70</code>
      <text>IT applications in science</text>
    </ics>
    <structuredidentifier type="ISO">
      <project-number>ISO 19115</project-number>
    </structuredidentifier>
  </ext>
</bibdata>"

item.to_xml note: [{ text: "Note", type: "note" }]
=>"<bibitem id="ISO19115-1-2014">
  ...
  <note format="text/plain" type="note">Note</note>
  ...
</bibitem>"

Get serialisation in response to code, year, and options

RelatonIso::IsoBibliography.get('ISO 19115', "2014", {all_parts: true}).title
=> [#<RelatonIsoBib::TypedTitleString:0x007f9a05a1dcd0
  @title=#<RelatonBib::FormattedString:0x007f9a05a1d668 @content="Metadata", @format="text/plain", @language=["en"], @script=["Latn"]>,
  @type="title-main">,
 #<RelatonIsoBib::TypedTitleString:0x007f9a05a1d1b8
  @title=#<RelatonBib::FormattedString:0x007f9a05a1c970 @content="Geographic information", @format="text/plain", @language=["en"], @script=["Latn"]>,
  @type="title-intro">,
 #<RelatonIsoBib::TypedTitleString:0x007f9a030d38c0
  @title=
   #<RelatonBib::FormattedString:0x007f9a030d3320 @content="Metadata - Geographic information - Part 1: Fundamentals", @format="text/plain", @language=["en"], @script=["Latn"]>,
  @type="main">,
 #<RelatonIsoBib::TypedTitleString:0x007f9a030d26a0
  @title=#<RelatonBib::FormattedString:0x007f9a030d21f0 @content="Métadonnées", @format="text/plain", @language=["fr"], @script=["Latn"]>,
  @type="title-main">,
 #<RelatonIsoBib::TypedTitleString:0x007f9a030d1d68
  @title=#<RelatonBib::FormattedString:0x007f9a030d15e8 @content="Information géographique", @format="text/plain", @language=["fr"], @script=["Latn"]>,
  @type="title-intro">,
 #<RelatonIsoBib::TypedTitleString:0x007f9a030d0a80
  @title=
   #<RelatonBib::FormattedString:0x007f9a030d0530
    @content="Métadonnées - Information géographique - Partie 1: Principes de base",
    @format="text/plain",
    @language=["fr"],
    @script=["Latn"]>,
  @type="main">]

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).

Exceptional Citations

This gem retrieves bibliographic descriptions of ISO documents by doing searches on the ISO website, http://www.iso.org, and screenscraping the document that matches the queried document identifier. The following documents are not returned as search results from the ISO website, and the gem returns manually generated references to them.

  • IEV: used in the metanorma-iso gem to reference Electropedia entries generically. Is resolved to an "all parts" reference to IEC 60050, which in turn is resolved into the specific documents cited by their top-level clause.

Contributing

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

License

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