relaton 3.1.1 → 3.1.2
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 +5 -3
- data/lib/relaton/3gpp.rb +1 -1
- data/lib/relaton/bib/model/docidentifier.rb +66 -5
- data/lib/relaton/calconnect/hit_collection.rb +1 -1
- data/lib/relaton/cli/frontend_assets.rb +7 -6
- data/lib/relaton/db.rb +31 -14
- data/lib/relaton/ecma/bibliography.rb +2 -2
- data/lib/relaton/etsi/data_fetcher.rb +1 -1
- data/lib/relaton/iala/bibliography.rb +1 -1
- data/lib/relaton/iana.rb +1 -1
- data/lib/relaton/iec/data_parser.rb +41 -2
- data/lib/relaton/itu/README.adoc +1 -1
- data/lib/relaton/itu/data_crawler_r.rb +1 -1
- data/lib/relaton/oasis/bibliography.rb +1 -1
- data/lib/relaton/ogc/hit_collection.rb +1 -1
- data/lib/relaton/ogc.rb +1 -1
- data/lib/relaton/plateau/handbook_parser.rb +31 -2
- data/lib/relaton/plateau/hit_collection.rb +1 -1
- data/lib/relaton/sae.rb +1 -1
- data/lib/relaton/version.rb +1 -1
- data/lib/relaton/w3c/bibliography.rb +1 -1
- data/lib/relaton/xsf/bibliography.rb +1 -1
- data/lib/relaton/xsf.rb +1 -1
- metadata +32 -46
- data/lib/relaton/3gpp/CLAUDE.md +0 -218
- data/lib/relaton/adobe/CLAUDE.md +0 -104
- data/lib/relaton/bib/CLAUDE.md +0 -150
- data/lib/relaton/bipm/CLAUDE.md +0 -187
- data/lib/relaton/bsi/CLAUDE.md +0 -35
- data/lib/relaton/calconnect/CLAUDE.md +0 -177
- data/lib/relaton/ccsds/CLAUDE.md +0 -74
- data/lib/relaton/cen/CLAUDE.md +0 -219
- data/lib/relaton/cie/CLAUDE.md +0 -90
- data/lib/relaton/core/CLAUDE.md +0 -140
- data/lib/relaton/db/CLAUDE.md +0 -385
- data/lib/relaton/doi/CLAUDE.md +0 -105
- data/lib/relaton/easc/CLAUDE.md +0 -85
- data/lib/relaton/ecma/CLAUDE.md +0 -217
- data/lib/relaton/etsi/CLAUDE.md +0 -219
- data/lib/relaton/evs/CLAUDE.md +0 -120
- data/lib/relaton/gb/CLAUDE.md +0 -47
- data/lib/relaton/gost/CLAUDE.md +0 -100
- data/lib/relaton/iala/CLAUDE.md +0 -97
- data/lib/relaton/iana/CLAUDE.md +0 -105
- data/lib/relaton/iec/CLAUDE.md +0 -13
- data/lib/relaton/ieee/CLAUDE.md +0 -202
- data/lib/relaton/ietf/CLAUDE.md +0 -382
- data/lib/relaton/iho/CLAUDE.md +0 -76
- data/lib/relaton/index/CLAUDE.md +0 -208
- data/lib/relaton/isbn/CLAUDE.md +0 -47
- data/lib/relaton/iso/CLAUDE.md +0 -38
- data/lib/relaton/itu/CLAUDE.md +0 -685
- data/lib/relaton/jcgm/CLAUDE.md +0 -107
- data/lib/relaton/jis/CLAUDE.md +0 -64
- data/lib/relaton/logger/CLAUDE.md +0 -37
- data/lib/relaton/nist/CLAUDE.md +0 -194
- data/lib/relaton/oasis/CLAUDE.md +0 -251
- data/lib/relaton/ogc/CLAUDE.md +0 -242
- data/lib/relaton/oiml/CLAUDE.md +0 -47
- data/lib/relaton/omg/CLAUDE.md +0 -137
- data/lib/relaton/plateau/CLAUDE.md +0 -126
- data/lib/relaton/sae/CLAUDE.md +0 -91
- data/lib/relaton/sdo/CLAUDE.md +0 -81
- data/lib/relaton/un/CLAUDE.md +0 -91
- data/lib/relaton/w3c/CLAUDE.md +0 -369
- data/lib/relaton/xsf/CLAUDE.md +0 -189
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4243253e77d9ff955bee5534bb5dd4dc8ace300c68b208d9ad04b0b0243468ff
|
|
4
|
+
data.tar.gz: a6737982c68329a90623a75dc407b78a8c6684373c8fe0b44e0b8a7a8bceeca9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3a28aa82a3b155f8222eb981cf814018539dd5b6ea4f33eb308ea034970b2670749cb778a7540767c6df7b526ffe61ed2aeb1d0f8186dfd8b121dd297d25a80
|
|
7
|
+
data.tar.gz: 4836365cff31ecc94cb9464d6c321fa8f7770d72bb40adfe963a163cd23b260a77297700596eab3c54d2eb54fbd1d76774786d4bda3f07b6765b461d4cf38f91
|
data/README.adoc
CHANGED
|
@@ -6,8 +6,8 @@ image:https://github.com/relaton/relaton/actions/workflows/rake.yml/badge.svg["B
|
|
|
6
6
|
Gem for importing and caching bibliographic references to technical standards.
|
|
7
7
|
Every standards-body flavor ships inside this single gem; flavor code loads on
|
|
8
8
|
demand via `autoload`, and the `Relaton::Db` API routes a reference to the right
|
|
9
|
-
flavor by its prefix. The command-line interface
|
|
10
|
-
|
|
9
|
+
flavor by its prefix. The command-line interface (the `relaton` executable) and
|
|
10
|
+
the citation renderer ship inside this gem too.
|
|
11
11
|
|
|
12
12
|
== Installation
|
|
13
13
|
|
|
@@ -482,10 +482,12 @@ lib/
|
|
|
482
482
|
├── db.rb, db/ # Relaton::Db: registry, cache, workers pool
|
|
483
483
|
├── core/ bib/ index/ logger/ # shared infrastructure
|
|
484
484
|
├── sdo/ # Relaton.organization: SDO org/logo store (non-flavor)
|
|
485
|
+
├── cli/ # the CLI: commands, convertors, frontend/ (+ bin/relaton)
|
|
486
|
+
├── render/ # the citation renderer (ISO 690 engine + styles)
|
|
485
487
|
└── iso/ iec/ ietf/ … 3gpp/ # ~29 flavor plugins
|
|
486
488
|
spec/<flavor>/ # each flavor's spec suite
|
|
489
|
+
docs/ # per-component architecture notes (docs/<name>.md)
|
|
487
490
|
grammar/ # shared RelaxNG test schemas (test-only, not shipped)
|
|
488
|
-
gems/relaton-cli/ # the separate relaton-cli gem
|
|
489
491
|
----
|
|
490
492
|
|
|
491
493
|
== Flavors
|
data/lib/relaton/3gpp.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require "net/http"
|
|
2
2
|
# pubid loads with the flavor, for the ::Pubid::Tgpp::Identifier that the
|
|
3
3
|
# index code names. Processor#remove_index_file names no pubid class: the
|
|
4
|
-
# delete never reads the index (see
|
|
4
|
+
# delete never reads the index (see docs/index.md).
|
|
5
5
|
require "pubid"
|
|
6
6
|
require_relative "index"
|
|
7
7
|
require_relative "core"
|
|
@@ -66,6 +66,54 @@ module Relaton
|
|
|
66
66
|
"BSI" => :Bsi,
|
|
67
67
|
}.freeze
|
|
68
68
|
|
|
69
|
+
# The :slug form's type → pubid flavor map (relaton#441): every
|
|
70
|
+
# docidentifier type whose pubid flavor has a landed pubid-scheme
|
|
71
|
+
# URN schema (pubid#656). Unlike FORM_PUBID — which gates only the
|
|
72
|
+
# SDO publisher forms and stays deliberately small — this table
|
|
73
|
+
# grows with the pubid URN coverage: the slug is the lossless
|
|
74
|
+
# pubid-scheme URN in path clothes, so there is no publisher-form
|
|
75
|
+
# policy in the decision, only "can this flavor emit a
|
|
76
|
+
# round-trippable slug". Every row was verified end-to-end at
|
|
77
|
+
# adoption: parse → Pubid.to_slug → Pubid.from_slug → equal hash.
|
|
78
|
+
# A type absent here degrades to the stored content.
|
|
79
|
+
SLUG_PUBID = {
|
|
80
|
+
"ISO" => :Iso,
|
|
81
|
+
"IEC" => :Iec,
|
|
82
|
+
"IEEE" => :Ieee,
|
|
83
|
+
"IHO" => :Iho,
|
|
84
|
+
"ITU-T" => :Itu,
|
|
85
|
+
"ITU-R" => :Itu,
|
|
86
|
+
"ITU" => :Itu,
|
|
87
|
+
"W3C" => :W3c,
|
|
88
|
+
"3GPP" => :Tgpp,
|
|
89
|
+
"OGC" => :Ogc,
|
|
90
|
+
"OASIS" => :Oasis,
|
|
91
|
+
"OMG" => :Omg,
|
|
92
|
+
"UN" => :Un,
|
|
93
|
+
"XEP" => :Xsf,
|
|
94
|
+
"EVS" => :Evs,
|
|
95
|
+
"CCSDS" => :Ccsds,
|
|
96
|
+
"CEN" => :CenCenelec,
|
|
97
|
+
"BIPM" => :Bipm,
|
|
98
|
+
"CalConnect" => :Calconnect,
|
|
99
|
+
"ECMA" => :Ecma,
|
|
100
|
+
"GB" => :Gb,
|
|
101
|
+
"IANA" => :Iana,
|
|
102
|
+
"NIST" => :Nist,
|
|
103
|
+
"BSI" => :Bsi,
|
|
104
|
+
"IETF" => :Ietf,
|
|
105
|
+
"Internet-Draft" => :Ietf,
|
|
106
|
+
"GOST" => :Gost,
|
|
107
|
+
"JCGM" => :Jcgm,
|
|
108
|
+
"OIML" => :Oiml,
|
|
109
|
+
"SAE" => :Sae,
|
|
110
|
+
"IALA" => :Iala,
|
|
111
|
+
"EASC" => :Easc,
|
|
112
|
+
"DOI" => :Doi,
|
|
113
|
+
"ISBN" => :Isbn,
|
|
114
|
+
"JIS" => :Jis,
|
|
115
|
+
}.freeze
|
|
116
|
+
|
|
69
117
|
FORMS = %i[external internal slug].freeze
|
|
70
118
|
|
|
71
119
|
# The parsed identifier. A pubid-backed flavor subclass overrides it.
|
|
@@ -88,12 +136,25 @@ module Relaton
|
|
|
88
136
|
|
|
89
137
|
private
|
|
90
138
|
|
|
91
|
-
# pubid renders the form (`to_s(with_publisher:)`, pubid#620)
|
|
92
|
-
#
|
|
93
|
-
#
|
|
139
|
+
# pubid renders the form (`to_s(with_publisher:)`, pubid#620); the
|
|
140
|
+
# :slug form renders through the flavor's pubid-scheme URN schema.
|
|
141
|
+
# A docidentifier with a parsed pubid (a flavor subclass) uses it;
|
|
142
|
+
# a plain `Bib::Docidentifier` is parsed through the form's flavor
|
|
143
|
+
# table — FORM_PUBID for the publisher forms, SLUG_PUBID for :slug
|
|
144
|
+
# (relaton#441). Content pubid cannot parse is returned unchanged.
|
|
94
145
|
def form_content(form)
|
|
95
|
-
flavor = FORM_PUBID[type]
|
|
96
|
-
|
|
146
|
+
flavor = form == :slug ? SLUG_PUBID[type] : FORM_PUBID[type]
|
|
147
|
+
# :slug takes a parsed pubid from anywhere — the slug is the
|
|
148
|
+
# pubid-scheme URN, publisher policy plays no part in it. The
|
|
149
|
+
# publisher forms keep the FORM_PUBID gate: a type outside the
|
|
150
|
+
# table answers its stored content (relaton#49), even when a
|
|
151
|
+
# subclass carries a parsed pubid.
|
|
152
|
+
id =
|
|
153
|
+
if form == :slug
|
|
154
|
+
pubid || (flavor && parse_form_pubid(flavor))
|
|
155
|
+
else
|
|
156
|
+
flavor && (pubid || parse_form_pubid(flavor))
|
|
157
|
+
end
|
|
97
158
|
return content unless id
|
|
98
159
|
|
|
99
160
|
return slug_form(id) if form == :slug
|
|
@@ -66,7 +66,7 @@ module Relaton::Calconnect
|
|
|
66
66
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
67
67
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
68
68
|
# `"..." is not a recognized standards identifier`
|
|
69
|
-
# (`
|
|
69
|
+
# (`lib/relaton/cli/command.rb`), and `Db#fetch`
|
|
70
70
|
# logs it through the `StandardError` arm at `lib/relaton/db.rb:122`.
|
|
71
71
|
# Rescuing here would collapse "this identifier is malformed" into "no
|
|
72
72
|
# such document", leaving a caller unable to tell them apart.
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
module Relaton
|
|
2
2
|
module Cli
|
|
3
|
-
# Resolves the compiled frontend bundle (`app.iife.js` + `style.css`)
|
|
4
|
-
#
|
|
5
|
-
# the gem under `frontend/dist/`. Both the installed gem
|
|
6
|
-
# place `frontend/dist` at the gem root, so one relative
|
|
3
|
+
# Resolves the compiled frontend bundle (`app.iife.js` + `style.css`) whose
|
|
4
|
+
# source lives at `lib/relaton/cli/frontend/` and whose built dist is
|
|
5
|
+
# committed inside the gem under `frontend/dist/`. Both the installed gem
|
|
6
|
+
# and a git checkout place `frontend/dist` at the gem root, so one relative
|
|
7
|
+
# path covers both.
|
|
7
8
|
#
|
|
8
9
|
# If the bundle is missing (a fresh checkout that hasn't run the frontend
|
|
9
10
|
# build), raise a clear, actionable error rather than emitting a broken page.
|
|
@@ -47,8 +48,8 @@ module Relaton
|
|
|
47
48
|
unless File.exist?(path)
|
|
48
49
|
raise BuildMissingError,
|
|
49
50
|
"Frontend build missing (#{name} not found in #{dist_dir}). " \
|
|
50
|
-
"Run `bundle exec rake build_frontend`
|
|
51
|
-
"(or `cd frontend && npm install && npm run build`) first."
|
|
51
|
+
"Run `bundle exec rake spec:build_frontend` at the repo root " \
|
|
52
|
+
"(or `cd lib/relaton/cli/frontend && npm install && npm run build`) first."
|
|
52
53
|
end
|
|
53
54
|
File.read(path, encoding: "utf-8")
|
|
54
55
|
end
|
data/lib/relaton/db.rb
CHANGED
|
@@ -553,18 +553,29 @@ module Relaton
|
|
|
553
553
|
end
|
|
554
554
|
|
|
555
555
|
#
|
|
556
|
-
# A publication date range selects among
|
|
557
|
-
#
|
|
558
|
-
#
|
|
559
|
-
#
|
|
556
|
+
# A publication date range selects among editions of the reference. The
|
|
557
|
+
# answer must depend on the citing document's cutoff, never on the order
|
|
558
|
+
# in which parallel workers happen to populate the cache: the edition
|
|
559
|
+
# pool visible to any one worker is whatever earlier workers fetched for
|
|
560
|
+
# their own cutoffs, so answering from that pool is nondeterministic
|
|
561
|
+
# (metanorma#659). A ranged answer is therefore cached under a key that
|
|
562
|
+
# names the range and a hit on it is authoritative; the unqualified
|
|
563
|
+
# query row is never written by a ranged fetch, so it keeps pointing at
|
|
564
|
+
# the latest edition.
|
|
560
565
|
#
|
|
561
|
-
def
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
566
|
+
def range_cache_key(key, opts)
|
|
567
|
+
bounds = [opts[:publication_date_before] && "before=#{opts[:publication_date_before]}",
|
|
568
|
+
opts[:publication_date_after] && "after=#{opts[:publication_date_after]}"]
|
|
569
|
+
.compact
|
|
570
|
+
bounds.empty? ? nil : "#{key}@range:#{bounds.join(',')}"
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
def check_date_range(code, key, year, opts, stdclass, query = nil)
|
|
574
|
+
qualified = range_cache_key(key, opts)
|
|
575
|
+
unless opts[:no_cache]
|
|
576
|
+
hit = [@local_db, @db].compact.filter_map { |c| c.read(qualified) }.first
|
|
577
|
+
return bib_retval(hit, stdclass) if hit
|
|
578
|
+
end
|
|
568
579
|
return if opts[:fetch_db]
|
|
569
580
|
|
|
570
581
|
processor = @registry[stdclass]
|
|
@@ -574,9 +585,15 @@ module Relaton
|
|
|
574
585
|
|
|
575
586
|
entry = bib_entry bib
|
|
576
587
|
item = item_key(bib, stdclass)
|
|
577
|
-
|
|
578
|
-
@
|
|
579
|
-
|
|
588
|
+
@semaphore.synchronize do
|
|
589
|
+
[@local_db, @db].compact.each do |c|
|
|
590
|
+
# A ranged answer that carries no edition of its own is the
|
|
591
|
+
# undated form: storing it would overwrite the unqualified query
|
|
592
|
+
# row (whose contract is the latest edition), so only a genuinely
|
|
593
|
+
# dated answer may write its own row.
|
|
594
|
+
link = item if item && item != key
|
|
595
|
+
c.store item, entry if link
|
|
596
|
+
c.store qualified, entry, item_key: link if qualified
|
|
580
597
|
end
|
|
581
598
|
end
|
|
582
599
|
bib_retval entry, stdclass
|
|
@@ -38,7 +38,7 @@ module Relaton
|
|
|
38
38
|
# answer is worse than none. By the same trade-off, a reference must now
|
|
39
39
|
# parse WHOLE: the old regex was unanchored at the end, so
|
|
40
40
|
# `ECMA-6 (draft)` silently resolved to ECMA-6 and now does not. See
|
|
41
|
-
#
|
|
41
|
+
# docs/ecma.md for the measured table.
|
|
42
42
|
#
|
|
43
43
|
# The rows are selected with pubid's subset match `pubid === row`, the
|
|
44
44
|
# default of `Index::Type#search`. An `edition` or a `volume` that the
|
|
@@ -73,7 +73,7 @@ module Relaton
|
|
|
73
73
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
74
74
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
75
75
|
# `"..." is not a recognized standards identifier`
|
|
76
|
-
# (`
|
|
76
|
+
# (`lib/relaton/cli/command.rb`), and `Db#fetch`
|
|
77
77
|
# logs it through the `StandardError` arm at `lib/relaton/db.rb:122`.
|
|
78
78
|
# Rescuing here would collapse "this identifier is malformed" into "no
|
|
79
79
|
# such document", leaving a caller unable to tell them apart.
|
|
@@ -16,7 +16,7 @@ module Relaton
|
|
|
16
16
|
# status flags below are a separate axis and already permissive, so this
|
|
17
17
|
# is what makes e.g. all three editions of `ETSI EN 319 142-1` retrievable
|
|
18
18
|
# instead of one. It also makes the crawl about 2.4 times larger — see
|
|
19
|
-
#
|
|
19
|
+
# docs/etsi.md before changing it back.
|
|
20
20
|
SOURCEURL = "https://www.etsi.org/custom/standardssearch/data.php?format=json&includeScope=1&" \
|
|
21
21
|
"page=%<page>s&search=&title=1&etsiNumber=1&content=1&version=1&onApproval=1&published=1&" \
|
|
22
22
|
"withdrawn=1&historical=1&isCurrent=1&superseded=1&startDate=1988-01-15&endDate=%<date>s&" \
|
|
@@ -120,7 +120,7 @@ module Relaton
|
|
|
120
120
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
121
121
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
122
122
|
# `"..." is not a recognized standards identifier`
|
|
123
|
-
# (`
|
|
123
|
+
# (`lib/relaton/cli/command.rb`), and `Db#fetch`
|
|
124
124
|
# logs it through the `StandardError` arm at `lib/relaton/db.rb:122`.
|
|
125
125
|
# Rescuing here would collapse "this identifier is malformed" into "no
|
|
126
126
|
# such document", leaving a caller unable to tell them apart.
|
data/lib/relaton/iana.rb
CHANGED
|
@@ -25,7 +25,7 @@ module Relaton
|
|
|
25
25
|
# The legacy string-keyed `index-v1` (whose `:id` was the bare
|
|
26
26
|
# `registry[/sub-registry]` slug) is no longer produced or read here; it is
|
|
27
27
|
# emitted by `relaton-data-iana`'s own `crawler.rb`, derived from `index-v2`,
|
|
28
|
-
# so released gem lines keep resolving. See
|
|
28
|
+
# so released gem lines keep resolving. See docs/iana.md.
|
|
29
29
|
INDEXFILE = "index-v2".freeze
|
|
30
30
|
# The machine index on the data repo's Pages site (relaton#206) —
|
|
31
31
|
# manifest + per-shard rows read by the consumer's index; the zip stays
|
|
@@ -5,6 +5,29 @@ module Relaton
|
|
|
5
5
|
|
|
6
6
|
DOMAIN = "https://webstore.iec.ch"
|
|
7
7
|
|
|
8
|
+
# The Harmonized API serves published records with a status WORD;
|
|
9
|
+
# the harmonized stage system (ISO/IEC Directives Part 1) wants the
|
|
10
|
+
# numeric code (relaton#519). 60.60 is "International Standard
|
|
11
|
+
# published". The four end-of-life words all sit at 95.99
|
|
12
|
+
# "Withdrawal of International Standard": by the time the API
|
|
13
|
+
# serves REVISED/REPLACED/MERGED the newer record is already
|
|
14
|
+
# published and this edition is withdrawn - 90.92 ("to be
|
|
15
|
+
# revised") is a review-DECISION state that never persists into a
|
|
16
|
+
# bibliographic record, and ISO's own corpus records superseded
|
|
17
|
+
# editions at 95.99 with no stage-90 records at all
|
|
18
|
+
# (metanorma-iso#1067 wants IEC to match ISO's treatment). The
|
|
19
|
+
# original word rides along in ext.stagename, so the mapping is
|
|
20
|
+
# reversible at render time. An unmapped word raises: the table is
|
|
21
|
+
# the contract, and a new API word is a spec change to make
|
|
22
|
+
# deliberately, not silently.
|
|
23
|
+
HARMONIZED_STATUS = {
|
|
24
|
+
"PUBLISHED" => %w[60 60],
|
|
25
|
+
"REVISED" => %w[95 99],
|
|
26
|
+
"REPLACED" => %w[95 99],
|
|
27
|
+
"WITHDRAWN" => %w[95 99],
|
|
28
|
+
"MERGED" => %w[95 99],
|
|
29
|
+
}.freeze
|
|
30
|
+
|
|
8
31
|
ATTRS = %i[
|
|
9
32
|
type docidentifier language script title date contributor
|
|
10
33
|
status edition abstract copyright source relation place ext
|
|
@@ -143,8 +166,15 @@ module Relaton
|
|
|
143
166
|
|
|
144
167
|
def status
|
|
145
168
|
result = begin
|
|
146
|
-
|
|
147
|
-
|
|
169
|
+
code = HARMONIZED_STATUS.fetch(@pub["status"]) do
|
|
170
|
+
raise ArgumentError,
|
|
171
|
+
"unknown Harmonized API status word: #{@pub["status"].inspect} - " \
|
|
172
|
+
"extend DataParser::HARMONIZED_STATUS"
|
|
173
|
+
end
|
|
174
|
+
Bib::Status.new(
|
|
175
|
+
stage: Bib::Status::Stage.new(content: code[0]),
|
|
176
|
+
substage: Bib::Status::Stage.new(content: code[1]),
|
|
177
|
+
)
|
|
148
178
|
end
|
|
149
179
|
@errors[:status] &&= result.nil?
|
|
150
180
|
result
|
|
@@ -353,11 +383,20 @@ module Relaton
|
|
|
353
383
|
flavor: "iec",
|
|
354
384
|
ics: ics,
|
|
355
385
|
price_code: @pub.dig("priceInfo", "priceCode"),
|
|
386
|
+
stagename: stagename,
|
|
356
387
|
)
|
|
357
388
|
@errors[:ext] &&= result.nil?
|
|
358
389
|
result
|
|
359
390
|
end
|
|
360
391
|
|
|
392
|
+
# The Harmonized API's status word, kept beside the numeric stage
|
|
393
|
+
# code it mapped to (relaton#519) - ext.stagename is where the IHO
|
|
394
|
+
# and ISO flavors keep the SDO's own stage vocabulary too.
|
|
395
|
+
def stagename
|
|
396
|
+
word = @pub["status"]
|
|
397
|
+
StageName.new(abbreviation: word, content: word) if word
|
|
398
|
+
end
|
|
399
|
+
|
|
361
400
|
#
|
|
362
401
|
# Parse structured identifier.
|
|
363
402
|
#
|
data/lib/relaton/itu/README.adoc
CHANGED
|
@@ -175,7 +175,7 @@ RelatonItu uses the relaton-logger gem for logging. By default, it logs to STDOU
|
|
|
175
175
|
|
|
176
176
|
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.
|
|
177
177
|
|
|
178
|
-
The index test fixture (used by tests) is a trimmed copy of the published pubid-structured `index-v2.zip` (rows are `_type: pubid:itu:…` hashes) from the `main` branch of the combined https://github.com/relaton/relaton-data-itu[relaton-data-itu] repository, kept at `spec/fixtures/index-v2.zip`. Refresh it with the regeneration snippet in `
|
|
178
|
+
The index test fixture (used by tests) is a trimmed copy of the published pubid-structured `index-v2.zip` (rows are `_type: pubid:itu:…` hashes) from the `main` branch of the combined https://github.com/relaton/relaton-data-itu[relaton-data-itu] repository, kept at `spec/fixtures/index-v2.zip`. Refresh it with the regeneration snippet in `docs/itu.md` (it must deserialize under the pinned pubid).
|
|
179
179
|
|
|
180
180
|
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).
|
|
181
181
|
|
|
@@ -41,7 +41,7 @@ module Relaton
|
|
|
41
41
|
# the rate is set by a shared `Relaton::Core::Pacer` — `delay:` is the
|
|
42
42
|
# minimum gap between request *starts*, so ITU's own latency counts toward it
|
|
43
43
|
# instead of being added on top. A `Relaton::Itu::Governor` gives the pool one
|
|
44
|
-
# shared cooldown for a WAF block. See `#get` and
|
|
44
|
+
# shared cooldown for a WAF block. See `#get` and docs/itu.md.
|
|
45
45
|
# The crawl is parallel **within** a series only: `DataFetcher#harvest_family`
|
|
46
46
|
# rescues per series and `DataMergeR` writes per series, and the data repo's
|
|
47
47
|
# collapse guard is calibrated on that granularity.
|
|
@@ -109,7 +109,7 @@ module Relaton
|
|
|
109
109
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
110
110
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
111
111
|
# `"..." is not a recognized standards identifier`
|
|
112
|
-
# (`
|
|
112
|
+
# (`lib/relaton/cli/command.rb`), and `Db#fetch`
|
|
113
113
|
# logs it through the `StandardError` arm at `lib/relaton/db.rb:122`.
|
|
114
114
|
# Rescuing here would collapse "this identifier is malformed" into "no
|
|
115
115
|
# such document", leaving a caller unable to tell them apart.
|
|
@@ -104,7 +104,7 @@ module Relaton
|
|
|
104
104
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
105
105
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
106
106
|
# `"..." is not a recognized standards identifier`
|
|
107
|
-
# (`
|
|
107
|
+
# (`lib/relaton/cli/command.rb`), and `Db#fetch`
|
|
108
108
|
# logs it through the `StandardError` arm at `lib/relaton/db.rb:122`.
|
|
109
109
|
# Rescuing here would collapse "this identifier is malformed" into "no
|
|
110
110
|
# such document", leaving a caller unable to tell them apart.
|
data/lib/relaton/ogc.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pubid loads with the flavor, for the ::Pubid::Ogc::Identifier that the
|
|
2
2
|
# index code names. Processor#remove_index_file names no pubid class: the
|
|
3
|
-
# delete never reads the index (see
|
|
3
|
+
# delete never reads the index (see docs/index.md).
|
|
4
4
|
require "pubid"
|
|
5
5
|
require_relative "index"
|
|
6
6
|
require_relative "iso"
|
|
@@ -24,12 +24,41 @@ module Relaton
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def slug_number
|
|
27
|
-
@slug_number ||=
|
|
27
|
+
@slug_number ||= mapped_docnumber&.[](/#(\S+)/, 1) ||
|
|
28
|
+
@entry["slug"]&.to_s&.split("_")&.first
|
|
28
29
|
end
|
|
29
30
|
|
|
30
31
|
def parse_docnumber
|
|
31
32
|
@errors[:hb_docnumber] &&= @entry["slug"].nil? || @entry["slug"].to_s.empty?
|
|
32
|
-
|
|
33
|
+
mapped_docnumber ||
|
|
34
|
+
["Handbook ##{slug_number}", edition_label].reject { |s| s.to_s.empty? }.join(" ")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Part label of a split edition, e.g. "(公共活用編)". Editions 1-3 of
|
|
38
|
+
# Handbook #11 were two documents each (relaton-plateau#13).
|
|
39
|
+
def part_label
|
|
40
|
+
@version["title"].to_s[/([^()]+活用編)/]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# The canonical docnumber of a split edition, mapped by pubid's
|
|
44
|
+
# update_codes ("Handbook #11 第1.0版(公共活用編)" -> "Handbook #04
|
|
45
|
+
# 第1.0版"), or nil for an edition that is not split.
|
|
46
|
+
def mapped_docnumber
|
|
47
|
+
return @mapped_docnumber if defined? @mapped_docnumber
|
|
48
|
+
|
|
49
|
+
@mapped_docnumber = if part_label
|
|
50
|
+
slug = @entry["slug"]&.to_s&.split("_")&.first
|
|
51
|
+
raw = "PLATEAU Handbook ##{slug} #{edition_label}#{part_label}"
|
|
52
|
+
map_docnumber(raw)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def map_docnumber(raw)
|
|
57
|
+
id = ::Pubid::Plateau.parse(raw).to_s
|
|
58
|
+
id.delete_prefix("PLATEAU ") unless id == raw
|
|
59
|
+
rescue ArgumentError, ::Pubid::Errors::Error => e
|
|
60
|
+
Util.warn "Cannot map split edition `#{raw}`: #{e.message}"
|
|
61
|
+
nil
|
|
33
62
|
end
|
|
34
63
|
|
|
35
64
|
def parse_abstract
|
|
@@ -43,7 +43,7 @@ module Relaton
|
|
|
43
43
|
# parse — pubid normalizes Latin input to the canonical id
|
|
44
44
|
# (metanorma/pubid #269) — so search accepts both forms. An unrecognized
|
|
45
45
|
# reference raises; like ISO and 3GPP we let it propagate — relaton-cli
|
|
46
|
-
# rescues Pubid::Errors::Error. See
|
|
46
|
+
# rescues Pubid::Errors::Error. See docs/plateau.md.
|
|
47
47
|
# Relaton::Db passes the reference already parsed (relaton#205).
|
|
48
48
|
def pubid_ref
|
|
49
49
|
@pubid_ref ||= ref.is_a?(String) ? ::Pubid::Plateau.parse(ref) : ref
|
data/lib/relaton/sae.rb
CHANGED
|
@@ -10,7 +10,7 @@ require_relative "version"
|
|
|
10
10
|
# deposits instead: every SAE standard edition has its own DOI
|
|
11
11
|
# (`10.4271/j3016_202104`). `DataFetcher` crawls them into the
|
|
12
12
|
# `relaton-data-sae` data repo with a pubid `index-v2`, and `Bibliography`
|
|
13
|
-
# reads that index. See
|
|
13
|
+
# reads that index. See docs/sae.md.
|
|
14
14
|
module Relaton
|
|
15
15
|
module Sae
|
|
16
16
|
INDEXFILE = "index-v2".freeze
|
data/lib/relaton/version.rb
CHANGED
|
@@ -133,7 +133,7 @@ module Relaton
|
|
|
133
133
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
134
134
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
135
135
|
# `"..." is not a recognized standards identifier`
|
|
136
|
-
# (`
|
|
136
|
+
# (`lib/relaton/cli/command.rb`), and `Db#fetch`
|
|
137
137
|
# logs it through the `StandardError` arm at `lib/relaton/db.rb:122`.
|
|
138
138
|
# Rescuing here would collapse "this identifier is malformed" into "no
|
|
139
139
|
# such document", leaving a caller unable to tell them apart.
|
|
@@ -15,7 +15,7 @@ module Relaton
|
|
|
15
15
|
# An unrecognized reference **raises**; like ISO, ETSI and 3GPP we let it
|
|
16
16
|
# propagate. relaton-cli rescues `Pubid::Errors::Error` and renders
|
|
17
17
|
# `"..." is not a recognized standards identifier`
|
|
18
|
-
# (`
|
|
18
|
+
# (`lib/relaton/cli/command.rb`,
|
|
19
19
|
# `subcommand_collection.rb:134`), and `Db#fetch` logs it via the
|
|
20
20
|
# `StandardError` arm at `lib/relaton/db.rb:122`. Rescuing here would
|
|
21
21
|
# collapse "this identifier is malformed" into "no such document", and a
|
data/lib/relaton/xsf.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require "mechanize"
|
|
4
4
|
# pubid loads with the flavor, for the ::Pubid::Xsf::Identifier that the
|
|
5
5
|
# index code names. Processor#remove_index_file names no pubid class: the
|
|
6
|
-
# delete never reads the index (see
|
|
6
|
+
# delete never reads the index (see docs/index.md).
|
|
7
7
|
require "pubid"
|
|
8
8
|
require_relative "index"
|
|
9
9
|
require_relative "bib"
|