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 +4 -4
- data/grammars/biblio.rng +29 -4
- data/lib/relaton_omg/omg_bibliographic_item.rb +1 -1
- data/lib/relaton_omg/scrapper.rb +11 -11
- data/lib/relaton_omg/version.rb +1 -1
- data/lib/relaton_omg/xml_parser.rb +1 -1
- data/relaton_omg.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fefb5094555823591ad1e2193663adf0fe54bf836cd84e5888264a6c177ece91
|
4
|
+
data.tar.gz: 3303ea852975eebcf39cd70ed5893018c47ad359e0191ecbc90bcfcbdef73f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
<
|
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">
|
data/lib/relaton_omg/scrapper.rb
CHANGED
@@ -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 += "
|
14
|
-
doc = Nokogiri::HTML OpenURI.open_uri(
|
15
|
-
OmgBibliographicItem.new
|
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(
|
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
|
data/lib/relaton_omg/version.rb
CHANGED
data/relaton_omg.gemspec
CHANGED
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.
|
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-
|
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.
|
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.
|
124
|
+
version: 1.11.0
|
125
125
|
description: 'RelatonOmg: retrieve OMG Standards for bibliographic using the IsoBibliographicItem
|
126
126
|
model'
|
127
127
|
email:
|