relaton-iso 2.0.0.pre.alpha.5 → 2.0.0.pre.alpha.7
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/README.adoc +4 -4
- data/grammars/basicdoc.rng +14 -1
- data/grammars/biblio.rng +8 -8
- data/lib/relaton/iso/data_fetcher.rb +1 -5
- data/lib/relaton/iso/hit_collection.rb +1 -1
- data/lib/relaton/iso/model/docidentifier.rb +24 -31
- data/lib/relaton/iso/scraper.rb +3 -3
- data/lib/relaton/iso/version.rb +1 -1
- data/relaton_iso.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: 8e76d7d42d7e6dfbd362753f345eb6fdd66cb10db2cf9453cc1f712d88aefd35
|
|
4
|
+
data.tar.gz: f7b82618ba1a3d27bb07329643e2319853a801d439c0e1bda43716eb7b30c399
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9339fc84f10f081d9bb498c0d33925e9d648cd2708097150516c33821dd4cd9ec1b28973f1ec3c5803f0faefcbbdb9c6739609a7d97a508406e799021980812
|
|
7
|
+
data.tar.gz: 26f1afd730ee2a8272c3ad7ad2e073bbe79ced42fcfdfd96ac92f54b98695ef903a2db8c17a0367311391b603156d71ca4134cfa4169ee732dfc27c27ffd3317
|
data/README.adoc
CHANGED
|
@@ -244,24 +244,24 @@ Possible options:
|
|
|
244
244
|
[source,ruby]
|
|
245
245
|
----
|
|
246
246
|
item.to_xml
|
|
247
|
-
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.
|
|
247
|
+
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.5.6">
|
|
248
248
|
<title language="en" script="Latn" type="title-intro" format="text/plain">Geographic information</title>
|
|
249
249
|
<title language="en" script="Latn" type="title-main" format="text/plain">Metadata</title>
|
|
250
250
|
...
|
|
251
251
|
</bibitem>"
|
|
252
252
|
|
|
253
253
|
item.to_xml bibdata: true
|
|
254
|
-
=> "<bibdata type="standard" schema-version="v1.
|
|
254
|
+
=> "<bibdata type="standard" schema-version="v1.5.6">
|
|
255
255
|
<title language="en" script="Latn" type="title-intro" format="text/plain">Geographic information</title>
|
|
256
256
|
...
|
|
257
|
-
<ext schema-version="v1.
|
|
257
|
+
<ext schema-version="v1.1.2">
|
|
258
258
|
<doctype>international-standard</doctype>
|
|
259
259
|
...
|
|
260
260
|
</ext>
|
|
261
261
|
</bibdata>"
|
|
262
262
|
|
|
263
263
|
item.to_xml note: [{ content: "Note", type: "note" }]
|
|
264
|
-
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.
|
|
264
|
+
=> "<bibitem id="ISO19115-1-2014" type="standard" schema-version="v1.5.6">
|
|
265
265
|
...
|
|
266
266
|
<note type="note">Note</note>
|
|
267
267
|
...
|
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>
|
|
@@ -6,10 +6,6 @@ module Relaton
|
|
|
6
6
|
module Iso
|
|
7
7
|
# Fetch all the documents from ISO website.
|
|
8
8
|
class DataFetcher < Core::DataFetcher
|
|
9
|
-
def gh_issue_channel
|
|
10
|
-
["relaton/relaton-iso", "Error fetching ISO documents"]
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
#
|
|
14
10
|
# The queue is used to store the ICS page paths beeing fetching in the current run.
|
|
15
11
|
#
|
|
@@ -55,7 +51,7 @@ module Relaton
|
|
|
55
51
|
iso_queue.save
|
|
56
52
|
# index.sort! { |a, b| compare_docids a, b }
|
|
57
53
|
index.save
|
|
58
|
-
|
|
54
|
+
report_errors
|
|
59
55
|
end
|
|
60
56
|
|
|
61
57
|
private
|
|
@@ -123,7 +123,7 @@ module Relaton
|
|
|
123
123
|
def create_relation(hit)
|
|
124
124
|
# pubid = Pubid.new hit.pubid
|
|
125
125
|
docid = Docidentifier.new(content: hit.pubid, type: "ISO", primary: true)
|
|
126
|
-
isobib = ItemData.new(formattedref: hit.pubid.to_s, docidentifier: [docid])
|
|
126
|
+
isobib = ItemData.new(formattedref: Bib::Formattedref.new(content: hit.pubid.to_s), docidentifier: [docid])
|
|
127
127
|
Relation.new(type: "instanceOf", bibitem: isobib)
|
|
128
128
|
end
|
|
129
129
|
end
|
|
@@ -26,6 +26,20 @@ module Relaton
|
|
|
26
26
|
|
|
27
27
|
attribute :content, Pubid
|
|
28
28
|
|
|
29
|
+
# iso-tc identifiers are TC document numbers, not ISO standard
|
|
30
|
+
# identifiers — parsing them through Pubid adds a spurious
|
|
31
|
+
# "ISO" prefix (#178)
|
|
32
|
+
def initialize(arg = nil, **kwargs)
|
|
33
|
+
if arg.is_a?(Hash)
|
|
34
|
+
raw_content = arg["content"] if arg["type"] == "iso-tc"
|
|
35
|
+
super(arg)
|
|
36
|
+
else
|
|
37
|
+
raw_content = kwargs[:content] if kwargs[:type] == "iso-tc"
|
|
38
|
+
super(**kwargs)
|
|
39
|
+
end
|
|
40
|
+
@content = raw_content if raw_content.is_a?(String)
|
|
41
|
+
end
|
|
42
|
+
|
|
29
43
|
def content_to_xml(model, parent, doc)
|
|
30
44
|
doc.add_xml_fragment parent, model.to_s
|
|
31
45
|
end
|
|
@@ -48,41 +62,19 @@ module Relaton
|
|
|
48
62
|
|
|
49
63
|
def remove_stage!
|
|
50
64
|
remove_attr! :stage
|
|
51
|
-
# return if content.is_a? String
|
|
52
|
-
|
|
53
|
-
# content.stage = nil
|
|
54
|
-
# base = content.base
|
|
55
|
-
# while base
|
|
56
|
-
# base.stage = nil
|
|
57
|
-
# base = base.base
|
|
58
|
-
# end
|
|
59
65
|
end
|
|
60
66
|
|
|
61
67
|
def remove_part!
|
|
62
68
|
remove_attr! :part
|
|
63
|
-
# return if content.is_a? String
|
|
64
|
-
|
|
65
|
-
# content.part = nil
|
|
66
|
-
# base = content.base
|
|
67
|
-
# while base
|
|
68
|
-
# base.part = nil
|
|
69
|
-
# base = base.base
|
|
70
|
-
# end
|
|
71
69
|
end
|
|
72
70
|
|
|
73
71
|
def remove_date!
|
|
74
72
|
remove_attr! :year
|
|
75
|
-
# return if content.is_a? String
|
|
76
|
-
|
|
77
|
-
# content.year = nil
|
|
78
|
-
# base = content.base
|
|
79
|
-
# while base
|
|
80
|
-
# base.year = nil
|
|
81
|
-
# base = base.base
|
|
82
|
-
# end
|
|
83
73
|
end
|
|
84
74
|
|
|
85
75
|
def exclude_year
|
|
76
|
+
return content if content.is_a? String
|
|
77
|
+
|
|
86
78
|
pubid = content.exclude(:year)
|
|
87
79
|
current_pubid = pubid
|
|
88
80
|
while current_pubid.base
|
|
@@ -97,23 +89,25 @@ module Relaton
|
|
|
97
89
|
|
|
98
90
|
case type
|
|
99
91
|
when "URN" then content.urn
|
|
100
|
-
when "iso-reference" then iso_reference
|
|
92
|
+
when "iso-reference", "iso-with-lang" then iso_reference
|
|
101
93
|
else content.to_s with_prf: true
|
|
102
94
|
end
|
|
103
95
|
end
|
|
104
96
|
|
|
105
97
|
def iso_reference
|
|
106
|
-
|
|
98
|
+
content.to_s(format: :ref_num_short, with_prf: true)
|
|
99
|
+
|
|
100
|
+
# return content.to_s(format: :ref_num_short, with_prf: true) if content.language
|
|
107
101
|
|
|
108
|
-
pubid_dup = content.dup
|
|
109
|
-
pubid_dup.language = "en"
|
|
110
|
-
pubid_dup.to_s(format: :ref_num_short, with_prf: true)
|
|
102
|
+
# pubid_dup = content.dup
|
|
103
|
+
# pubid_dup.language = "en"
|
|
104
|
+
# pubid_dup.to_s(format: :ref_num_short, with_prf: true)
|
|
111
105
|
end
|
|
112
106
|
|
|
113
107
|
private
|
|
114
108
|
|
|
115
109
|
def remove_attr!(attr)
|
|
116
|
-
return
|
|
110
|
+
return if content.is_a? String
|
|
117
111
|
|
|
118
112
|
content.send("#{attr}=", nil)
|
|
119
113
|
base = content.base
|
|
@@ -121,7 +115,6 @@ module Relaton
|
|
|
121
115
|
base.send("#{attr}=", nil)
|
|
122
116
|
base = base.base
|
|
123
117
|
end
|
|
124
|
-
true
|
|
125
118
|
end
|
|
126
119
|
end
|
|
127
120
|
end
|
data/lib/relaton/iso/scraper.rb
CHANGED
|
@@ -132,7 +132,7 @@ module Relaton
|
|
|
132
132
|
def fetch_relaton_docids
|
|
133
133
|
[
|
|
134
134
|
Docidentifier.new(content: pubid, type: "ISO", primary: true),
|
|
135
|
-
Docidentifier.new(content:
|
|
135
|
+
Docidentifier.new(content: isoref, type: "iso-reference"),
|
|
136
136
|
Docidentifier.new(content: urn, type: "URN"),
|
|
137
137
|
]
|
|
138
138
|
end
|
|
@@ -175,7 +175,7 @@ module Relaton
|
|
|
175
175
|
@errors[:abstract] &&= abstract_content.empty?
|
|
176
176
|
return if abstract_content.empty?
|
|
177
177
|
|
|
178
|
-
Bib::
|
|
178
|
+
Bib::Abstract.new(content: abstract_content, language: lang, script: script(lang))
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
# Returns available languages.
|
|
@@ -379,7 +379,7 @@ module Relaton
|
|
|
379
379
|
def create_relations(rel, type, date)
|
|
380
380
|
rel.css("a").map do |rid|
|
|
381
381
|
docid = Docidentifier.new(type: "ISO", content: rid.text, primary: true)
|
|
382
|
-
bibitem = ItemData.new(docidentifier: [docid], formattedref: rid.text, date: date)
|
|
382
|
+
bibitem = ItemData.new(docidentifier: [docid], formattedref: Bib::Formattedref.new(content: rid.text), date: date)
|
|
383
383
|
Relation.new type: type, bibitem: bibitem
|
|
384
384
|
end
|
|
385
385
|
end
|
data/lib/relaton/iso/version.rb
CHANGED
data/relaton_iso.gemspec
CHANGED
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_dependency "isoics", "~> 0.1.6"
|
|
30
30
|
spec.add_dependency "openssl", "~> 3.3.2" # 3.3.0 raised an error on Ruby 3.4.7
|
|
31
31
|
spec.add_dependency "pubid-iso", "~> 1.15.8"
|
|
32
|
-
spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.
|
|
33
|
-
spec.add_dependency "relaton-core", "~> 0.0.
|
|
32
|
+
spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.7"
|
|
33
|
+
spec.add_dependency "relaton-core", "~> 0.0.12"
|
|
34
34
|
spec.add_dependency "relaton-index", "~> 0.2.12"
|
|
35
35
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-iso
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0.0.pre.alpha.
|
|
4
|
+
version: 2.0.0.pre.alpha.7
|
|
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.12
|
|
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.12
|
|
82
82
|
- !ruby/object:Gem::Dependency
|
|
83
83
|
name: relaton-index
|
|
84
84
|
requirement: !ruby/object:Gem::Requirement
|