= RelatonIsoBib image:https://img.shields.io/gem/v/relaton-iso-bib.svg["Gem Version", link="https://rubygems.org/gems/relaton-iso-bib"] image:https://img.shields.io/travis/metanorma/relaton-iso-bib/master.svg["Build Status", link="https://travis-ci.com/metanorma/relaton-iso-bib"] image:https://codeclimate.com/github/metanorma/relaton-iso-bib/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/relaton-iso-bib"] IsoBib is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model]. == Installation Add this line to your application's Gemfile: [source,ruby] ---- gem 'relaton-iso-bib' ---- And then execute: $ bundle Or install it yourself as: $ gem install relaton-iso-bib == Usage === Create ISO bibliographic item [source,ruby] ---- item = RelatonIsoBib::IsoBibliographicItem.new( fetched: "2018-10-21", structuredidentifier: RelatonIsoBib::StructuredIdentifier.new( type: "sid", project_number: "ISO 1-2:2014", part: 2, subpart: 2, ), docnumber: "123456", title: [ { title_intro: "Geographic information", title_main: "Metadata", title_part: "Part 1: Fundamentals", language: "en", script: "Latn" }, { title_intro: "Information géographique", title_main: "Métadonnées", title_part: "Information géographique", language: "fr", script: "Latn" }, ], edition: "1", version: RelatonBib::BibliographicItem::Version.new("2019-04-01", ["draft"]), language: %w[en fr], script: ["Latn"], type: "international-standard", docstatus: RelatonBib::DocumentStatus.new(stage: "60", substage: "60"), dates: [{ type: "published", on: "2014-04" }], abstract: [ { content: "ISO 19115-1:2014 defines the schema required for ...", language: "en", script: "Latn", format: "text/plain" }, { content: "L'ISO 19115-1:2014 définit le schéma requis pour ...", language: "fr", script: "Latn", format: "text/plain" }, ], contributor: [ { entity: { name: "International Organization for Standardization", url: "www.iso.org", abbreviation: "ISO" }, role: ["publisher"] }, { entity: RelatonBib::Person.new( name: RelatonBib::FullName.new( completename: RelatonBib::LocalizedString.new("John Smith"), ), ), role: ["author"], }, ], copyright: { owner: { name: "International Organization for Standardization", abbreviation: "ISO", url: "www.iso.org" }, from: "2014" }, link: [ { type: "src", content: "https://www.iso.org/standard/53798.html" }, { type: "obp", content: "https://www.iso.org/obp/ui/#!iso:std:53798:en" }, { type: "rss", content: "https://www.iso.org/contents/data/standard"\ "/05/37/53798.detail.rss" }, ], relation: [ RelatonBib::DocumentRelation.new( type: "updates", bibitem: RelatonIsoBib::IsoBibliographicItem.new( formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003"), docstatus: RelatonBib::DocumentStatus.new(stage: "60", substage: "60"), ), bib_locality: [ RelatonBib::BibItemLocality.new("updates", "Reference form"), ], ), RelatonBib::DocumentRelation.new( type: "updates", bibitem: RelatonIsoBib::IsoBibliographicItem.new( type: "international-standard", formattedref: RelatonBib::FormattedRef.new(content: "ISO 19115:2003/Cor 1:2006"), ), ), ], series: [ RelatonBib::Series.new( type: "main", title: RelatonIsoBib::TypedTitleString.new( type: "title-main", content: "ISO/IEC FDIS 10118-3", language: "en", script: "Latn", ), place: "Serie's place", organization: "Serie's organization", abbreviation: RelatonBib::LocalizedString.new("ABVR", "en", "Latn"), from: "2009-02-01", to: "2010-12-20", number: "serie1234", partnumber: "part5678", ), RelatonBib::Series.new( type: "alt", formattedref: RelatonBib::FormattedRef.new( content: "serieref", language: "en", script: "Latn", ), ) ], medium: RelatonBib::Medium.new( form: "medium form", size: "medium size", scale: "medium scale", ), place: ["bib place"], extent: [ RelatonBib::BibItemLocality.new( "section", "Reference from", "Reference to" ), ], accesslocation: ["accesslocation1", "accesslocation2"], classification: RelatonBib::Classification.new(type: "type", value: "value"), validity: RelatonBib::Validity.new( begins: Time.new(2010, 10, 10, 12, 21), ends: Time.new(2011, 2, 3, 18,30), revision: Time.new(2011, 3, 4, 9, 0), ), editorialgroup: { technical_committee: [{ name: " ISO/TC 211 Geographic information/Geomatics", type: "technicalCommittee", number: 211 }], subcommittee: [{ name: "International Organization for Standardization", type: "ISO", number: 122, }], workgroup: [RelatonIsoBib::IsoSubgroup.new( name: "Workgroup Organization", type: "WG", number: 111, )], }, ics: [{ field: 35, group: 240, subgroup: 70 }], ) => #, ... ---- === IsoBibliographicItem Localized Strings [source,ruby] ---- item.title => [#, @type="title-main">, #, @type="title-intro">, #, @type="title-part">, #, @type="main">, #, @type="title-main">, #, @type="title-intro">, #, @type="title-part">, #, @type="main">] item.title(lang: "en") => [#, @type="title-main">, #, @type="title-intro">, #, @type="title-part">, #, @type="main">] item.abstract(lang: "en").to_s => "ISO 19115-1:2014 defines the schema required for ..." ---- === IsoBibliographicItem references [source,ruby] ---- item.shortref(item.structuredidentifier) => "ISO1-2-2014:2014" ---- === IsoBibliographicItem URLs [source,ruby] ---- item.url => "https://www.iso.org/standard/53798.html" item.url(:obp) => "https://www.iso.org/obp/ui/#!iso:std:53798:en" item.url(:rss) => "https://www.iso.org/contents/data/standard/05/37/53798.detail.rss" ---- === IsoBibliographicItem ICS [source,ruby] ---- item.ics [], @subgroupcode="70">] ---- === IsoBibliographicItem BibliographicDates [source,ruby] ---- item.dates => [] item.dates.filter(type: "published").first.on => 2014-01-04 00:00:00 +0100 ---- === IsoBibliographicItem DocumentStatus [source,ruby] ---- item.status => # ---- [source,ruby] ---- wg = item.editorialgroup => #], @technical_committee=[#], @workgroup=[#]> ---- === Document relations of a standard [source,ruby] ---- item.relation => [#], @bibitem= # true item.title(lang: "en") => [#, @type="title-main">, #, @type="title-intro">, #, @type="main">] item.shortref(item.structuredidentifier) => "ISO1-2014(allparts):2014: All Parts" item.relation.last.bibitem.title => [#, @type="title-main">, #, @type="title-intro">, #, @type="title-part">, #, @type="main">, #, @type="title-main">, #, @type="title-intro">, #, @type="title-part">, #, @type="main">] ---- === Reference modification: convert to most recent reference In ISO, an undated reference is interpreted as a _de dicto_ reference to the most recent instance of the reference; if the document is read after a new version of the reference has been issued, the reference is taken to refer to that new instance, even if that instance had not been published at the time the bibliography was authored. All references on the ISO web site (as retrieved by the isobib gem) are dated. A dated reference is converted to a Most Recent referece by making the dated reference an instance relation to a new reference, which strips the date of publication of the original, and its abstract. The operation is destructive. [source,ruby] ---- item.dates => [#] item.to_most_recent_reference item.dates => [] item.shortref(item.structuredidentifier) => "ISO1(allparts): All Parts" ---- === XML serialization [source,ruby] ---- item.to_xml(bibdata: true) => " 2018-10-21 Metadata Geographic information Part 1: Fundamentals Metadata - Geographic information - Part 1: Fundamentals Métadonnées Information géographique Information géographique Métadonnées - Information géographique - Information géographique https://www.iso.org/standard/53798.html https://www.iso.org/obp/ui/#!iso:std:53798:en https://www.iso.org/contents/data/standard/05/37/53798.detail.rss 123456 2014 International Organization for Standardization ISO www.iso.org John Smith 1 2019-04-01 draft en fr ISO 19115-1:2014 defines the schema required for ... L'ISO 19115-1:2014 définit le schéma requis pour ... 60 60 2014 International Organization for Standardization ISO www.iso.org ISO 19115:2003 60 60 Reference form ISO 19115:2003/Cor 1:2006 ISO/IEC FDIS 10118-3 Serie's place Serie's organization ABVR 2009-02-01 2010-12-20 serie1234 part5678 serieref
medium form
medium size medium scale
bib place Reference from Reference to accesslocation1 accesslocation2 value 2010-10-10 12:21 2011-02-03 18:30 2011-03-04 09:00 international-standard ISO/TC 211 Geographic information/Geomatics International Organization for Standardization Workgroup Organization 35.240.70 IT applications in science ISO 1-2:2014
" item.to_xml(bibdata: true, note: [{ type: "note type", text: "test note" }]) => " 2018-10-21 Metadata ... test note ... ---- === Create bibliographic item form YAML [source,ruby] ---- hash = YAML.load_file 'spec/examples/iso_bib_item.yml' => {"id"=>"ISO/TC211", ... bib_hash = RelatonIsoBib::HashConverter.hash_to_bib hash => {:id=>"ISO/TC211", ... RelatonIsoBib::IsoBibliographicItem.new bib_hash => #