relaton-ieee 2.0.0.pre.alpha.1 → 2.0.0.pre.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/grammars/basicdoc.rng +14 -1
- data/grammars/biblio.rng +8 -8
- data/lib/relaton/ieee/data_fetcher.rb +7 -2
- data/lib/relaton/ieee/idams_parser.rb +53 -22
- data/lib/relaton/ieee/version.rb +1 -1
- data/relaton_ieee.gemspec +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 635e97db814aede6788d7cbaa68b944bd126cfecee8140224445de0824a5c6f3
|
|
4
|
+
data.tar.gz: b3205c0a214ebc3d2b9ad9ad478afc3afa46c0675ed7d42aae2f0b72fe618e02
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6c6d7ca58ecc976effe3fa7f13b63c7a37ebd79c0d70d5025c7519fe86d0a7131844e0653a5a90ab44b4ca4bc3875c710b93833d4fe680d89c3025f902bcce0
|
|
7
|
+
data.tar.gz: 4486082f38dc9c26beb95a567bb55dc6d93da59692b689ab2693037f61144cb01ba01a1d3f56e00ed2d5fd6f74595088705baee5921645590c1125e361fc0ee0
|
data/grammars/basicdoc.rng
CHANGED
|
@@ -187,6 +187,15 @@ Applicable to modify and delete</a:documentation>
|
|
|
187
187
|
<a:documentation>Optional caption of this block</a:documentation>
|
|
188
188
|
</attribute>
|
|
189
189
|
</optional>
|
|
190
|
+
<optional>
|
|
191
|
+
<attribute name="position">
|
|
192
|
+
<a:documentation>For an "add" change, whether the change is added before or after the location</a:documentation>
|
|
193
|
+
<choice>
|
|
194
|
+
<value>before</value>
|
|
195
|
+
<value>after</value>
|
|
196
|
+
</choice>
|
|
197
|
+
</attribute>
|
|
198
|
+
</optional>
|
|
190
199
|
<optional>
|
|
191
200
|
<element name="location">
|
|
192
201
|
<a:documentation>The location(s) in the original document which have undergone the change described in this block</a:documentation>
|
|
@@ -208,11 +217,15 @@ Applicable to modify and delete</a:documentation>
|
|
|
208
217
|
</zeroOrMore>
|
|
209
218
|
<optional>
|
|
210
219
|
<element name="newcontent">
|
|
211
|
-
<a:documentation>New content to be added to the document; applicable to add and modify
|
|
220
|
+
<a:documentation>New content to be added to the document; applicable to add and modify.
|
|
221
|
+
Can be blocks and/or sections</a:documentation>
|
|
212
222
|
<ref name="OptionalId"/>
|
|
213
223
|
<zeroOrMore>
|
|
214
224
|
<ref name="BasicBlock"/>
|
|
215
225
|
</zeroOrMore>
|
|
226
|
+
<zeroOrMore>
|
|
227
|
+
<ref name="section"/>
|
|
228
|
+
</zeroOrMore>
|
|
216
229
|
</element>
|
|
217
230
|
</optional>
|
|
218
231
|
<zeroOrMore>
|
data/grammars/biblio.rng
CHANGED
|
@@ -1142,11 +1142,11 @@ NOTE: This should preferably be encoded as a URI or short identifier, rather th
|
|
|
1142
1142
|
<a:documentation>Information about how long the current description of the bibliographic item is valid for</a:documentation>
|
|
1143
1143
|
</ref>
|
|
1144
1144
|
</optional>
|
|
1145
|
-
<
|
|
1145
|
+
<zeroOrMore>
|
|
1146
1146
|
<ref name="depiction">
|
|
1147
1147
|
<a:documentation>Depiction of the bibliographic item, typically an image</a:documentation>
|
|
1148
1148
|
</ref>
|
|
1149
|
-
</
|
|
1149
|
+
</zeroOrMore>
|
|
1150
1150
|
</define>
|
|
1151
1151
|
<define name="ReducedBibliographicItem">
|
|
1152
1152
|
<a:documentation>Reduced description of a bibliographic resource, without mandatory title and docidentifier, used for document relations
|
|
@@ -1939,10 +1939,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
|
|
|
1939
1939
|
<value>hasAnnotation</value>
|
|
1940
1940
|
<value>draftOf</value>
|
|
1941
1941
|
<value>hasDraft</value>
|
|
1942
|
-
<value>
|
|
1943
|
-
<value>
|
|
1944
|
-
<value>
|
|
1945
|
-
<value>
|
|
1942
|
+
<value>predecessorDraftOf</value>
|
|
1943
|
+
<value>hasPredecessorDraft</value>
|
|
1944
|
+
<value>successorDraftOf</value>
|
|
1945
|
+
<value>hasSuccessorDraft</value>
|
|
1946
1946
|
<value>editionOf</value>
|
|
1947
1947
|
<value>hasEdition</value>
|
|
1948
1948
|
<value>updates</value>
|
|
@@ -2063,13 +2063,13 @@ provided that it is not the entire bibliographic item that is so related</a:docu
|
|
|
2063
2063
|
<ref name="LocalizedString"/>
|
|
2064
2064
|
</element>
|
|
2065
2065
|
</optional>
|
|
2066
|
-
<
|
|
2066
|
+
<zeroOrMore>
|
|
2067
2067
|
<element name="taxon">
|
|
2068
2068
|
<a:documentation>The keywords as a hierarchical taxonomy. For example, the sequence of `taxon` elements
|
|
2069
2069
|
`pump`, `centrifugal pump`, `line shaft pump` represents a taxonomic classification</a:documentation>
|
|
2070
2070
|
<ref name="LocalizedString"/>
|
|
2071
2071
|
</element>
|
|
2072
|
-
</
|
|
2072
|
+
</zeroOrMore>
|
|
2073
2073
|
<zeroOrMore>
|
|
2074
2074
|
<ref name="vocabid">
|
|
2075
2075
|
<a:documentation>Identifiers for the keyword as a controlled vocabulary</a:documentation>
|
|
@@ -22,6 +22,10 @@ module Relaton
|
|
|
22
22
|
#
|
|
23
23
|
# Convert documents from `ieee-rawbib` dir (IEEE dataset) to BibYAML/BibXML
|
|
24
24
|
#
|
|
25
|
+
def log_error(msg)
|
|
26
|
+
Util.error msg
|
|
27
|
+
end
|
|
28
|
+
|
|
25
29
|
def fetch(_source = nil) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
|
|
26
30
|
Dir["ieee-rawbib/**/*.{xml,zip}"].reject { |f| f["Deleted_"] }.each do |f|
|
|
27
31
|
xml = case File.extname(f)
|
|
@@ -34,6 +38,7 @@ module Relaton
|
|
|
34
38
|
end
|
|
35
39
|
# File.write "normtitles.txt", @normtitles.join("\n")
|
|
36
40
|
update_relations
|
|
41
|
+
report_errors
|
|
37
42
|
end
|
|
38
43
|
|
|
39
44
|
# @return [Hash] list of AMSID => PubID
|
|
@@ -70,7 +75,7 @@ module Relaton
|
|
|
70
75
|
return if RELATION_TYPES[type] == false
|
|
71
76
|
|
|
72
77
|
docid = Bib::Docidentifier.new(type: "IEEE", content: fref, primary: true)
|
|
73
|
-
bib = ItemData.new formattedref: fref, docidentifier: [docid]
|
|
78
|
+
bib = ItemData.new formattedref: Bib::Formattedref.new(content: fref), docidentifier: [docid]
|
|
74
79
|
description = create_relation_description type
|
|
75
80
|
Bib::Relation.new(type: RELATION_TYPES[type][:type], description: description, bibitem: bib)
|
|
76
81
|
end
|
|
@@ -118,7 +123,7 @@ module Relaton
|
|
|
118
123
|
end
|
|
119
124
|
return if doc.publicationinfo&.standard_id == "0"
|
|
120
125
|
|
|
121
|
-
bib = IdamsParser.new(doc, self).parse
|
|
126
|
+
bib = IdamsParser.new(doc, self, @errors).parse
|
|
122
127
|
if bib.docnumber.nil?
|
|
123
128
|
Util.warn "PubID parse error. Normtitle: `#{doc.normtitle}`, file: `#{filename}`"
|
|
124
129
|
return
|
|
@@ -10,9 +10,10 @@ module Relaton
|
|
|
10
10
|
relation source keyword ext
|
|
11
11
|
].freeze
|
|
12
12
|
|
|
13
|
-
def initialize(doc, fetcher)
|
|
13
|
+
def initialize(doc, fetcher, errors = {})
|
|
14
14
|
@doc = doc
|
|
15
15
|
@fetcher = fetcher
|
|
16
|
+
@errors = errors
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
#
|
|
@@ -27,7 +28,9 @@ module Relaton
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def parse_docnumber
|
|
30
|
-
docnumber
|
|
31
|
+
result = docnumber
|
|
32
|
+
@errors[:docnumber] &&= result.nil?
|
|
33
|
+
result
|
|
31
34
|
end
|
|
32
35
|
|
|
33
36
|
#
|
|
@@ -58,7 +61,9 @@ module Relaton
|
|
|
58
61
|
# @return [Array<Relaton::Bib::Title>]
|
|
59
62
|
#
|
|
60
63
|
def parse_title
|
|
61
|
-
@doc.btitle.map { |args| Bib::Title.new(**args) }
|
|
64
|
+
result = @doc.btitle.map { |args| Bib::Title.new(**args) }
|
|
65
|
+
@errors[:title] &&= result.empty?
|
|
66
|
+
result
|
|
62
67
|
end
|
|
63
68
|
|
|
64
69
|
#
|
|
@@ -67,7 +72,9 @@ module Relaton
|
|
|
67
72
|
# @return [Array<Relaton::Bib::Date>]
|
|
68
73
|
#
|
|
69
74
|
def parse_date
|
|
70
|
-
@doc.bdate.map { |args| Bib::Date.new(type: args[:type], at: args[:on]) }
|
|
75
|
+
result = @doc.bdate.map { |args| Bib::Date.new(type: args[:type], at: args[:on]) }
|
|
76
|
+
@errors[:date] &&= result.empty?
|
|
77
|
+
result
|
|
71
78
|
end
|
|
72
79
|
|
|
73
80
|
#
|
|
@@ -81,7 +88,9 @@ module Relaton
|
|
|
81
88
|
ids.unshift(content: pubid.to_s(trademark: true), scope: "trademark", type: "IEEE", primary: true)
|
|
82
89
|
ids.unshift(content: pubid.to_s, type: "IEEE", primary: true)
|
|
83
90
|
|
|
84
|
-
ids.map { |dcid| Bib::Docidentifier.new(**dcid) }
|
|
91
|
+
result = ids.map { |dcid| Bib::Docidentifier.new(**dcid) }
|
|
92
|
+
@errors[:docidentifier] &&= result.empty?
|
|
93
|
+
result
|
|
85
94
|
end
|
|
86
95
|
|
|
87
96
|
#
|
|
@@ -99,7 +108,9 @@ module Relaton
|
|
|
99
108
|
contributors << Relaton::Bib::Contributor.new(organization: org, role: [role])
|
|
100
109
|
|
|
101
110
|
# Add committee contributors from editorial group
|
|
102
|
-
contributors + parse_committee_contributors
|
|
111
|
+
result = contributors + parse_committee_contributors
|
|
112
|
+
@errors[:contributor] &&= result.empty?
|
|
113
|
+
result
|
|
103
114
|
end
|
|
104
115
|
|
|
105
116
|
#
|
|
@@ -111,9 +122,11 @@ module Relaton
|
|
|
111
122
|
committees = @doc.editorialgroup
|
|
112
123
|
return [] unless committees
|
|
113
124
|
|
|
114
|
-
committees.map do |committee|
|
|
125
|
+
result = committees.map do |committee|
|
|
115
126
|
create_committee_contributor(committee)
|
|
116
127
|
end
|
|
128
|
+
@errors[:committee] &&= result.empty?
|
|
129
|
+
result
|
|
117
130
|
end
|
|
118
131
|
|
|
119
132
|
#
|
|
@@ -147,11 +160,13 @@ module Relaton
|
|
|
147
160
|
# @return [Array<Relaton::Bib::LocalizedMarkedUpString>]
|
|
148
161
|
#
|
|
149
162
|
def parse_abstract
|
|
150
|
-
@doc.volume.article.articleinfo.abstract.each_with_object([]) do |abs, acc|
|
|
163
|
+
result = @doc.volume.article.articleinfo.abstract.each_with_object([]) do |abs, acc|
|
|
151
164
|
next unless abs.abstract_type == "Standard"
|
|
152
165
|
|
|
153
|
-
acc << Bib::
|
|
166
|
+
acc << Bib::Abstract.new(content: abs.value, language: "en", script: "Latn")
|
|
154
167
|
end
|
|
168
|
+
@errors[:abstract] &&= result.empty?
|
|
169
|
+
result
|
|
155
170
|
end
|
|
156
171
|
|
|
157
172
|
#
|
|
@@ -160,10 +175,12 @@ module Relaton
|
|
|
160
175
|
# @return [Array<Relaton::Bib::Copyright>]
|
|
161
176
|
#
|
|
162
177
|
def parse_copyright
|
|
163
|
-
@doc.copyright.map do |owner, year|
|
|
178
|
+
result = @doc.copyright.map do |owner, year|
|
|
164
179
|
contrib = owner.map { |own| Bib::ContributionInfo.new organization: create_org(own) }
|
|
165
180
|
Bib::Copyright.new(owner: contrib, from: year)
|
|
166
181
|
end
|
|
182
|
+
@errors[:copyright] &&= result.empty?
|
|
183
|
+
result
|
|
167
184
|
end
|
|
168
185
|
|
|
169
186
|
#
|
|
@@ -174,6 +191,7 @@ module Relaton
|
|
|
174
191
|
def parse_status
|
|
175
192
|
return if @doc.docstatus.nil? || @doc.docstatus.empty?
|
|
176
193
|
|
|
194
|
+
@errors[:status] &&= @doc.docstatus[:stage].nil?
|
|
177
195
|
stage = Bib::Status::Stage.new content: @doc.docstatus[:stage]
|
|
178
196
|
Bib::Status.new stage: stage
|
|
179
197
|
end
|
|
@@ -184,7 +202,7 @@ module Relaton
|
|
|
184
202
|
# @return [Array<Relaton::Bib::Relation>]
|
|
185
203
|
#
|
|
186
204
|
def parse_relation # rubocop:disable Metrics/AbcSize
|
|
187
|
-
array(@doc.publicationinfo.standard_relationship).each_with_object([]) do |relation, acc|
|
|
205
|
+
result = array(@doc.publicationinfo.standard_relationship).each_with_object([]) do |relation, acc|
|
|
188
206
|
if (ref = @fetcher.backrefs[relation.date_string])
|
|
189
207
|
rel = @fetcher.create_relation(relation.type, ref)
|
|
190
208
|
acc << rel if rel
|
|
@@ -192,6 +210,8 @@ module Relaton
|
|
|
192
210
|
@fetcher.add_crossref(docnumber, relation)
|
|
193
211
|
end
|
|
194
212
|
end
|
|
213
|
+
@errors[:relation] &&= result.empty?
|
|
214
|
+
result
|
|
195
215
|
end
|
|
196
216
|
|
|
197
217
|
#
|
|
@@ -200,7 +220,9 @@ module Relaton
|
|
|
200
220
|
# @return [Array<Relaton::Bib::Uri>]
|
|
201
221
|
#
|
|
202
222
|
def parse_source
|
|
203
|
-
@doc.link { |url| Bib::Uri.new(content: url, type: "src") }
|
|
223
|
+
result = @doc.link { |url| Bib::Uri.new(content: url, type: "src") }
|
|
224
|
+
@errors[:source] &&= result.empty?
|
|
225
|
+
result
|
|
204
226
|
end
|
|
205
227
|
|
|
206
228
|
#
|
|
@@ -209,12 +231,11 @@ module Relaton
|
|
|
209
231
|
# @return [Array<Strign>]
|
|
210
232
|
#
|
|
211
233
|
def parse_keyword
|
|
212
|
-
|
|
213
|
-
Bib::LocalizedString.new(content: kw, language: "en", script: "Latn")
|
|
234
|
+
result = @doc.keyword.map do |kw|
|
|
235
|
+
Bib::Keyword.new(vocab: Bib::LocalizedString.new(content: kw, language: "en", script: "Latn"))
|
|
214
236
|
end
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
[Bib::Keyword.new(taxon: taxon)]
|
|
237
|
+
@errors[:keyword] &&= result.empty?
|
|
238
|
+
result
|
|
218
239
|
end
|
|
219
240
|
|
|
220
241
|
private
|
|
@@ -247,14 +268,22 @@ module Relaton
|
|
|
247
268
|
end
|
|
248
269
|
|
|
249
270
|
def parse_ext
|
|
271
|
+
standard_status = @doc.publicationinfo.standard_status
|
|
272
|
+
standard_modified = @doc.standard_modifier
|
|
273
|
+
pubstatus = @doc.publicationinfo.pubstatus
|
|
274
|
+
holdstatus = @doc.publicationinfo.holdstatus
|
|
275
|
+
@errors[:standard_status] &&= standard_status.nil?
|
|
276
|
+
@errors[:standard_modified] &&= standard_modified.nil?
|
|
277
|
+
@errors[:pubstatus] &&= pubstatus.nil?
|
|
278
|
+
@errors[:holdstatus] &&= holdstatus.nil?
|
|
250
279
|
Ext.new(
|
|
251
280
|
doctype: parse_doctype,
|
|
252
281
|
flavor: "ieee",
|
|
253
282
|
ics: parse_ics,
|
|
254
|
-
standard_status:
|
|
255
|
-
standard_modified:
|
|
256
|
-
pubstatus:
|
|
257
|
-
holdstatus:
|
|
283
|
+
standard_status: standard_status,
|
|
284
|
+
standard_modified: standard_modified,
|
|
285
|
+
pubstatus: pubstatus,
|
|
286
|
+
holdstatus: holdstatus,
|
|
258
287
|
)
|
|
259
288
|
end
|
|
260
289
|
|
|
@@ -273,9 +302,11 @@ module Relaton
|
|
|
273
302
|
# @return [Array<Relaton::Bib::ICS>]
|
|
274
303
|
#
|
|
275
304
|
def parse_ics
|
|
276
|
-
@doc.ics.each_with_object([]) do |ics, acc|
|
|
305
|
+
result = @doc.ics.each_with_object([]) do |ics, acc|
|
|
277
306
|
acc << Bib::ICS.new(**ics) if ics[:code] && !ics[:code].empty?
|
|
278
307
|
end
|
|
308
|
+
@errors[:ics] &&= result.empty?
|
|
309
|
+
result
|
|
279
310
|
end
|
|
280
311
|
end
|
|
281
312
|
end
|
data/lib/relaton/ieee/version.rb
CHANGED
data/relaton_ieee.gemspec
CHANGED
|
@@ -34,8 +34,8 @@ Gem::Specification.new do |spec|
|
|
|
34
34
|
spec.add_dependency "faraday", "~> 2.7.0"
|
|
35
35
|
spec.add_dependency "ieee-idams", "~> 0.2.10"
|
|
36
36
|
spec.add_dependency "mini_portile2", "~> 2.8.0"
|
|
37
|
-
spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.
|
|
38
|
-
spec.add_dependency "relaton-core", "~> 0.0.
|
|
37
|
+
spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.7"
|
|
38
|
+
spec.add_dependency "relaton-core", "~> 0.0.13"
|
|
39
39
|
spec.add_dependency "relaton-index", "~> 0.2.0"
|
|
40
40
|
spec.add_dependency "rubyzip", "~> 2.3.0"
|
|
41
41
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-ieee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.0.pre.alpha.
|
|
4
|
+
version: 2.0.0.pre.alpha.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -57,28 +57,28 @@ dependencies:
|
|
|
57
57
|
requirements:
|
|
58
58
|
- - "~>"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 2.0.0.pre.alpha.
|
|
60
|
+
version: 2.0.0.pre.alpha.7
|
|
61
61
|
type: :runtime
|
|
62
62
|
prerelease: false
|
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: 2.0.0.pre.alpha.
|
|
67
|
+
version: 2.0.0.pre.alpha.7
|
|
68
68
|
- !ruby/object:Gem::Dependency
|
|
69
69
|
name: relaton-core
|
|
70
70
|
requirement: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 0.0.
|
|
74
|
+
version: 0.0.13
|
|
75
75
|
type: :runtime
|
|
76
76
|
prerelease: false
|
|
77
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
79
|
- - "~>"
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 0.0.
|
|
81
|
+
version: 0.0.13
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: relaton-index
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|