relaton-w3c 2.0.0.pre.alpha.3 → 2.1.0
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/CLAUDE.md +4 -0
- data/Gemfile +1 -0
- data/README.adoc +2 -0
- data/Rakefile +22 -0
- data/grammars/biblio.rng +4 -8
- data/lib/relaton/w3c/bibdata.rb +1 -0
- data/lib/relaton/w3c/bibitem.rb +1 -0
- data/lib/relaton/w3c/ext.rb +1 -4
- data/lib/relaton/w3c/rate_limit_handler.rb +6 -4
- data/lib/relaton/w3c/version.rb +1 -1
- data/{relaton_w3c.gemspec → relaton-w3c.gemspec} +1 -1
- metadata +9 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13b1cff0388614accbd3e92eb118b4af836dcb22ff9844c0f07085593286f549
|
|
4
|
+
data.tar.gz: b4eb76c6c066551c76ce7a46618600627a3dec79fbe4d3072f038780d4ffa3b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b1fa3ce8ff6601acbd02b63c685e5218547da53ee43e8845dbe12bd7182ddf003cfdd8729bfa0a051f498bda2a242c8f8b6c1e49093face23d3423b93fef3c3b
|
|
7
|
+
data.tar.gz: ea0d9a344e540ab2a08bf157b38265f246a28c92d0b93cab2f0779360e0f58f25405c896f0511a37cad30f69b5fdd9a9ac1254c23e1b5ee3b300d745e28b974a
|
data/CLAUDE.md
CHANGED
|
@@ -95,3 +95,7 @@ Test fixtures live in `spec/fixtures/` (YAML, XML, RDF files).
|
|
|
95
95
|
GitHub Actions workflows (auto-generated by Cimas) delegate to shared workflows in `relaton/support`:
|
|
96
96
|
- `rake.yml` — runs tests on push to main and PRs
|
|
97
97
|
- `release.yml` — gem versioning and publishing to RubyGems
|
|
98
|
+
|
|
99
|
+
## Testing
|
|
100
|
+
|
|
101
|
+
- **Index fixture:** `spec/fixtures/index-v1.zip` is pre-loaded into `Relaton::Index` pool in `before(:suite)` (configured in `spec/support/webmock.rb`). Run `rake spec:update_index` to refresh from relaton-data-w3c.
|
data/Gemfile
CHANGED
data/README.adoc
CHANGED
|
@@ -126,6 +126,8 @@ RelatonW3c uses the relaton-logger gem for logging. By default, it logs to STDOU
|
|
|
126
126
|
|
|
127
127
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
128
128
|
|
|
129
|
+
To update the index test fixture (used by tests), run `rake spec:update_index`. This downloads the latest `index-v1.zip` from the https://github.com/relaton/relaton-data-w3c[relaton-data-w3c] repository.
|
|
130
|
+
|
|
129
131
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
130
132
|
|
|
131
133
|
== Contributing
|
data/Rakefile
CHANGED
|
@@ -4,3 +4,25 @@ require "rspec/core/rake_task"
|
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
|
5
5
|
|
|
6
6
|
task :default => :spec
|
|
7
|
+
|
|
8
|
+
namespace :spec do
|
|
9
|
+
desc "Download latest W3C index fixture from relaton-data-w3c"
|
|
10
|
+
task :update_index do
|
|
11
|
+
require "net/http"
|
|
12
|
+
require "uri"
|
|
13
|
+
|
|
14
|
+
url = "https://raw.githubusercontent.com/relaton/relaton-data-w3c/data-v2/index-v1.zip"
|
|
15
|
+
dest = File.join(__dir__, "spec", "fixtures", "index-v1.zip")
|
|
16
|
+
|
|
17
|
+
puts "Downloading \#{url} ..."
|
|
18
|
+
uri = URI.parse(url)
|
|
19
|
+
response = Net::HTTP.get_response(uri)
|
|
20
|
+
|
|
21
|
+
if response.is_a?(Net::HTTPSuccess)
|
|
22
|
+
File.binwrite(dest, response.body)
|
|
23
|
+
puts "Updated \#{dest} (\#{response.body.bytesize} bytes)"
|
|
24
|
+
else
|
|
25
|
+
abort "Failed to download: HTTP \#{response.code}"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
data/grammars/biblio.rng
CHANGED
|
@@ -2015,15 +2015,11 @@ provided that it is not the entire bibliographic item that is so related</a:docu
|
|
|
2015
2015
|
<a:documentation>A version of the bibliographic item (within an edition). Can be used for drafts</a:documentation>
|
|
2016
2016
|
<element name="version">
|
|
2017
2017
|
<optional>
|
|
2018
|
-
<
|
|
2019
|
-
<a:documentation>
|
|
2020
|
-
</
|
|
2021
|
-
</optional>
|
|
2022
|
-
<optional>
|
|
2023
|
-
<ref name="draft">
|
|
2024
|
-
<a:documentation>The identifier for the current draft of the bibliographic item</a:documentation>
|
|
2025
|
-
</ref>
|
|
2018
|
+
<attribute name="type">
|
|
2019
|
+
<a:documentation>Versioning scheme, in case of multiple versioning schemes</a:documentation>
|
|
2020
|
+
</attribute>
|
|
2026
2021
|
</optional>
|
|
2022
|
+
<text/>
|
|
2027
2023
|
</element>
|
|
2028
2024
|
</define>
|
|
2029
2025
|
<define name="vedition">
|
data/lib/relaton/w3c/bibdata.rb
CHANGED
data/lib/relaton/w3c/bibitem.rb
CHANGED
data/lib/relaton/w3c/ext.rb
CHANGED
|
@@ -3,12 +3,9 @@ require_relative "doctype"
|
|
|
3
3
|
module Relaton
|
|
4
4
|
module W3c
|
|
5
5
|
class Ext < Bib::Ext
|
|
6
|
-
attribute :schema_version, method: :get_schema_version
|
|
7
6
|
attribute :doctype, Doctype
|
|
8
7
|
|
|
9
|
-
def get_schema_version
|
|
10
|
-
Relaton.schema_versions["relaton-model-w3c"]
|
|
11
|
-
end
|
|
8
|
+
def get_schema_version = Relaton.schema_versions["relaton-model-w3c"]
|
|
12
9
|
end
|
|
13
10
|
end
|
|
14
11
|
end
|
|
@@ -4,7 +4,7 @@ module Relaton
|
|
|
4
4
|
MAX_RETRIES = 5
|
|
5
5
|
RETRYABLE_ERRORS = [
|
|
6
6
|
NameError, Lutaml::Hal::ConnectionError, Lutaml::Hal::TimeoutError,
|
|
7
|
-
Faraday::ConnectionFailed, Net::OpenTimeout,
|
|
7
|
+
Lutaml::Hal::ServerError, Faraday::ConnectionFailed, Net::OpenTimeout,
|
|
8
8
|
].freeze
|
|
9
9
|
|
|
10
10
|
def self.fetched_objects
|
|
@@ -25,6 +25,11 @@ module Relaton
|
|
|
25
25
|
Util.warn "Rate limit exceeded for #{href}, retrying in #{sleep_time} seconds..."
|
|
26
26
|
sleep sleep_time
|
|
27
27
|
retry
|
|
28
|
+
elsif e.is_a?(Lutaml::Hal::ServerError)
|
|
29
|
+
# Persistent 5xx — cache nil so a permanently broken upstream
|
|
30
|
+
# resource is skipped on the next lookup instead of re-tried.
|
|
31
|
+
Util.warn "Server error for #{href}, skipping: #{e.message}"
|
|
32
|
+
RateLimitHandler.fetched_objects[href] = nil
|
|
28
33
|
else
|
|
29
34
|
# Do not cache on retries exhausted — transient failures should not
|
|
30
35
|
# permanently poison the cache; subsequent calls will retry fresh.
|
|
@@ -33,9 +38,6 @@ module Relaton
|
|
|
33
38
|
rescue Lutaml::Hal::NotFoundError
|
|
34
39
|
Util.warn "Object not found: #{href}"
|
|
35
40
|
RateLimitHandler.fetched_objects[href] = nil
|
|
36
|
-
rescue Lutaml::Hal::ServerError => e
|
|
37
|
-
Util.warn "Server error while realizing object: #{href}, error: #{e.message}"
|
|
38
|
-
RateLimitHandler.fetched_objects[href] = nil
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
|
data/lib/relaton/w3c/version.rb
CHANGED
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
|
35
35
|
spec.add_dependency "mechanize", "~> 2.10"
|
|
36
36
|
spec.add_dependency "rdf", "~> 3.2"
|
|
37
37
|
spec.add_dependency "rdf-normalize", "~> 0.6"
|
|
38
|
-
spec.add_dependency "relaton-bib", "~> 2.
|
|
38
|
+
spec.add_dependency "relaton-bib", "~> 2.1.0"
|
|
39
39
|
spec.add_dependency "relaton-core", "~> 0.0.13"
|
|
40
40
|
spec.add_dependency "relaton-index", "~> 0.2.8"
|
|
41
41
|
spec.add_dependency "rubyzip", "~> 2.3"
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-w3c
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-05-04 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: linkeddata
|
|
@@ -71,14 +72,14 @@ dependencies:
|
|
|
71
72
|
requirements:
|
|
72
73
|
- - "~>"
|
|
73
74
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: 2.
|
|
75
|
+
version: 2.1.0
|
|
75
76
|
type: :runtime
|
|
76
77
|
prerelease: false
|
|
77
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
79
|
requirements:
|
|
79
80
|
- - "~>"
|
|
80
81
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: 2.
|
|
82
|
+
version: 2.1.0
|
|
82
83
|
- !ruby/object:Gem::Dependency
|
|
83
84
|
name: relaton-core
|
|
84
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -219,12 +220,13 @@ files:
|
|
|
219
220
|
- lib/relaton/w3c/rate_limit_handler.rb
|
|
220
221
|
- lib/relaton/w3c/util.rb
|
|
221
222
|
- lib/relaton/w3c/version.rb
|
|
222
|
-
-
|
|
223
|
+
- relaton-w3c.gemspec
|
|
223
224
|
homepage: https://github.com/relaton/relaton-wc3
|
|
224
225
|
licenses:
|
|
225
226
|
- BSD-2-Clause
|
|
226
227
|
metadata:
|
|
227
228
|
homepage_uri: https://github.com/relaton/relaton-wc3
|
|
229
|
+
post_install_message:
|
|
228
230
|
rdoc_options: []
|
|
229
231
|
require_paths:
|
|
230
232
|
- lib
|
|
@@ -239,7 +241,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
239
241
|
- !ruby/object:Gem::Version
|
|
240
242
|
version: '0'
|
|
241
243
|
requirements: []
|
|
242
|
-
rubygems_version: 3.
|
|
244
|
+
rubygems_version: 3.5.22
|
|
245
|
+
signing_key:
|
|
243
246
|
specification_version: 4
|
|
244
247
|
summary: 'Relaton::W3c: retrieve W3C Standards for bibliographic using the IsoBibliographicItem
|
|
245
248
|
model'
|