relaton-ogc 1.7.2 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +1 -11
- data/.rubocop.yml +1 -1
- data/bin/rspec +29 -0
- data/grammars/basicdoc.rng +165 -20
- data/grammars/biblio.rng +5 -6
- data/grammars/isodoc.rng +532 -16
- data/grammars/ogc.rng +33 -13
- data/grammars/reqt.rng +31 -2
- data/lib/relaton_ogc/editorial_group.rb +1 -1
- data/lib/relaton_ogc/hash_converter.rb +1 -1
- data/lib/relaton_ogc/ogc_bibliographic_item.rb +17 -21
- data/lib/relaton_ogc/scrapper.rb +2 -2
- data/lib/relaton_ogc/version.rb +1 -1
- data/lib/relaton_ogc/xml_parser.rb +9 -9
- data/relaton_ogc.gemspec +4 -5
- metadata +11 -10
data/grammars/ogc.rng
CHANGED
@@ -63,21 +63,35 @@
|
|
63
63
|
</element>
|
64
64
|
</define>
|
65
65
|
</include>
|
66
|
-
<define name="
|
67
|
-
<
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
<
|
76
|
-
|
77
|
-
|
78
|
-
|
66
|
+
<define name="TextElement" combine="choice">
|
67
|
+
<ref name="hi"/>
|
68
|
+
</define>
|
69
|
+
<define name="PureTextElement" combine="choice">
|
70
|
+
<ref name="hi"/>
|
71
|
+
</define>
|
72
|
+
<define name="hi">
|
73
|
+
<element name="hi">
|
74
|
+
<zeroOrMore>
|
75
|
+
<choice>
|
76
|
+
<ref name="PureTextElement"/>
|
77
|
+
<ref name="stem"/>
|
78
|
+
</choice>
|
79
|
+
</zeroOrMore>
|
79
80
|
</element>
|
80
81
|
</define>
|
82
|
+
<define name="DocumentSubtype">
|
83
|
+
<choice>
|
84
|
+
<value>conceptual-model</value>
|
85
|
+
<value>conceptual-model-and-encoding</value>
|
86
|
+
<value>conceptual-model-and-implementation</value>
|
87
|
+
<value>encoding</value>
|
88
|
+
<value>extension</value>
|
89
|
+
<value>implementation</value>
|
90
|
+
<value>profile</value>
|
91
|
+
<value>profile-with-extension</value>
|
92
|
+
<value>general</value>
|
93
|
+
</choice>
|
94
|
+
</define>
|
81
95
|
<define name="submitters">
|
82
96
|
<element name="submitters">
|
83
97
|
<ref name="Basic-Section"/>
|
@@ -115,6 +129,9 @@
|
|
115
129
|
<zeroOrMore>
|
116
130
|
<ref name="termdocsource"/>
|
117
131
|
</zeroOrMore>
|
132
|
+
<optional>
|
133
|
+
<ref name="misccontainer"/>
|
134
|
+
</optional>
|
118
135
|
<optional>
|
119
136
|
<ref name="boilerplate"/>
|
120
137
|
</optional>
|
@@ -126,6 +143,9 @@
|
|
126
143
|
<ref name="annex"/>
|
127
144
|
</zeroOrMore>
|
128
145
|
<ref name="bibliography"/>
|
146
|
+
<zeroOrMore>
|
147
|
+
<ref name="indexsect"/>
|
148
|
+
</zeroOrMore>
|
129
149
|
</element>
|
130
150
|
</define>
|
131
151
|
</grammar>
|
data/grammars/reqt.rng
CHANGED
@@ -30,15 +30,34 @@
|
|
30
30
|
<data type="boolean"/>
|
31
31
|
</attribute>
|
32
32
|
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="number"/>
|
35
|
+
</optional>
|
33
36
|
<optional>
|
34
37
|
<attribute name="subsequence"/>
|
35
38
|
</optional>
|
39
|
+
<optional>
|
40
|
+
<attribute name="keep-with-next">
|
41
|
+
<data type="boolean"/>
|
42
|
+
</attribute>
|
43
|
+
</optional>
|
44
|
+
<optional>
|
45
|
+
<attribute name="keep-lines-together">
|
46
|
+
<data type="boolean"/>
|
47
|
+
</attribute>
|
48
|
+
</optional>
|
36
49
|
<attribute name="id">
|
37
50
|
<data type="ID"/>
|
38
51
|
</attribute>
|
39
52
|
<optional>
|
40
53
|
<attribute name="filename"/>
|
41
54
|
</optional>
|
55
|
+
<optional>
|
56
|
+
<attribute name="model"/>
|
57
|
+
</optional>
|
58
|
+
<optional>
|
59
|
+
<attribute name="type"/>
|
60
|
+
</optional>
|
42
61
|
<optional>
|
43
62
|
<ref name="reqtitle"/>
|
44
63
|
</optional>
|
@@ -48,9 +67,9 @@
|
|
48
67
|
<optional>
|
49
68
|
<ref name="subject"/>
|
50
69
|
</optional>
|
51
|
-
<
|
70
|
+
<zeroOrMore>
|
52
71
|
<ref name="reqinherit"/>
|
53
|
-
</
|
72
|
+
</zeroOrMore>
|
54
73
|
<zeroOrMore>
|
55
74
|
<ref name="classification"/>
|
56
75
|
</zeroOrMore>
|
@@ -135,6 +154,16 @@
|
|
135
154
|
<data type="boolean"/>
|
136
155
|
</attribute>
|
137
156
|
</optional>
|
157
|
+
<optional>
|
158
|
+
<attribute name="keep-with-next">
|
159
|
+
<data type="boolean"/>
|
160
|
+
</attribute>
|
161
|
+
</optional>
|
162
|
+
<optional>
|
163
|
+
<attribute name="keep-lines-together">
|
164
|
+
<data type="boolean"/>
|
165
|
+
</attribute>
|
166
|
+
</optional>
|
138
167
|
<oneOrMore>
|
139
168
|
<ref name="BasicBlock"/>
|
140
169
|
</oneOrMore>
|
@@ -14,17 +14,13 @@ module RelatonOgc
|
|
14
14
|
profile profile-with-extension general
|
15
15
|
].freeze
|
16
16
|
|
17
|
-
# @return [String]
|
18
|
-
attr_reader :docsubtype
|
19
|
-
|
20
|
-
# @param docsubtype [String]
|
21
17
|
def initialize(**args)
|
22
|
-
if args[:
|
18
|
+
if args[:subdoctype] && !SUBTYPES.include?(args[:subdoctype])
|
23
19
|
warn "[relaton-ogc] WARNING: invalid document "\
|
24
|
-
|
20
|
+
"subtype: #{args[:subdoctype]}"
|
25
21
|
end
|
26
22
|
|
27
|
-
@docsubtype = args.delete :docsubtype
|
23
|
+
# @docsubtype = args.delete :docsubtype
|
28
24
|
# @doctype = args.delete :doctype
|
29
25
|
super
|
30
26
|
end
|
@@ -33,15 +29,15 @@ module RelatonOgc
|
|
33
29
|
# @return [RelatonOgc::OgcBibliographicItem]
|
34
30
|
def self.from_hash(hash)
|
35
31
|
item_hash = ::RelatonOgc::HashConverter.hash_to_bib(hash)
|
36
|
-
new
|
32
|
+
new(**item_hash)
|
37
33
|
end
|
38
34
|
|
39
35
|
# @return [Hash]
|
40
|
-
def to_hash
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
36
|
+
# def to_hash
|
37
|
+
# hash = super
|
38
|
+
# hash["docsubtype"] = docsubtype if docsubtype
|
39
|
+
# hash
|
40
|
+
# end
|
45
41
|
|
46
42
|
# @param opts [Hash]
|
47
43
|
# @option opts [Nokogiri::XML::Builder] :builder XML builder
|
@@ -50,10 +46,10 @@ module RelatonOgc
|
|
50
46
|
# @option opts [String, Symbol] :lang language
|
51
47
|
# @return [String] XML
|
52
48
|
def to_xml(**opts)
|
53
|
-
super
|
49
|
+
super(**opts) do |b|
|
54
50
|
b.ext do
|
55
51
|
b.doctype doctype if doctype
|
56
|
-
b.
|
52
|
+
b.subdoctype subdoctype if subdoctype
|
57
53
|
editorialgroup&.to_xml b
|
58
54
|
ics.each { |i| i.to_xml b }
|
59
55
|
end
|
@@ -62,11 +58,11 @@ module RelatonOgc
|
|
62
58
|
|
63
59
|
# @param prefix [String]
|
64
60
|
# @return [String]
|
65
|
-
def to_asciibib(prefix = "")
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
end
|
61
|
+
# def to_asciibib(prefix = "")
|
62
|
+
# pref = prefix.empty? ? prefix : prefix + "."
|
63
|
+
# out = super
|
64
|
+
# out += "#{pref}docsubtype:: #{docsubtype}\n" if docsubtype
|
65
|
+
# out
|
66
|
+
# end
|
71
67
|
end
|
72
68
|
end
|
data/lib/relaton_ogc/scrapper.rb
CHANGED
@@ -34,7 +34,7 @@ module RelatonOgc
|
|
34
34
|
class << self
|
35
35
|
# papam hit [Hash]
|
36
36
|
# @return [RelatonOgc::OrcBibliographicItem]
|
37
|
-
def parse_page(hit)
|
37
|
+
def parse_page(hit) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
38
38
|
type = fetch_type(hit["type"])
|
39
39
|
OgcBibliographicItem.new(
|
40
40
|
fetched: Date.today.to_s,
|
@@ -43,7 +43,7 @@ module RelatonOgc
|
|
43
43
|
docid: fetch_docid(hit["identifier"]),
|
44
44
|
link: fetch_link(hit["URL"]),
|
45
45
|
doctype: type[:type],
|
46
|
-
|
46
|
+
subdoctype: type[:subtype],
|
47
47
|
docstatus: fetch_status(type[:stage]),
|
48
48
|
edition: fetch_edition(hit["identifier"]),
|
49
49
|
abstract: fetch_abstract(hit["description"]),
|
data/lib/relaton_ogc/version.rb
CHANGED
@@ -9,20 +9,20 @@ module RelatonOgc
|
|
9
9
|
# @param item_hash [Hash]
|
10
10
|
# @return [RelatonOgc::OgcBibliographicItem]
|
11
11
|
def bib_item(item_hash)
|
12
|
-
OgcBibliographicItem.new
|
12
|
+
OgcBibliographicItem.new(**item_hash)
|
13
13
|
end
|
14
14
|
|
15
15
|
# Override RelatonIsoBib::XMLParser.item_data method.
|
16
16
|
# @param item [Nokogiri::XML::Element]
|
17
17
|
# @returtn [Hash]
|
18
|
-
def item_data(item)
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
# def item_data(item)
|
19
|
+
# data = super
|
20
|
+
# ext = item.at "./ext"
|
21
|
+
# return data unless ext
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
end
|
23
|
+
# data[:docsubtype] = ext.at("./docsubtype")&.text
|
24
|
+
# data
|
25
|
+
# end
|
26
26
|
|
27
27
|
# @TODO Organization doesn't recreated
|
28
28
|
# @param ext [Nokogiri::XML::Element]
|
@@ -35,7 +35,7 @@ module RelatonOgc
|
|
35
35
|
sc = iso_subgroup eg&.at("subcommittee")
|
36
36
|
wg = iso_subgroup eg&.at("workgroup")
|
37
37
|
EditorialGroup.new(
|
38
|
-
committee: committe, subcommittee: sc, workgroup: wg
|
38
|
+
committee: committe, subcommittee: sc, workgroup: wg,
|
39
39
|
)
|
40
40
|
end
|
41
41
|
end
|
data/relaton_ogc.gemspec
CHANGED
@@ -23,18 +23,17 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.bindir = "exe"
|
24
24
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ["lib"]
|
26
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
26
27
|
|
27
|
-
# spec.add_development_dependency "debase"
|
28
28
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
29
29
|
spec.add_development_dependency "pry-byebug"
|
30
|
-
spec.add_development_dependency "rake", "~>
|
30
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
31
31
|
spec.add_development_dependency "rspec", "~> 3.0"
|
32
|
-
# spec.add_development_dependency "ruby-debug-ide"
|
33
32
|
spec.add_development_dependency "ruby-jing"
|
34
33
|
spec.add_development_dependency "simplecov"
|
35
34
|
spec.add_development_dependency "vcr"
|
36
35
|
spec.add_development_dependency "webmock"
|
37
36
|
|
38
|
-
spec.add_dependency "faraday", "~> 1.
|
39
|
-
spec.add_dependency "relaton-iso-bib", "~> 1.
|
37
|
+
spec.add_dependency "faraday", "~> 1.1"
|
38
|
+
spec.add_dependency "relaton-iso-bib", "~> 1.9.0"
|
40
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-ogc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.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: 2021-
|
11
|
+
date: 2021-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: equivalent-xml
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '13.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '13.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,28 +128,28 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: '1.1'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: '1.1'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: relaton-iso-bib
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 1.
|
145
|
+
version: 1.9.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 1.
|
152
|
+
version: 1.9.0
|
153
153
|
description: 'RelatonOgc: retrieve OGC Standards for bibliographic use using the OgcBibliographicItem
|
154
154
|
model'
|
155
155
|
email:
|
@@ -167,6 +167,7 @@ files:
|
|
167
167
|
- README.adoc
|
168
168
|
- Rakefile
|
169
169
|
- bin/console
|
170
|
+
- bin/rspec
|
170
171
|
- bin/setup
|
171
172
|
- grammars/basicdoc.rng
|
172
173
|
- grammars/biblio.rng
|
@@ -197,14 +198,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
197
198
|
requirements:
|
198
199
|
- - ">="
|
199
200
|
- !ruby/object:Gem::Version
|
200
|
-
version:
|
201
|
+
version: 2.5.0
|
201
202
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
203
|
requirements:
|
203
204
|
- - ">="
|
204
205
|
- !ruby/object:Gem::Version
|
205
206
|
version: '0'
|
206
207
|
requirements: []
|
207
|
-
rubygems_version: 3.
|
208
|
+
rubygems_version: 3.2.3
|
208
209
|
signing_key:
|
209
210
|
specification_version: 4
|
210
211
|
summary: 'RelatonOgc: retrieve OGC Standards for bibliographic use using the OgcBibliographicItem
|