relaton-jis 2.1.0 → 2.2.0.pre.alpha.1
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 +3 -1
- data/Gemfile +8 -0
- data/Rakefile +3 -3
- data/lib/relaton/jis/bibliography.rb +16 -11
- data/lib/relaton/jis/data_fetcher.rb +23 -0
- data/lib/relaton/jis/hit.rb +44 -27
- data/lib/relaton/jis/hit_collection.rb +78 -62
- data/lib/relaton/jis/processor.rb +1 -1
- data/lib/relaton/jis/scraper.rb +2 -2
- data/lib/relaton/jis/version.rb +1 -1
- data/lib/relaton/jis.rb +3 -0
- metadata +23 -16
- data/.rubocop.yml +0 -12
- data/grammars/basicdoc.rng +0 -2140
- data/grammars/biblio-standoc.rng +0 -268
- data/grammars/biblio.rng +0 -2125
- data/grammars/relaton-jis-compile.rng +0 -11
- data/grammars/relaton-jis.rng +0 -76
- data/relaton-jis.gemspec +0 -44
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7ed2ef5528da1c7c4875ae6ffc9f5e18b83fb1b7ef8844596e2ed4d868010b52
|
|
4
|
+
data.tar.gz: fbeda1c6f0efa761c24eb2f007461a55d6d25c44b6e00063a776b79774bc57ed
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b5d13203270407ddbdc2b406226cff9955d3f699d9a245cd532b21cd44e0178281ab92c08bbaef27f478be3c77e20f573b2531d213f041aaf97f0994a6275f24
|
|
7
|
+
data.tar.gz: 2208a5a3d65b6d4223b3a334515b95a05658345e82719d9b62fb8b885dd935fb2a624a6ded1513a4b5680dfb136c9335aea107777288443da360fea8bd77512a
|
data/CLAUDE.md
CHANGED
|
@@ -58,4 +58,6 @@ All classes live under `lib/relaton/jis/`:
|
|
|
58
58
|
|
|
59
59
|
## Testing
|
|
60
60
|
|
|
61
|
-
- **Index fixture:** `spec/fixtures/index-
|
|
61
|
+
- **Index fixture:** `spec/fixtures/index-v2.zip` (the pubid-based `index-v2`) is deserialized via `Pubid::Jis::Identifier` and pre-loaded into the `Relaton::Index` pool in `before(:suite)` (configured in `spec/support/webmock.rb`). Run `rake spec:update_index` to refresh from relaton-data-jis.
|
|
62
|
+
- **Lookup path:** `Bibliography.get`/`search` parse the reference with `pubid`, then `HitCollection` matches against `index-v2` (`Hit#matches?` compares type/series/number/part; year is filtered separately). The `DataFetcher` still generates `index-v1` too, but the runtime no longer reads it.
|
|
63
|
+
- **pubid dependency:** the gemspec requires `pubid ~> 2.0.0.pre.alpha.3`, the published release carrying the working lutaml-model `from_hash` (the earlier `2.0.0.pre.alpha.2` was broken). Override to a local checkout with `bundle config set local.pubid /path/to/pubid`.
|
data/Gemfile
CHANGED
|
@@ -5,6 +5,14 @@ source "https://rubygems.org"
|
|
|
5
5
|
# Specify your gem's dependencies in relaton_jis.gemspec
|
|
6
6
|
gemspec
|
|
7
7
|
|
|
8
|
+
# Use local monorepo sibling gems where available.
|
|
9
|
+
Dir["../*/"].each do |dir|
|
|
10
|
+
name = File.basename(dir)
|
|
11
|
+
next if name == File.basename(__dir__)
|
|
12
|
+
next unless File.exist?(File.join(dir, "#{name}.gemspec"))
|
|
13
|
+
gem name, path: dir
|
|
14
|
+
end
|
|
15
|
+
|
|
8
16
|
gem "rake", "~> 13.0"
|
|
9
17
|
gem "rspec", "~> 3.0"
|
|
10
18
|
|
data/Rakefile
CHANGED
|
@@ -12,13 +12,13 @@ RuboCop::RakeTask.new
|
|
|
12
12
|
task default: :spec
|
|
13
13
|
|
|
14
14
|
namespace :spec do
|
|
15
|
-
desc "Download latest JIS index fixture from relaton-data-jis"
|
|
15
|
+
desc "Download latest JIS index fixture (index-v2) from relaton-data-jis"
|
|
16
16
|
task :update_index do
|
|
17
17
|
require "net/http"
|
|
18
18
|
require "uri"
|
|
19
19
|
|
|
20
|
-
url = "https://raw.githubusercontent.com/relaton/relaton-data-jis/
|
|
21
|
-
dest = File.join(__dir__, "spec", "fixtures", "index-
|
|
20
|
+
url = "https://raw.githubusercontent.com/relaton/relaton-data-jis/v2/index-v2.zip"
|
|
21
|
+
dest = File.join(__dir__, "spec", "fixtures", "index-v2.zip")
|
|
22
22
|
|
|
23
23
|
puts "Downloading \#{url} ..."
|
|
24
24
|
uri = URI.parse(url)
|
|
@@ -6,21 +6,26 @@ module Relaton
|
|
|
6
6
|
extend self
|
|
7
7
|
|
|
8
8
|
#
|
|
9
|
-
# Search JIS by
|
|
9
|
+
# Search JIS by reference, returning the full candidate collection.
|
|
10
|
+
#
|
|
11
|
+
# The reference is parsed into a {Pubid::Jis::Identifier} and matched
|
|
12
|
+
# against the pubid-based `index-v2` via {HitCollection}. Candidates share
|
|
13
|
+
# the reference's series and number (a supplement is filed under its base
|
|
14
|
+
# number), so an edition and its amendments are returned together.
|
|
10
15
|
#
|
|
11
16
|
# @param [String] code JIS document code
|
|
12
17
|
# @param [String, nil] year JIS document year
|
|
13
18
|
#
|
|
14
|
-
# @return [Relaton::Jis::HitCollection] search result
|
|
19
|
+
# @return [Relaton::Jis::HitCollection, nil] search result, or nil when
|
|
20
|
+
# the reference cannot be parsed
|
|
15
21
|
#
|
|
16
22
|
def search(code, year = nil)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
HitCollection.new code, year, result: result
|
|
23
|
+
pubid = ::Pubid::Jis::Identifier.parse code
|
|
24
|
+
pubid.year ||= year.to_i if year
|
|
25
|
+
HitCollection.new pubid
|
|
26
|
+
rescue StandardError => e
|
|
27
|
+
Util.warn "Unable to parse `#{code}` with pubid: #{e.message}"
|
|
28
|
+
nil
|
|
24
29
|
end
|
|
25
30
|
|
|
26
31
|
#
|
|
@@ -53,13 +58,13 @@ module Relaton
|
|
|
53
58
|
#
|
|
54
59
|
# Log hint message
|
|
55
60
|
#
|
|
56
|
-
# @param [Array] result search result
|
|
61
|
+
# @param [Array] result search result (missed edition years)
|
|
57
62
|
# @param [String] ref reference to search
|
|
58
63
|
# @param [String, nil] year year to search
|
|
59
64
|
#
|
|
60
65
|
def hint(result, ref, year)
|
|
61
66
|
Util.info "Not found.", key: ref
|
|
62
|
-
if result
|
|
67
|
+
if result&.any?
|
|
63
68
|
Util.info "TIP: No match for edition year `#{year}`, but " \
|
|
64
69
|
"matches exist for `#{result.uniq.join('`, `')}`.", key: ref
|
|
65
70
|
end
|
|
@@ -23,6 +23,26 @@ module Relaton
|
|
|
23
23
|
@index ||= Relaton::Index.find_or_create :jis, file: "#{INDEXFILE}.yaml"
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
+
# Pubid-based index built in parallel with the legacy string index. The
|
|
27
|
+
# pool keys by type, so requesting a second :jis index with a different
|
|
28
|
+
# file evicts the v1 Type from the pool, but we keep our own reference in
|
|
29
|
+
# @index, so both stay live for the duration of the crawl.
|
|
30
|
+
def index_v2
|
|
31
|
+
@index_v2 ||= Relaton::Index.find_or_create(
|
|
32
|
+
:jis, file: "#{INDEXFILE_V2}.yaml", pubid_class: ::Pubid::Jis::Identifier
|
|
33
|
+
)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Parse a primary docidentifier string into a pubid identifier; nil (with
|
|
37
|
+
# a warning) if pubid can't parse it, so a single bad id never aborts the
|
|
38
|
+
# crawl or corrupts index-v2.
|
|
39
|
+
def pubid(id)
|
|
40
|
+
::Pubid::Jis::Identifier.parse id
|
|
41
|
+
rescue StandardError => e
|
|
42
|
+
Util.warn "Failed to parse `#{id}` with pubid: #{e.message}"
|
|
43
|
+
nil
|
|
44
|
+
end
|
|
45
|
+
|
|
26
46
|
def to_yaml(bib)
|
|
27
47
|
Item.to_yaml bib
|
|
28
48
|
end
|
|
@@ -69,6 +89,7 @@ module Relaton
|
|
|
69
89
|
resp = agent.get "#{URL}W11M0070/index"
|
|
70
90
|
parse_page resp
|
|
71
91
|
index.save
|
|
92
|
+
index_v2.save
|
|
72
93
|
report_errors
|
|
73
94
|
end
|
|
74
95
|
|
|
@@ -150,6 +171,8 @@ module Relaton
|
|
|
150
171
|
@files << file
|
|
151
172
|
File.write file, serialize(bib), encoding: "UTF-8"
|
|
152
173
|
index.add_or_update id, file
|
|
174
|
+
pid = pubid id
|
|
175
|
+
index_v2.add_or_update pid, file if pid
|
|
153
176
|
end
|
|
154
177
|
end
|
|
155
178
|
end
|
data/lib/relaton/jis/hit.rb
CHANGED
|
@@ -16,27 +16,45 @@ module Relaton
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
#
|
|
19
|
-
# Check if hit matches reference
|
|
19
|
+
# Check if the hit matches the collection's reference.
|
|
20
20
|
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
#
|
|
21
|
+
# The candidate must be the same document type (so a plain standard query
|
|
22
|
+
# never matches its amendments) and share series and number. Part is
|
|
23
|
+
# compared only when the reference names a specific part and `all_parts`
|
|
24
|
+
# is off. Year is filtered separately by {HitCollection}.
|
|
24
25
|
#
|
|
25
|
-
# @
|
|
26
|
+
# @param [Boolean] all_parts match any part of the document
|
|
26
27
|
#
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
# @return [Boolean] true if the hit matches
|
|
29
|
+
#
|
|
30
|
+
def matches?(all_parts: false)
|
|
31
|
+
cand = pubid
|
|
32
|
+
return false unless cand && same_document?(cand)
|
|
33
|
+
return true if all_parts || reference_partless?
|
|
34
|
+
|
|
35
|
+
Array(cand.parts).map(&:to_s) == reference_parts
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
#
|
|
34
|
-
#
|
|
39
|
+
# The hit's pubid identifier. `index-v2` rows are already deserialized to
|
|
40
|
+
# {Pubid::Jis::Identifier} via `pubid_class`; a Hash or String id is
|
|
41
|
+
# converted for robustness.
|
|
35
42
|
#
|
|
36
|
-
# @return [
|
|
43
|
+
# @return [Pubid::Jis::Identifier, nil] identifier, or nil when it cannot
|
|
44
|
+
# be built
|
|
37
45
|
#
|
|
38
|
-
def
|
|
39
|
-
@
|
|
46
|
+
def pubid
|
|
47
|
+
return @pubid if defined? @pubid
|
|
48
|
+
|
|
49
|
+
id = hit[:id]
|
|
50
|
+
@pubid = case id
|
|
51
|
+
when Hash then ::Pubid::Jis::Identifier.from_hash id
|
|
52
|
+
when String then ::Pubid::Jis::Identifier.parse id
|
|
53
|
+
else id
|
|
54
|
+
end
|
|
55
|
+
rescue StandardError
|
|
56
|
+
Util.warn "Unable to create an identifier from `#{hit[:id]}`"
|
|
57
|
+
@pubid = nil
|
|
40
58
|
end
|
|
41
59
|
|
|
42
60
|
# @return [Relaton::Jis::Item]
|
|
@@ -52,24 +70,23 @@ module Relaton
|
|
|
52
70
|
|
|
53
71
|
private
|
|
54
72
|
|
|
55
|
-
def
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
def reference
|
|
74
|
+
hit_collection.pubid
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Same document type, series and number as the reference.
|
|
78
|
+
def same_document?(cand)
|
|
79
|
+
cand.instance_of?(reference.class) &&
|
|
80
|
+
cand.series == reference.series &&
|
|
81
|
+
cand.number.to_s == reference.number.to_s
|
|
59
82
|
end
|
|
60
83
|
|
|
61
|
-
def
|
|
62
|
-
|
|
63
|
-
(ref_parts[:expl_num].nil? ||
|
|
64
|
-
ref_parts[:expl_num] == id_parts[:expl_num])
|
|
84
|
+
def reference_partless?
|
|
85
|
+
reference.parts.nil? || reference.parts.empty?
|
|
65
86
|
end
|
|
66
87
|
|
|
67
|
-
def
|
|
68
|
-
(
|
|
69
|
-
(ref_parts[:amd_num].nil? ||
|
|
70
|
-
ref_parts[:amd_num] == id_parts[:amd_num]) &&
|
|
71
|
-
(ref_parts[:amd_year].nil? ||
|
|
72
|
-
ref_parts[:amd_year] == id_parts[:amd_year])
|
|
88
|
+
def reference_parts
|
|
89
|
+
Array(reference.parts).map(&:to_s)
|
|
73
90
|
end
|
|
74
91
|
end
|
|
75
92
|
end
|
|
@@ -5,29 +5,39 @@ require_relative "hit"
|
|
|
5
5
|
module Relaton
|
|
6
6
|
module Jis
|
|
7
7
|
class HitCollection < Core::HitCollection
|
|
8
|
-
GH_URL = "https://raw.githubusercontent.com/relaton/relaton-data-jis/
|
|
8
|
+
GH_URL = "https://raw.githubusercontent.com/relaton/relaton-data-jis/v2/"
|
|
9
9
|
|
|
10
10
|
#
|
|
11
|
-
# Initialize hit collection
|
|
11
|
+
# Initialize hit collection.
|
|
12
12
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
13
|
+
# Searches the pubid-based `index-v2` for every entry sharing the
|
|
14
|
+
# reference's series and number (a supplement is filed under its base
|
|
15
|
+
# number, so editions and amendments come back together). Narrowing to a
|
|
16
|
+
# specific type/year/part happens later in {#find}.
|
|
16
17
|
#
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
# @param [Pubid::Jis::Identifier] pubid parsed reference
|
|
19
|
+
#
|
|
20
|
+
def initialize(pubid)
|
|
21
|
+
super(pubid, pubid.year&.to_s)
|
|
22
|
+
@array = index.search(pubid) { |row| same_base? row[:id] }
|
|
23
|
+
.map { |row| Hit.new row, self }
|
|
24
|
+
.sort_by { |hit| hit.pubid.to_s }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @return [Pubid::Jis::Identifier] parsed reference
|
|
28
|
+
def pubid
|
|
29
|
+
ref
|
|
20
30
|
end
|
|
21
31
|
|
|
22
32
|
#
|
|
23
|
-
# Find hit
|
|
33
|
+
# Find the best hit for the reference.
|
|
24
34
|
#
|
|
25
|
-
# @return [Relaton::Bib::ItemData, Array<
|
|
35
|
+
# @return [Relaton::Bib::ItemData, Array<Integer>] the matching item, or
|
|
36
|
+
# the list of available edition years when none match the requested year
|
|
26
37
|
#
|
|
27
38
|
def find
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
find_by_year ref_year
|
|
39
|
+
if pubid.year
|
|
40
|
+
find_by_year pubid.year
|
|
31
41
|
else
|
|
32
42
|
find_all_years
|
|
33
43
|
end
|
|
@@ -36,75 +46,81 @@ module Relaton
|
|
|
36
46
|
def find_by_year(ref_year)
|
|
37
47
|
missed_years = []
|
|
38
48
|
@array.each do |hit|
|
|
39
|
-
|
|
49
|
+
next unless hit.matches?
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
return hit.item if hit.pubid.year.to_s == ref_year.to_s
|
|
52
|
+
|
|
53
|
+
missed_years << hit.pubid.year
|
|
42
54
|
end
|
|
43
55
|
missed_years
|
|
44
56
|
end
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
58
|
+
# The main item is the latest edition of the requested type; every other
|
|
59
|
+
# candidate sharing the series and number (older editions, amendments,
|
|
60
|
+
# explanations) is attached as an `instanceOf` relation.
|
|
61
|
+
def find_all_years
|
|
62
|
+
editions = @array.select(&:matches?)
|
|
63
|
+
return [] if editions.empty?
|
|
49
64
|
|
|
50
|
-
item =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
next if hit.hit[:id] == item_id
|
|
65
|
+
item = editions.max_by { |hit| hit.pubid.year.to_i }.item
|
|
66
|
+
attach_relations item.to_most_recent_reference,
|
|
67
|
+
item.docidentifier.first.content
|
|
68
|
+
end
|
|
55
69
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
# The lowest-numbered part becomes the all-parts umbrella; every candidate
|
|
71
|
+
# sharing the series and number is attached as an `instanceOf` relation.
|
|
72
|
+
def find_all_parts
|
|
73
|
+
parts = @array.select { |hit| hit.matches? all_parts: true }
|
|
74
|
+
lowest = parts.min_by { |hit| hit.pubid.parts.first.to_i }
|
|
75
|
+
item = lowest.item.to_all_parts
|
|
76
|
+
attach_relations item, item.docidentifier.first.content
|
|
59
77
|
end
|
|
60
78
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
next if hit.
|
|
79
|
+
# Attach every candidate except `skip_id` to `umbrella` as an `instanceOf`
|
|
80
|
+
# relation and return the umbrella.
|
|
81
|
+
def attach_relations(umbrella, skip_id)
|
|
82
|
+
@array.each do |hit|
|
|
83
|
+
next if hit.pubid.to_s == skip_id
|
|
66
84
|
|
|
67
|
-
|
|
85
|
+
umbrella.relation << create_relation(hit)
|
|
68
86
|
end
|
|
69
|
-
|
|
87
|
+
umbrella
|
|
70
88
|
end
|
|
71
89
|
|
|
72
90
|
def create_relation(hit)
|
|
73
|
-
|
|
74
|
-
|
|
91
|
+
id = hit.pubid.to_s
|
|
92
|
+
docid = Docidentifier.new content: id, type: "JIS", primary: true
|
|
93
|
+
bibitem = ItemData.new(
|
|
94
|
+
formattedref: Bib::Formattedref.new(content: id),
|
|
95
|
+
docidentifier: [docid],
|
|
75
96
|
)
|
|
76
|
-
bibitem
|
|
77
|
-
|
|
97
|
+
Relation.new type: "instanceOf", bibitem: bibitem
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Index of pubid identifiers (`index-v2`), deserialized via `pubid_class`.
|
|
101
|
+
def index
|
|
102
|
+
@index ||= Relaton::Index.find_or_create(
|
|
103
|
+
:jis,
|
|
104
|
+
url: "#{GH_URL}#{INDEXFILE_V2}.zip",
|
|
105
|
+
file: "#{INDEXFILE_V2}.yaml",
|
|
106
|
+
pubid_class: ::Pubid::Jis::Identifier,
|
|
78
107
|
)
|
|
79
|
-
Bib::Relation.new(type: "instanceOf", bibitem: bibitem)
|
|
80
108
|
end
|
|
81
109
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
def
|
|
88
|
-
|
|
110
|
+
private
|
|
111
|
+
|
|
112
|
+
# Broad candidate filter: same series and number as the reference. For a
|
|
113
|
+
# supplement (amendment/corrigendum/explanation) the document series and
|
|
114
|
+
# number live on `base`, so compare against that.
|
|
115
|
+
def same_base?(candidate)
|
|
116
|
+
cand = base_of candidate
|
|
117
|
+
ours = base_of pubid
|
|
118
|
+
cand.series == ours.series && cand.number.to_s == ours.number.to_s
|
|
89
119
|
end
|
|
90
120
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
# @param [String] ref reference
|
|
95
|
-
#
|
|
96
|
-
# @return [Hash] hash with parts of reference
|
|
97
|
-
#
|
|
98
|
-
def parse_ref(ref)
|
|
99
|
-
%r{
|
|
100
|
-
^(?<code>\w+\s\w\s?\w+)
|
|
101
|
-
(?:-(?<part>\w+))?
|
|
102
|
-
(?::(?<year>\d{4}))?
|
|
103
|
-
(?:/(?<expl>EXPL(?:ANATION)?)(?:\s(?<expl_num>\d+))?)?
|
|
104
|
-
(?:/(?<amd>AMDENDMENT)(?:\s(?<amd_num>\d+)(?::(?<amd_year>\d{4}))?)?)?
|
|
105
|
-
}x =~ ref
|
|
106
|
-
{ code: code, part: part, year: year, expl: expl, expl_num: expl_num,
|
|
107
|
-
amd: amd, amd_num: amd_num, amd_year: amd_year }
|
|
121
|
+
def base_of(identifier)
|
|
122
|
+
supplement = identifier.respond_to?(:base) && identifier.base
|
|
123
|
+
supplement || identifier
|
|
108
124
|
end
|
|
109
125
|
end
|
|
110
126
|
end
|
data/lib/relaton/jis/scraper.rb
CHANGED
|
@@ -28,7 +28,7 @@ module Relaton
|
|
|
28
28
|
contributors << eg_contributor if eg_contributor
|
|
29
29
|
attrs = ATTRS.to_h { |attr| [attr, send("fetch_#{attr}")] }
|
|
30
30
|
attrs[:contributor] = contributors
|
|
31
|
-
|
|
31
|
+
ItemData.new(**attrs)
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def fetch_title
|
|
@@ -213,7 +213,7 @@ module Relaton
|
|
|
213
213
|
end
|
|
214
214
|
|
|
215
215
|
def fetch_structuredidentifier
|
|
216
|
-
|
|
216
|
+
StructuredIdentifier.new(
|
|
217
217
|
project_number: Iso::ProjectNumber.new(content: fetch_docnumber),
|
|
218
218
|
type: "JIS",
|
|
219
219
|
)
|
data/lib/relaton/jis/version.rb
CHANGED
data/lib/relaton/jis.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require "net/http"
|
|
4
4
|
require "mechanize"
|
|
5
|
+
require "pubid"
|
|
5
6
|
require "relaton/iso"
|
|
6
7
|
require "relaton/index"
|
|
7
8
|
require_relative "jis/version"
|
|
@@ -15,6 +16,8 @@ require_relative "jis/bibliography"
|
|
|
15
16
|
module Relaton
|
|
16
17
|
module Jis
|
|
17
18
|
INDEXFILE = "index-v1"
|
|
19
|
+
# Pubid-based index produced alongside index-v1 during the pubid migration.
|
|
20
|
+
INDEXFILE_V2 = "index-v2"
|
|
18
21
|
|
|
19
22
|
class Error < StandardError; end
|
|
20
23
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-jis
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0.pre.alpha.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: mechanize
|
|
@@ -24,48 +24,62 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '2.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: pubid
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 2.0.0.pre.alpha.3
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 2.0.0.pre.alpha.3
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: relaton-core
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
30
44
|
requirements:
|
|
31
45
|
- - "~>"
|
|
32
46
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
47
|
+
version: 2.2.0.pre.alpha.1
|
|
34
48
|
type: :runtime
|
|
35
49
|
prerelease: false
|
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
51
|
requirements:
|
|
38
52
|
- - "~>"
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
54
|
+
version: 2.2.0.pre.alpha.1
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: relaton-index
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
44
58
|
requirements:
|
|
45
59
|
- - "~>"
|
|
46
60
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
61
|
+
version: 2.2.0.pre.alpha.1
|
|
48
62
|
type: :runtime
|
|
49
63
|
prerelease: false
|
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
65
|
requirements:
|
|
52
66
|
- - "~>"
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
68
|
+
version: 2.2.0.pre.alpha.1
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: relaton-iso
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
58
72
|
requirements:
|
|
59
73
|
- - "~>"
|
|
60
74
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 2.
|
|
75
|
+
version: 2.2.0.pre.alpha.1
|
|
62
76
|
type: :runtime
|
|
63
77
|
prerelease: false
|
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
79
|
requirements:
|
|
66
80
|
- - "~>"
|
|
67
81
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 2.
|
|
82
|
+
version: 2.2.0.pre.alpha.1
|
|
69
83
|
description: 'Relaton::Jis: retrieve IETF Standards for bibliographic use using the
|
|
70
84
|
BibliographicItem model'
|
|
71
85
|
email:
|
|
@@ -75,17 +89,11 @@ extensions: []
|
|
|
75
89
|
extra_rdoc_files: []
|
|
76
90
|
files:
|
|
77
91
|
- ".rspec"
|
|
78
|
-
- ".rubocop.yml"
|
|
79
92
|
- CLAUDE.md
|
|
80
93
|
- Gemfile
|
|
81
94
|
- LICENSE.txt
|
|
82
95
|
- README.adoc
|
|
83
96
|
- Rakefile
|
|
84
|
-
- grammars/basicdoc.rng
|
|
85
|
-
- grammars/biblio-standoc.rng
|
|
86
|
-
- grammars/biblio.rng
|
|
87
|
-
- grammars/relaton-jis-compile.rng
|
|
88
|
-
- grammars/relaton-jis.rng
|
|
89
97
|
- lib/relaton/jis.rb
|
|
90
98
|
- lib/relaton/jis/bibdata.rb
|
|
91
99
|
- lib/relaton/jis/bibitem.rb
|
|
@@ -105,7 +113,6 @@ files:
|
|
|
105
113
|
- lib/relaton/jis/structured_identifier.rb
|
|
106
114
|
- lib/relaton/jis/util.rb
|
|
107
115
|
- lib/relaton/jis/version.rb
|
|
108
|
-
- relaton-jis.gemspec
|
|
109
116
|
- sig/relaton_jis.rbs
|
|
110
117
|
homepage: https://github.com/relaton/relaton-jis
|
|
111
118
|
licenses:
|
|
@@ -120,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
120
127
|
requirements:
|
|
121
128
|
- - ">="
|
|
122
129
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 3.
|
|
130
|
+
version: 3.3.0
|
|
124
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
132
|
requirements:
|
|
126
133
|
- - ">="
|
data/.rubocop.yml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# This project follows the Ribose OSS style guide.
|
|
2
|
-
# https://github.com/riboseinc/oss-guides
|
|
3
|
-
# All project-specific additions and overrides should be specified in this file.
|
|
4
|
-
|
|
5
|
-
require: rubocop-rails
|
|
6
|
-
|
|
7
|
-
inherit_from:
|
|
8
|
-
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
|
9
|
-
AllCops:
|
|
10
|
-
TargetRubyVersion: 3.2
|
|
11
|
-
Rails:
|
|
12
|
-
Enabled: false
|