relaton-cie 2.0.0.pre.alpha.2 → 2.0.0.pre.alpha.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9fa6a9815305c42544d6c12ccd53db7160466467497791e19c083b28174b944
4
- data.tar.gz: '09217f90eb63cbb4bdc7d63b429b58458fb5e95db5175998eb4ce92426a2df70'
3
+ metadata.gz: 69b71b734f820604e3f3f6ace17de60b9b8e4502f263e374fae88dfa8a48b781
4
+ data.tar.gz: aaa0ae4e1837db334cc20d44a7fd7bc1fd5b381cfeb408e0e033f20deb97456a
5
5
  SHA512:
6
- metadata.gz: 4b16cb3e76c40b0d82d40706e107433e252b8072310440d14bea7a15e79ffed8e56daf4d08935d9d70467d2364a1e76932faacb3ce6c0aee256ae0973fe63d7e
7
- data.tar.gz: ed8bee5a4aad1e3a569dec6e71c10c9aaf6579ecb22ce241997aefac1370433b054b199e94addf7db99446f4fa10262116ccf9eb3ee99f2fc69aa9a95e06b47f
6
+ metadata.gz: b62aa1655cbd39d73def4a93c998cac9d7818bc0d1ebd45d0543c43c472c60875c797b7b5f5233f52911f2e27bbaf99917d33a91646afcb37a84d89c417f1aa0
7
+ data.tar.gz: 3f752a2a86b2b899eb6f99fad6ac823569b59eb5536422b936350dab65c7ebaab6e884de07896ce98930f1a2dca86dccbe31bd5887f789ff6d727b723afd3c85
data/README.adoc CHANGED
@@ -54,7 +54,7 @@ Relaton::Cie::Bibliography.get '1111'
54
54
  [source,ruby]
55
55
  ----
56
56
  item.to_xml
57
- => "<bibitem id="CIE0011980" type="standard" schema-version="v1.4.1">
57
+ => "<bibitem id="CIE0011980" type="standard" schema-version="v1.5.6">
58
58
  <fetched>2025-12-23</fetched>
59
59
  <title type="title-main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
60
60
  <title type="main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
@@ -67,7 +67,7 @@ With `bibdata: true` option XML output is wrapped with `bibdata` element and `ex
67
67
  [source,ruby]
68
68
  ----
69
69
  item.to_xml bibdata: true
70
- => "<bibdata type="standard" schema-version="v1.4.1">
70
+ => "<bibdata type="standard" schema-version="v1.5.6">
71
71
  <fetched>2025-12-23</fetched>
72
72
  <title type="title-main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
73
73
  <title type="main">Guidelines for minimizing urban sky glow near astronomical observatories (Joint Publication IAU/CIE)</title>
@@ -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</a:documentation>
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
@@ -466,11 +466,11 @@ Editorial and advisory groups are represented as consecutive subdivisions of the
466
466
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
467
467
  </ref>
468
468
  </optional>
469
- <optional>
469
+ <zeroOrMore>
470
470
  <ref name="logo">
471
471
  <a:documentation>A logo for the organization</a:documentation>
472
472
  </ref>
473
- </optional>
473
+ </zeroOrMore>
474
474
  </define>
475
475
  <define name="orgname">
476
476
  <element name="name">
@@ -502,6 +502,11 @@ Editorial and advisory groups are represented as consecutive subdivisions of the
502
502
  </define>
503
503
  <define name="logo">
504
504
  <element name="logo">
505
+ <optional>
506
+ <attribute name="type">
507
+ <a:documentation>The type of logo</a:documentation>
508
+ </attribute>
509
+ </optional>
505
510
  <ref name="image-no-id"/>
506
511
  </element>
507
512
  </define>
@@ -513,6 +518,11 @@ Editorial and advisory groups are represented as consecutive subdivisions of the
513
518
  <a:documentation>Description of what is being depicted</a:documentation>
514
519
  </attribute>
515
520
  </optional>
521
+ <optional>
522
+ <attribute name="type">
523
+ <a:documentation>Description of what kind of depiction this</a:documentation>
524
+ </attribute>
525
+ </optional>
516
526
  <zeroOrMore>
517
527
  <ref name="image-no-id">
518
528
  <a:documentation>A visual depiction of the bibliographic item</a:documentation>
@@ -690,7 +700,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
690
700
  <define name="CitationType">
691
701
  <attribute name="bibitemid">
692
702
  <a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
693
- <data type="IDREF"/>
703
+ <ref name="IdRefType"/>
694
704
  </attribute>
695
705
  <choice>
696
706
  <zeroOrMore>
@@ -1132,11 +1142,11 @@ NOTE: This should preferably be encoded as a URI or short identifier, rather th
1132
1142
  <a:documentation>Information about how long the current description of the bibliographic item is valid for</a:documentation>
1133
1143
  </ref>
1134
1144
  </optional>
1135
- <optional>
1145
+ <zeroOrMore>
1136
1146
  <ref name="depiction">
1137
1147
  <a:documentation>Depiction of the bibliographic item, typically an image</a:documentation>
1138
1148
  </ref>
1139
- </optional>
1149
+ </zeroOrMore>
1140
1150
  </define>
1141
1151
  <define name="ReducedBibliographicItem">
1142
1152
  <a:documentation>Reduced description of a bibliographic resource, without mandatory title and docidentifier, used for document relations
@@ -1236,9 +1246,9 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1236
1246
  <optional>
1237
1247
  <ref name="validity"/>
1238
1248
  </optional>
1239
- <optional>
1249
+ <zeroOrMore>
1240
1250
  <ref name="depiction"/>
1241
- </optional>
1251
+ </zeroOrMore>
1242
1252
  </define>
1243
1253
  <define name="btitle">
1244
1254
  <a:documentation>A title of a bibliographic item, associated with a type of title</a:documentation>
@@ -1296,17 +1306,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1296
1306
  </define>
1297
1307
  <define name="validityBegins">
1298
1308
  <element name="validityBegins">
1299
- <ref name="ISO8601Date"/>
1309
+ <ref name="ISO8601DateTime"/>
1300
1310
  </element>
1301
1311
  </define>
1302
1312
  <define name="validityEnds">
1303
1313
  <element name="validityEnds">
1304
- <ref name="ISO8601Date"/>
1314
+ <ref name="ISO8601DateTime"/>
1305
1315
  </element>
1306
1316
  </define>
1307
1317
  <define name="validityRevision">
1308
1318
  <element name="revision">
1309
- <ref name="ISO8601Date"/>
1319
+ <ref name="ISO8601DateTime"/>
1310
1320
  </element>
1311
1321
  </define>
1312
1322
  <define name="TypedTitleString">
@@ -1929,10 +1939,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1929
1939
  <value>hasAnnotation</value>
1930
1940
  <value>draftOf</value>
1931
1941
  <value>hasDraft</value>
1932
- <value>preliminaryDraftOf</value>
1933
- <value>hasPreliminaryDraft</value>
1934
- <value>revisionDraftOf</value>
1935
- <value>hasRevisionDraft</value>
1942
+ <value>predecessorDraftOf</value>
1943
+ <value>hasPredecessorDraft</value>
1944
+ <value>successorDraftOf</value>
1945
+ <value>hasSuccessorDraft</value>
1936
1946
  <value>editionOf</value>
1937
1947
  <value>hasEdition</value>
1938
1948
  <value>updates</value>
@@ -2053,13 +2063,13 @@ provided that it is not the entire bibliographic item that is so related</a:docu
2053
2063
  <ref name="LocalizedString"/>
2054
2064
  </element>
2055
2065
  </optional>
2056
- <oneOrMore>
2066
+ <zeroOrMore>
2057
2067
  <element name="taxon">
2058
2068
  <a:documentation>The keywords as a hierarchical taxonomy. For example, the sequence of `taxon` elements
2059
2069
  `pump`, `centrifugal pump`, `line shaft pump` represents a taxonomic classification</a:documentation>
2060
2070
  <ref name="LocalizedString"/>
2061
2071
  </element>
2062
- </oneOrMore>
2072
+ </zeroOrMore>
2063
2073
  <zeroOrMore>
2064
2074
  <ref name="vocabid">
2065
2075
  <a:documentation>Identifiers for the keyword as a controlled vocabulary</a:documentation>
@@ -32,18 +32,36 @@ module Relaton
32
32
  @index ||= Index.find_or_create :cie, file: "index-v1.yaml"
33
33
  end
34
34
 
35
+ def log_error(msg)
36
+ Util.error msg
37
+ end
38
+
35
39
  # @param hit [Nokogiri::HTML::Document]
36
40
  # @param doc [Mechanize::Page]
37
41
  # @return [Array<Relaton::Bib::Docidentifier>]
38
42
  def fetch_docid(hit, doc)
39
43
  code, code2 = parse_code hit, doc
40
- docid = [Bib::Docidentifier.new(type: "CIE", content: code, primary: true)]
41
- if code2
44
+ docid = []
45
+ if code && !code.strip.empty?
46
+ docid << Bib::Docidentifier.new(type: "CIE", content: code, primary: true)
47
+ @errors[:docid_1] &&= false
48
+ else
49
+ @errors[:docid_1] &&= true
50
+ end
51
+ if code2 && !code2.strip.empty?
42
52
  type2 = code2.match(/\w+/).to_s
43
53
  docid << Relaton::Bib::Docidentifier.new(type: type2, content: code2.strip)
54
+ @errors[:docid_2] &&= false
55
+ else
56
+ @errors[:docid_2] &&= true
57
+ end
58
+ isbn = doc.at('//h3[contains(.,"ISBN")]/following-sibling::span')&.text
59
+ if isbn && !isbn.strip.empty?
60
+ docid << Bib::Docidentifier.new(type: "ISBN", content: isbn)
61
+ @errors[:docid_isbn] &&= false
62
+ else
63
+ @errors[:docid_isbn] &&= true
44
64
  end
45
- isbn = doc.at('//h3[contains(.,"ISBN")]/following-sibling::span')
46
- docid << Bib::Docidentifier.new(type: "ISBN", content: isbn.text.strip) if isbn
47
65
  docid
48
66
  end
49
67
 
@@ -82,35 +100,46 @@ module Relaton
82
100
  # @return [Array<Relaton::Bib::Title>]
83
101
  def fetch_title(doc)
84
102
  t = doc.at("//hgroup/h2/text()", "//hgroup/h1/text()")
85
- return [] unless t
103
+ unless t && !t.text.strip.empty?
104
+ @errors[:title] &&= true
105
+ return []
106
+ end
86
107
 
87
- Bib::Title.from_string t.text.strip
108
+ result = Bib::Title.from_string t.text.strip
109
+ @errors[:title] &&= result.empty?
110
+ result
88
111
  end
89
112
 
90
113
  # @param doc [Mechanize::Page]
91
114
  # @return [Array<Relaton::Bib::Date>]
92
115
  def fetch_date(doc)
93
- doc.xpath("//h3[.='Published:']/following-sibling::span").map do |d|
116
+ result = doc.xpath("//h3[.='Published:']/following-sibling::span").map do |d|
94
117
  pd = d.text.strip
95
118
  on = pd.match?(/^\d{4}(?:[^-]|$)/) ? pd : Date.strptime(pd, "%m/%d/%Y").strftime("%Y-%m-%d")
96
119
  Bib::Date.new(type: "published", at: on)
97
120
  end
121
+ @errors[:date] &&= result.empty?
122
+ result
98
123
  end
99
124
 
100
125
  # @param doc [Mechanize::Page]
101
126
  # @return [String]
102
127
  def fetch_edition(doc)
103
128
  ed = doc.at("//h3[.='Edition:']/following-sibling::span")
129
+ @errors[:edition] &&= true
104
130
  return unless ed
105
131
 
106
132
  content = ed.text.slice(/^\d+(?=(st|nd|rd|th))/)
107
- Bib::Edition.new(content: content) if content
133
+ if content
134
+ @errors[:edition] = false
135
+ Bib::Edition.new(content: content)
136
+ end
108
137
  end
109
138
 
110
139
  # @param doc [Mechanize::Page]
111
140
  # @return [Array<Relaton::Cie::Relation>]
112
141
  def fetch_relation(doc) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
113
- doc.xpath('//section[@class="history"]/ol/li[not(contains(@class,"selected-product"))]').map do |rel|
142
+ rels = doc.xpath('//section[@class="history"]/ol/li[not(contains(@class,"selected-product"))]').map do |rel|
114
143
  ref = rel.at("a")
115
144
  url = "https://www.techstreet.com#{ref[:href]}"
116
145
  title = Bib::Title.from_string ref.at('p/span[@class="title"]').text
@@ -123,11 +152,16 @@ module Relaton
123
152
  type = ref.at('//li/i[contains(@class,"historical")]') ? "updates" : "updatedBy"
124
153
  Bib::Relation.new(type: type, bibitem: bibitem)
125
154
  end
155
+ @errors[:relation] &&= rels.empty?
156
+ rels
126
157
  end
127
158
 
128
159
  # @param url [String]
129
160
  # @return [Array<Relaton::Bib::Uri>]
130
161
  def fetch_source(url)
162
+ @errors[:source] &&= url.nil? || url.empty?
163
+ return [] if url.nil? || url.empty?
164
+
131
165
  [Bib::Uri.new(type: "src", content: url)]
132
166
  end
133
167
 
@@ -135,9 +169,14 @@ module Relaton
135
169
  # @return [Array<Relaton::Bib::LocalizedMarkedUpString>]
136
170
  def fetch_abstract(doc)
137
171
  content = doc.at('//div[contains(@class,"description")]')&.text&.strip
138
- return [] if content.nil? || content.empty?
172
+ if content.nil? || content.empty?
173
+ @errors[:abstract] &&= true
174
+ return []
175
+ end
139
176
 
140
- [Bib::LocalizedMarkedUpString.new(content: content, language: "en", script: "Latn")]
177
+ result = [Bib::Abstract.new(content: content, language: "en", script: "Latn")]
178
+ @errors[:abstract] &&= result.empty?
179
+ result
141
180
  end
142
181
 
143
182
  # @param doc [Mechanize::Page]
@@ -165,6 +204,7 @@ module Relaton
165
204
  person = Bib::Person.new name: fullname
166
205
  role = Bib::Contributor::Role.new type: "author"
167
206
  contribs << Bib::Contributor.new(person: person, role: [role])
207
+ @errors[:contributor_author] &&= contribs.empty?
168
208
  end
169
209
  org_name = Bib::TypedLocalizedString.new(content: "Commission Internationale de L'Eclairage")
170
210
  abbrev = Bib::LocalizedString.new content: "CIE"
@@ -226,6 +266,7 @@ module Relaton
226
266
 
227
267
  def fetch(_source = nil)
228
268
  fetch_doc
269
+ report_errors
229
270
  end
230
271
 
231
272
  def fetch_doc(url = URL)
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Cie
3
- VERSION = "2.0.0-alpha.2".freeze
3
+ VERSION = "2.0.0-alpha.3".freeze
4
4
  end
5
5
  end
data/relaton_cie.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
 
32
32
  spec.add_dependency "mechanize", "~> 2.10"
33
33
  spec.add_dependency "parslet", "~> 2.0.0"
34
- spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.4"
35
- spec.add_dependency "relaton-core", "~> 0.0.9"
34
+ spec.add_dependency "relaton-bib", "~> 2.0.0-alpha.7"
35
+ spec.add_dependency "relaton-core", "~> 0.0.12"
36
36
  spec.add_dependency "relaton-index", "~> 0.2.0"
37
37
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-cie
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.alpha.2
4
+ version: 2.0.0.pre.alpha.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
@@ -43,28 +43,28 @@ dependencies:
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 2.0.0.pre.alpha.4
46
+ version: 2.0.0.pre.alpha.7
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 2.0.0.pre.alpha.4
53
+ version: 2.0.0.pre.alpha.7
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: relaton-core
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 0.0.9
60
+ version: 0.0.12
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: 0.0.9
67
+ version: 0.0.12
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: relaton-index
70
70
  requirement: !ruby/object:Gem::Requirement