relaton-iana 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: 4256503fe01467a1a69d8491597940f3f825355385cbf67fa2020b107b9c3115
4
- data.tar.gz: 862d46fd0beba7dbcc80395f42c112c95029141ff94ec6d2b2c4ea8ff1ce28eb
3
+ metadata.gz: c6ea8919d2b6d8ba46ccebedc2598ad4a1e258c315a9cc4617fcc4ca0533b50c
4
+ data.tar.gz: 759d101f2b3a9ac288c030d5560ea336ee9be43076d5d27597a88ffb911e0cfe
5
5
  SHA512:
6
- metadata.gz: 44a288beab0a82d297cf3a216c4d86f5c1dbd7e05d8a4e27e6562b83d91f78a481d3112594ec15617ac543ea644da32779510968a326fbf532b49f7d31b49d13
7
- data.tar.gz: ca3cd9b1363fee8601804e2626032acbc53db5b430e18934c4f4470aa9c33b7f7008d11df1ddbb56afa55efe4b24d2567e2a23cce1a58d0d2b37090aa6a4ccd2
6
+ metadata.gz: a8325164a29a1aa1293e5f85ebd704482e10e5449737ee9c69d4e41d83fdcd9fe28c85a84aa84e5ad110d099bd7b83c16db6e9cb0a64062b2ca56ebdfeeeab2a
7
+ data.tar.gz: ee69c0dfe8160241140a5557879eff6c3e7d9ad67964ef9a6cfdbeede4c3126f0526a4f3e951fce9e20ba87681fe1f2efd0e46d72fcd4f1f436660823c003d6f
data/README.adoc CHANGED
@@ -50,7 +50,7 @@ item = Relaton::Iana::Bibliography.get "IANA service-names-port-numbers"
50
50
  [source,ruby]
51
51
  ----
52
52
  item.to_xml
53
- => "<bibitem id="IANAservicenamesportnumbers" type="standard" schema-version="v1.4.1">
53
+ => "<bibitem id="IANAservicenamesportnumbers" type="standard" schema-version="v1.5.6">
54
54
  <fetched>2026-01-27</fetched>
55
55
  <title language="en" script="Latn">Service Name and Transport Protocol Port Number Registry</title>
56
56
  <uri type="self">https://www.iana.org/assignments/service-names-port-numbers</uri>
@@ -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
@@ -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
- <optional>
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
- </optional>
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>preliminaryDraftOf</value>
1943
- <value>hasPreliminaryDraft</value>
1944
- <value>revisionDraftOf</value>
1945
- <value>hasRevisionDraft</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
- <oneOrMore>
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
- </oneOrMore>
2072
+ </zeroOrMore>
2073
2073
  <zeroOrMore>
2074
2074
  <ref name="vocabid">
2075
2075
  <a:documentation>Identifiers for the keyword as a controlled vocabulary</a:documentation>
@@ -8,6 +8,10 @@ module Relaton
8
8
  #
9
9
  # Parse documents
10
10
  #
11
+ def log_error(msg)
12
+ Util.error msg
13
+ end
14
+
11
15
  def fetch(_source = nil)
12
16
  Dir["iana-registries/**/*.xml"].each do |file|
13
17
  content = File.read file, encoding: "UTF-8"
@@ -16,6 +20,7 @@ module Relaton
16
20
  Util.error "Error: #{e.message}. File: #{file}"
17
21
  end
18
22
  index.save
23
+ report_errors
19
24
  end
20
25
 
21
26
  private
@@ -27,9 +32,9 @@ module Relaton
27
32
  def parse(content)
28
33
  xml = Nokogiri::XML(content)
29
34
  registry = xml.at("/xmlns:registry")
30
- doc = Parser.parse registry
35
+ doc = Parser.parse registry, nil, @errors
31
36
  save_doc doc
32
- registry.xpath("./xmlns:registry").each { |r| save_doc Parser.parse(r, doc) }
37
+ registry.xpath("./xmlns:registry").each { |r| save_doc Parser.parse(r, doc, @errors) }
33
38
  end
34
39
 
35
40
  #
@@ -6,9 +6,10 @@ module Relaton
6
6
  #
7
7
  # @param [Nokogiri::XML::Element] xml
8
8
  #
9
- def initialize(xml, rootdoc)
9
+ def initialize(xml, rootdoc, errors = {})
10
10
  @xml = xml
11
11
  @rootdoc = rootdoc
12
+ @errors = errors
12
13
  end
13
14
 
14
15
  #
@@ -18,8 +19,8 @@ module Relaton
18
19
  #
19
20
  # @return [Relaton::Iana::ItemData, nil] bibliographic item
20
21
  #
21
- def self.parse(xml, rootdoc = nil)
22
- new(xml, rootdoc).parse
22
+ def self.parse(xml, rootdoc = nil, errors = {})
23
+ new(xml, rootdoc, errors).parse
23
24
  end
24
25
 
25
26
  #
@@ -50,7 +51,9 @@ module Relaton
50
51
  #
51
52
  def parse_title
52
53
  content = @xml.at("./xmlns:title")&.text || @xml[:id]
53
- [Bib::Title.new(content: content, language: "en", script: "Latn")]
54
+ result = [Bib::Title.new(content: content, language: "en", script: "Latn")]
55
+ @errors[:title] &&= result.empty?
56
+ result
54
57
  end
55
58
 
56
59
  #
@@ -59,11 +62,15 @@ module Relaton
59
62
  # @return [Array<Relaton::Bib::Uri>] link
60
63
  #
61
64
  def parse_source
62
- if @rootdoc then @rootdoc.source
63
- else
64
- uri = URI.join "https://www.iana.org/assignments/", @xml[:id]
65
- [Bib::Uri.new(type: "src", content: uri.to_s)]
66
- end
65
+ result = if @rootdoc then @rootdoc.source
66
+ elsif @xml[:id]
67
+ uri = URI.join "https://www.iana.org/assignments/", @xml[:id]
68
+ [Bib::Uri.new(type: "src", content: uri.to_s)]
69
+ else
70
+ []
71
+ end
72
+ @errors[:source] &&= result.empty?
73
+ result
67
74
  end
68
75
 
69
76
  #
@@ -72,7 +79,9 @@ module Relaton
72
79
  # @return [Arra<RelatonBib::DocumentIdentifier>] docidentifier
73
80
  #
74
81
  def parse_docid
75
- [Bib::Docidentifier.new(type: "IANA", content: pub_id, primary: true)]
82
+ result = [Bib::Docidentifier.new(type: "IANA", content: pub_id, primary: true)]
83
+ @errors[:docid] &&= result.empty?
84
+ result
76
85
  end
77
86
 
78
87
  #
@@ -101,7 +110,9 @@ module Relaton
101
110
  def docnumber
102
111
  dn = ""
103
112
  dn += "#{@rootdoc.docnumber}/" if @rootdoc
104
- dn + @xml["id"]
113
+ id = @xml["id"].to_s
114
+ @errors[:docnumber] &&= id.empty?
115
+ dn + id
105
116
  end
106
117
 
107
118
  #
@@ -110,10 +121,12 @@ module Relaton
110
121
  # @return [Array<Relaton::Bib::Date>] date
111
122
  #
112
123
  def parse_date
113
- d = @xml.xpath("./xmlns:created|./xmlns:published|./xmlns:updated").map do |d|
114
- Bib::Date.new(type: d.name, at: d.text)
124
+ d = @xml.xpath("./xmlns:created|./xmlns:published|./xmlns:updated").map do |dt|
125
+ Bib::Date.new(type: dt.name, at: dt.text)
115
126
  end
116
- d.none? && @rootdoc ? @rootdoc.date : d
127
+ result = d.none? && @rootdoc ? @rootdoc.date : d
128
+ @errors[:date] &&= result.empty?
129
+ result
117
130
  end
118
131
 
119
132
  #
@@ -1,5 +1,5 @@
1
1
  module Relaton
2
2
  module Iana
3
- VERSION = "2.0.0-alpha.2".freeze
3
+ VERSION = "2.0.0-alpha.3".freeze
4
4
  end
5
5
  end
data/relaton_iana.gemspec CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
31
31
  spec.require_paths = ["lib"]
32
32
 
33
33
  spec.add_dependency "faraday", "~> 2.7.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.13"
36
36
  spec.add_dependency "relaton-index", "~> 0.2.0"
37
37
 
38
38
  # Uncomment to register a new dependency of your gem
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaton-iana
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.
@@ -29,28 +29,28 @@ dependencies:
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 2.0.0.pre.alpha.4
32
+ version: 2.0.0.pre.alpha.7
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 2.0.0.pre.alpha.4
39
+ version: 2.0.0.pre.alpha.7
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: relaton-core
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: 0.0.9
46
+ version: 0.0.13
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: 0.0.9
53
+ version: 0.0.13
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: relaton-index
56
56
  requirement: !ruby/object:Gem::Requirement