relaton-omg 1.9.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b95f791d4851dab63d7b6fc07b66e77103829244efb6446ff13c1a2352f9ed47
4
- data.tar.gz: 85f1f3203efe994bab78befe1b17abafaf32987d5d26cf200d3ed232e4c2c8d3
3
+ metadata.gz: 5bdab8ba35f329c71ab5d5727467507fbc7f3f39d2ae590049fe011de62afd07
4
+ data.tar.gz: ad7cc4e71c4658dfdcd895829a1326d92931b9a22ab84a79f7efce0603a96594
5
5
  SHA512:
6
- metadata.gz: c12d783cd2b8811b4070984c648e91ffbf91db58ea0a349c3aa0567670a9d1adfb3ab9ec2f1284c61db7f87abc20369be1492138b952d2ce643034bfaaacf45c
7
- data.tar.gz: 1fbf5161688d72b4ef47cfd4ba96d691ae98f2705fd85f086842de011bd81228eca558ade9e6cfb32be1684573de85670ea67a3a08a5d0548c3c852734fe0317
6
+ metadata.gz: 85840d46dc0218f3bb865ad897998b1b16448ea28243138ee3bdeeed3d1fcc923512a3d1cce2788683135f72dddab8d625eeee79ffdf9118f2b2c3f60749f03e
7
+ data.tar.gz: c652e13e1597a3b09790fc7c662228561593329136d5abbb2dc175feb128650454ecd84b615c28e9f04d7d9dd4ab864ad1b0f5b31cd02b713c00f58d43435a07
data/.rubocop.yml CHANGED
@@ -2,6 +2,8 @@
2
2
  # https://github.com/riboseinc/oss-guides
3
3
  # All project-specific additions and overrides should be specified in this file.
4
4
 
5
+ require: rubocop-rails
6
+
5
7
  inherit_from:
6
8
  - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
7
9
  AllCops:
data/README.adoc CHANGED
@@ -43,12 +43,12 @@ Reference format is `OMG + {ACRONYM} + {VERSION}`
43
43
  require 'relaton_omg'
44
44
  => true
45
45
 
46
- item = RelatonOmg::OmgBibliography.search 'OMG AMI4CCM 1.0'
46
+ item = RelatonOmg::OmgBibliography.get 'OMG AMI4CCM 1.0'
47
47
  => #<RelatonOmg::OmgBibliographicItem:0x007fda17eab2f0
48
48
  ...
49
49
 
50
50
  # Return nil if document doesn't exist.
51
- RelatonOmg::OmgBibliography.search 'OMG 1111'
51
+ RelatonOmg::OmgBibliography.get 'OMG 1111'
52
52
  [relaton-omg] no document found for "OMG 1111" reference.
53
53
  => nil
54
54
  ----
@@ -81,7 +81,18 @@ item.to_xml
81
81
  </bibitem>"
82
82
  ----
83
83
 
84
- === Create bibliographic item form XML
84
+ === Typed links
85
+
86
+ OMG documents may have `src` and `pdf` link types.
87
+
88
+ [source,ruby]
89
+ ----
90
+ item.link
91
+ => [#<RelatonBib::TypedUri:0x00007fa897a72208 @content=#<Addressable::URI:0x80c URI:https://www.omg.org/spec/AMI4CCM/1.0/About-AMI4CCM/>, @type="src">,
92
+ #<RelatonBib::TypedUri:0x00007fa897a71600 @content=#<Addressable::URI:0x820 URI:https://www.omg.org/spec/AMI4CCM/1.0/PDF>, @type="pdf">]
93
+ ----
94
+
95
+ === Create bibliographic item from XML
85
96
 
86
97
  [source,ruby]
87
98
  ----
@@ -90,7 +101,7 @@ item = RelatonOmg::OmgBibliographicItem.from_xml 'spec/fixtures/omg_ami4ccm_1_0.
90
101
  ...
91
102
  ----
92
103
 
93
- === Create bibliographic item form Hash
104
+ === Create bibliographic item from Hash
94
105
  [source,ruby]
95
106
  ----
96
107
  hash = YAML.load_file 'spec/fixtures/omg_ami4ccm_1_0.yaml'
@@ -102,7 +113,7 @@ item = RelatonOmg::OmgBibliographicItem.from_hash hash
102
113
  ...
103
114
  ----
104
115
 
105
- === Create bibliographic item form YAML
116
+ === Create bibliographic item from YAML
106
117
  [source,ruby]
107
118
  ----
108
119
  item = RelatonOmg::OmgBibliographicItem.from_yaml 'spec/fixtures/omg_ami4ccm_1_0.yaml'
data/grammars/biblio.rng CHANGED
@@ -209,9 +209,6 @@
209
209
  <zeroOrMore>
210
210
  <ref name="contact"/>
211
211
  </zeroOrMore>
212
- <zeroOrMore>
213
- <ref name="uri"/>
214
- </zeroOrMore>
215
212
  </element>
216
213
  </define>
217
214
  <define name="fullname">
@@ -401,9 +398,9 @@
401
398
  <choice>
402
399
  <!-- iso191606 TODO -->
403
400
  <group>
404
- <oneOrMore>
401
+ <zeroOrMore>
405
402
  <ref name="street"/>
406
- </oneOrMore>
403
+ </zeroOrMore>
407
404
  <ref name="city"/>
408
405
  <optional>
409
406
  <ref name="state"/>
@@ -680,6 +677,9 @@
680
677
  <zeroOrMore>
681
678
  <ref name="extent"/>
682
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
683
683
  <zeroOrMore>
684
684
  <ref name="accesslocation"/>
685
685
  </zeroOrMore>
@@ -828,6 +828,11 @@
828
828
  <optional>
829
829
  <attribute name="scope"/>
830
830
  </optional>
831
+ <optional>
832
+ <attribute name="primary">
833
+ <data type="boolean"/>
834
+ </attribute>
835
+ </optional>
831
836
  <text/>
832
837
  </element>
833
838
  </define>
@@ -920,9 +925,29 @@
920
925
  <text/>
921
926
  </element>
922
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
923
941
  <define name="extent">
924
942
  <element name="extent">
925
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
926
951
  </element>
927
952
  </define>
928
953
  <define name="series">
@@ -12,7 +12,7 @@ module RelatonOmg
12
12
  # @return [RelatonOmg::OmgBibliographicItem]
13
13
  def from_hash(hash)
14
14
  bib_hash = RelatonOmg::HashConverter.hash_to_bib(hash)
15
- new **bib_hash
15
+ new(**bib_hash)
16
16
  end
17
17
 
18
18
  # @param file [String] path to XML file
@@ -12,7 +12,7 @@ module RelatonOmg
12
12
  url = URL_PATTERN + acronym
13
13
  url += "/" + version if version
14
14
  doc = Nokogiri::HTML OpenURI.open_uri(URI(url))
15
- OmgBibliographicItem.new **item(doc, acronym)
15
+ OmgBibliographicItem.new(**item(doc, acronym))
16
16
  rescue OpenURI::HTTPError, URI::InvalidURIError => e
17
17
  if e.is_a?(URI::InvalidURIError) || e.io.status[0] == "404"
18
18
  warn %{[relaton-omg] no document found for "#{ref}" reference.}
@@ -24,7 +24,7 @@ module RelatonOmg
24
24
 
25
25
  private
26
26
 
27
- def item(doc, acronym)
27
+ def item(doc, acronym) # rubocop:disable Metrics/MethodLength
28
28
  {
29
29
  id: fetch_id(doc, acronym),
30
30
  fetched: Date.today.to_s,
@@ -37,7 +37,7 @@ module RelatonOmg
37
37
  link: fetch_link(doc),
38
38
  relation: fetch_relation(doc),
39
39
  keyword: fetch_keyword(doc),
40
- license: fetch_license(doc)
40
+ license: fetch_license(doc),
41
41
  }
42
42
  end
43
43
 
@@ -56,7 +56,7 @@ module RelatonOmg
56
56
  if (ver = version(doc))
57
57
  id << ver
58
58
  end
59
- [RelatonBib::DocumentIdentifier.new(id: id.join(" "), type: "OMG")]
59
+ [RelatonBib::DocumentIdentifier.new(id: id.join(" "), type: "OMG", primary: true)]
60
60
  end
61
61
 
62
62
  def fetch_abstract(doc)
@@ -95,13 +95,13 @@ module RelatonOmg
95
95
  links
96
96
  end
97
97
 
98
- def fetch_relation(doc)
98
+ def fetch_relation(doc) # rubocop:disable Metrics/MethodLength
99
99
  current_version = version(doc)
100
100
  v = doc.xpath('//h2[.="History"]/following-sibling::section/div/table/tbody/tr')
101
101
  v.reduce([]) do |mem, row|
102
102
  ver = row.at("td").text
103
103
  unless ver == current_version
104
- acronym = row.at('td[3]/a')[:href].split("/")[4]
104
+ acronym = row.at("td[3]/a")[:href].split("/")[4]
105
105
  fref = RelatonBib::FormattedRef.new content: "OMG #{acronym} #{ver}"
106
106
  bibitem = OmgBibliographicItem.new formattedref: fref
107
107
  mem << { type: "obsoletes", bibitem: bibitem }
@@ -1,3 +1,3 @@
1
1
  module RelatonOmg
2
- VERSION = "1.9.0".freeze
2
+ VERSION = "1.11.0".freeze
3
3
  end
@@ -17,7 +17,7 @@ module RelatonOmg
17
17
  # @param item_hash [Hash]
18
18
  # @return [RelatonOmg::OmgBibliographicItem]
19
19
  def bib_item(item_hash)
20
- OmgBibliographicItem.new **item_hash
20
+ OmgBibliographicItem.new(**item_hash)
21
21
  end
22
22
  end
23
23
  end
data/relaton_omg.gemspec CHANGED
@@ -34,5 +34,5 @@ Gem::Specification.new do |spec|
34
34
  spec.add_development_dependency "vcr"
35
35
  spec.add_development_dependency "webmock"
36
36
 
37
- spec.add_dependency "relaton-bib", "~> 1.9.0"
37
+ spec.add_dependency "relaton-bib", "~> 1.11.0"
38
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-omg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.0
4
+ version: 1.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-26 00:00:00.000000000 Z
11
+ date: 2022-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.9.0
117
+ version: 1.11.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.9.0
124
+ version: 1.11.0
125
125
  description: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
126
126
  model'
127
127
  email: