relaton-omg 1.10.0 → 1.11.1

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: 05ffe60d5d13aabbeaf36188da133a0bc1ef235aa47d79935cd787783cdcf3e5
4
- data.tar.gz: 314cb574d9366c2e224d4701d6a84b601c8c07222c6fd8eb68b1050dc451daf7
3
+ metadata.gz: fefb5094555823591ad1e2193663adf0fe54bf836cd84e5888264a6c177ece91
4
+ data.tar.gz: 3303ea852975eebcf39cd70ed5893018c47ad359e0191ecbc90bcfcbdef73f16
5
5
  SHA512:
6
- metadata.gz: 5b333cb4e949774c26b29e39bbcfd78c1999f20113037180e5d57b70b1d6fc196a4ac40d84428246eae429e221551ebcaf6fd88a4bcd0ffa42941e4517387912
7
- data.tar.gz: 220a8897c4d5720ee9324eb4bc1dd7f22d100f6d3d9236cd573e6086bce8fe1a36bad5c47fdf0a2dbf563045b595cb23301a91c2c0dee04735dac78dd4a78214
6
+ metadata.gz: 4ac918dba0c0fb4d20a3c6f58b66d7435b830c91022761911688ae8bbc474446cda4f04b67ffc2a864df415dccc6eef02a56e69495d37ce00686a6075e73188f
7
+ data.tar.gz: a512281190f1fa8fafa0a937de563a689c9117427b0e7a3e238924d3250945d98fe0a9cb52ed15b746eb931a79c675a8745de0e9c0a217ae267b6824db78bad2
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">
@@ -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
@@ -2,17 +2,17 @@ require "nokogiri"
2
2
 
3
3
  module RelatonOmg
4
4
  module Scrapper
5
- URL_PATTERN = "https://www.omg.org/spec/"
5
+ URL_PATTERN = "https://www.omg.org/spec/".freeze
6
6
 
7
7
  class << self
8
- def scrape_page(ref)
8
+ def scrape_page(ref) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
9
9
  %r{OMG (?<acronym>[^\s]+)\s?(?<version>.*)} =~ ref
10
10
  return unless acronym
11
11
 
12
12
  url = URL_PATTERN + acronym
13
- url += "/" + version if version
14
- doc = Nokogiri::HTML OpenURI.open_uri(URI(url))
15
- OmgBibliographicItem.new **item(doc, acronym)
13
+ url += "/#{version}" if version
14
+ doc = Nokogiri::HTML OpenURI.open_uri(url, open_timeout: 10)
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 }
@@ -116,7 +116,7 @@ module RelatonOmg
116
116
 
117
117
  def fetch_license(doc)
118
118
  doc.xpath(
119
- '//dt/span/a[contains(., "IPR Mode")]/../../following-sibling::dd/span'
119
+ '//dt/span/a[contains(., "IPR Mode")]/../../following-sibling::dd/span',
120
120
  ).map { |l| l.text.match(/[\w\s-]+/).to_s.strip }
121
121
  end
122
122
  end
@@ -1,3 +1,3 @@
1
1
  module RelatonOmg
2
- VERSION = "1.10.0".freeze
2
+ VERSION = "1.11.1".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.10.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.10.0
4
+ version: 1.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-30 00:00:00.000000000 Z
11
+ date: 2022-04-14 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.10.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.10.0
124
+ version: 1.11.0
125
125
  description: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
126
126
  model'
127
127
  email: