pubid 2.0.55 → 2.0.57
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/data/iec/stage-codes.md +13 -0
- data/data/parg/bsi_pfs.json +1 -1
- data/data/parg/calconnect_pfs.json +1 -1
- data/data/parg/cen_pfs.json +1 -1
- data/data/parg/doi_pfs.json +1 -1
- data/data/parg/etsi_pfs.json +1 -1
- data/data/parg/iho.json +1 -1
- data/data/parg/iho.parg +24 -17
- data/lib/pubid/bsi_pfs/builder.rb +16 -2
- data/lib/pubid/bsi_pfs/identifiers/standalone_amendment.rb +31 -0
- data/lib/pubid/bsi_pfs/identifiers.rb +1 -0
- data/lib/pubid/bsi_pfs/pubid_urn_schema.rb +1 -0
- data/lib/pubid/bsi_pfs/renderer.rb +7 -5
- data/lib/pubid/bsi_pfs/urn.adoc +15 -6
- data/lib/pubid/bsi_pfs.rb +2 -2
- data/lib/pubid/calconnect_pfs.rb +1 -1
- data/lib/pubid/cen_pfs/builder.rb +4 -0
- data/lib/pubid/cen_pfs/identifier.rb +12 -8
- data/lib/pubid/cen_pfs/identifiers/adopted_european_norm.rb +4 -6
- data/lib/pubid/cen_pfs/identifiers/european_prestandard.rb +4 -6
- data/lib/pubid/cen_pfs.rb +1 -1
- data/lib/pubid/doi_pfs.rb +1 -1
- data/lib/pubid/etsi_pfs.rb +1 -1
- data/lib/pubid/iala/urn.adoc +1 -0
- data/lib/pubid/iec/CLAUDE.md +4 -0
- data/lib/pubid/iec/identifier.rb +55 -0
- data/lib/pubid/iec/identifiers/consolidated_identifier.rb +35 -0
- data/lib/pubid/iec/identifiers/international_standard.rb +7 -1
- data/lib/pubid/iec/identifiers/technical_report.rb +5 -1
- data/lib/pubid/iec/identifiers/technical_specification.rb +5 -1
- data/lib/pubid/iec/identifiers/vap_identifier.rb +28 -0
- data/lib/pubid/iec/supplement_identifier.rb +19 -0
- data/lib/pubid/iec/urn.adoc +18 -1
- data/lib/pubid/iho/CLAUDE.md +42 -18
- data/lib/pubid/iho/identifiers/base.rb +50 -3
- data/lib/pubid/iho/identifiers/bathymetric.rb +18 -0
- data/lib/pubid/iho/identifiers/capacity_building.rb +25 -0
- data/lib/pubid/iho/identifiers.rb +2 -2
- data/lib/pubid/iho/pubid_urn_schema.rb +2 -2
- data/lib/pubid/iho/urn.adoc +30 -13
- data/lib/pubid/iho/urn_generator.rb +30 -83
- data/lib/pubid/iho/urn_parser.rb +17 -12
- data/lib/pubid/version.rb +1 -1
- data/lib/tasks/pfs.rake +112 -0
- metadata +6 -4
- data/lib/pubid/iho/identifiers/bibliographic.rb +0 -16
- data/lib/pubid/iho/identifiers/circular_letter.rb +0 -15
data/lib/pubid/iho/CLAUDE.md
CHANGED
|
@@ -134,8 +134,8 @@ Section 400` ≡ `IHO S-4 B-400` (one identity, two spellings).
|
|
|
134
134
|
spelled section becomes `spec` alone, and beside a citation it only
|
|
135
135
|
cross-checks the citation's derived section — "Section 500, B-401"
|
|
136
136
|
raises) and the BARE `B-401` (implicit S-4 anchor; B only — bare
|
|
137
|
-
C-x stays the
|
|
138
|
-
shape keeps the B
|
|
137
|
+
C-x stays the C Capacity Building series, and the 3-digit `[1-6]xx`
|
|
138
|
+
shape keeps the B Bathymetric series (B-12) on the main branch).
|
|
139
139
|
`IHO B-401` (publisher + bare) parses to the spec too.
|
|
140
140
|
- **The anchor is load-bearing**: a spec citation requires the S-4
|
|
141
141
|
anchor (series S number 4 — the builder raises otherwise), a
|
|
@@ -179,16 +179,24 @@ The full scheme documentation lives in `lib/pubid/iho/urn.adoc` (the
|
|
|
179
179
|
per-flavor home of the former `docs/URN-SCHEMES.adoc` iho section; the
|
|
180
180
|
owner's per-flavor split ruling of 2026-11-25). The laws:
|
|
181
181
|
|
|
182
|
-
- **The
|
|
183
|
-
(`urn:mrn:iho:pub:<type>:<name>[:<edition>][:trailing...]`)
|
|
184
|
-
|
|
185
|
-
`
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
182
|
+
- **The emission of every series is the IHO MRN guidance form**
|
|
183
|
+
(`urn:mrn:iho:pub:<type>:<name>[:<edition>][:trailing...]`); the
|
|
184
|
+
five series bind 1:1 onto the guidance's five publication type
|
|
185
|
+
codes — `spec` (S), `per` (P), `reg` (M), `bathy` (B Bathymetric
|
|
186
|
+
Publications), `cb` (C Capacity Building Publications). The B/C
|
|
187
|
+
bindings cite IHO S-11 Part C Ed 1.0.0 section 1.2, which arranges
|
|
188
|
+
the IHO publications under five groups ("B - Bathymetric
|
|
189
|
+
Publications (Mainly related to GEBCO)", "C - Capacity Building
|
|
190
|
+
Publications", M - Miscellaneous Publications (including Basic
|
|
191
|
+
Documents), P - Periodic Publications, S - Standards and
|
|
192
|
+
Specifications) — the five groups onto the guidance's five codes.
|
|
193
|
+
The name is the lowercase `sNNN`/`bNNN`/`cNNN` (the guidance's own
|
|
194
|
+
s57/s98 spelling); the dotted edition is the bare canonical 4th
|
|
195
|
+
segment; the S-158 member joins the name hyphenated (`s158-102`,
|
|
196
|
+
the fleet extension for compound publication numbers).
|
|
197
|
+
- **The legacy positional `urn:iho:` grammar is decode-only for every
|
|
198
|
+
series, emitted by none** (all five series carry a guidance type
|
|
199
|
+
code): marker segments, positional `ed-`/`year-`, the
|
|
192
200
|
bare appendix-subnumber atom, and the further bare digit segment
|
|
193
201
|
binding the S-158 member. The legacy 2.0.x spellings (dotted keys,
|
|
194
202
|
bare `a.b.c` editions, `y.`) stay decodable, never emitted.
|
|
@@ -202,19 +210,35 @@ owner's per-flavor split ruling of 2026-11-25). The laws:
|
|
|
202
210
|
IHO S-158 Part S-102 0.2.0 -> urn:mrn:iho:pub:spec:s158-102:0.2.0 (order-stable)
|
|
203
211
|
IHO M-2 Sup 1 -> urn:mrn:iho:pub:reg:m2:sup-1
|
|
204
212
|
IHO P-1 Vol. 30 (2) -> urn:mrn:iho:pub:per:p1:vol-30:issue-2
|
|
205
|
-
IHO B-
|
|
213
|
+
IHO B-12 3.0.0 -> urn:mrn:iho:pub:bathy:b12:3.0.0 (CSB Guidance)
|
|
214
|
+
IHO C-51 6.0.0 -> urn:mrn:iho:pub:cb:c51:6.0.0 (Manual on Hydrography)
|
|
206
215
|
|
|
207
216
|
**Breaking URN migrations this scheme carries** (legacy forms stay
|
|
208
217
|
decodable, never emitted): the official-URN namespace moved to the
|
|
209
|
-
guidance form (`urn:mrn:iho:pub:...`) for S/P/M
|
|
218
|
+
guidance form (`urn:mrn:iho:pub:...`) — first for S/P/M, then for the
|
|
219
|
+
B/C rows too (the legacy `urn:iho:b:/c:` emission is dead); the S-158
|
|
220
|
+
member
|
|
210
221
|
moved to the `s158-NNN` name encoding (issue #774) with the draft-era
|
|
211
222
|
part spellings rebinding onto `product` (#775's parted- mis-bind
|
|
212
223
|
fixed); the dotted keys (`part.4a`, `suppl.1`, `ap.A`, `annex.A`,
|
|
213
224
|
`vol.30`, `issue.2`, `appendix.D-2`) and the bare a.b.c edition segment
|
|
214
225
|
stay decode-only; the #635/#637 `y.2024` tag decodes into the
|
|
215
|
-
**volume**.
|
|
216
|
-
|
|
217
|
-
|
|
226
|
+
**volume**. The wire-type names are honest (the B/C rows were
|
|
227
|
+
misnomers): `pubid:iho:bibliographic` -> `pubid:iho:bathymetric`
|
|
228
|
+
(`Identifiers::Bathymetric`), `pubid:iho:circular-letter` ->
|
|
229
|
+
`pubid:iho:capacity_building` (`Identifiers::CapacityBuilding`) — a
|
|
230
|
+
clean rename of the model (no attribute/face alias kept; the S-158
|
|
231
|
+
checks_for->product precedent); the pubid-scheme slugs `b`/`cl` are
|
|
232
|
+
unchanged. The PRE-RENAME `_type` wire names stay DECODABLE (decode-only,
|
|
233
|
+
never emitted — the LEGACY pattern of this wave): stored rows (the
|
|
234
|
+
relaton-data-iho v2 index, snapshots crawled before the rename) still
|
|
235
|
+
carry them, and the relaton index loader rejects a file whose `_type`
|
|
236
|
+
fails to route — `polymorphic_type_map` merges the two aliases and
|
|
237
|
+
`from_hash` re-tags a legacy `_type` onto the renamed wire name, so a
|
|
238
|
+
decoded row equals a parsed query under `==` (which reads `_type`).
|
|
239
|
+
Removable once relaton-data-iho is re-crawled. relaton-data-iho needs a
|
|
240
|
+
re-crawl (it is already legacy pre-pubid-2 shape); the frozen
|
|
241
|
+
testsuite corpus rows are re-frozen in the coupled corpus round.
|
|
218
242
|
|
|
219
243
|
## Fixtures run through the classify pipeline
|
|
220
244
|
|
|
@@ -248,7 +272,7 @@ is preserved (`part-A`); the yearbook year is a volume (`vol-2024`, no
|
|
|
248
272
|
URN parser, never emitted). The draft-era part-faceted S-158 emission
|
|
249
273
|
(`part-S-102`, `parted-`) is dead: the `from_hash` unification
|
|
250
274
|
redirects it onto the `product` identity, so the legacy URN fails
|
|
251
|
-
the canonical gate. The official URN of
|
|
275
|
+
the canonical gate. The official URN of every series is the
|
|
252
276
|
adopted IHO MRN guidance form (`urn:mrn:iho:pub:...`); the
|
|
253
277
|
`urn:pubid:iho:` scheme is pubid's own and is not governed by the
|
|
254
278
|
guidance.
|
|
@@ -127,10 +127,29 @@ module Pubid
|
|
|
127
127
|
"pubid:iho:standard" => "Pubid::Iho::Identifiers::Standard",
|
|
128
128
|
"pubid:iho:publication" => "Pubid::Iho::Identifiers::Publication",
|
|
129
129
|
"pubid:iho:miscellaneous" => "Pubid::Iho::Identifiers::Miscellaneous",
|
|
130
|
-
"pubid:iho:
|
|
131
|
-
"pubid:iho:
|
|
130
|
+
"pubid:iho:bathymetric" => "Pubid::Iho::Identifiers::Bathymetric",
|
|
131
|
+
"pubid:iho:capacity_building" =>
|
|
132
|
+
"Pubid::Iho::Identifiers::CapacityBuilding",
|
|
132
133
|
}.freeze
|
|
133
134
|
|
|
135
|
+
# The polymorphic ROUTE table for {from_hash}: the base derives it from
|
|
136
|
+
# the concrete classes' `polymorphic_name`s; the PRE-RENAME B/C wire
|
|
137
|
+
# names (`bibliographic`/`circular-letter` — the rows were misnomered
|
|
138
|
+
# before the bathy/cb rename) merge in beside them as decode-only
|
|
139
|
+
# aliases (class-valued, the route table's own shape). Stored rows —
|
|
140
|
+
# the relaton-data-iho v2 index, any snapshot crawled before the
|
|
141
|
+
# rename — still carry them; `Pubid.from_hash` routes through this
|
|
142
|
+
# map on the raw hash. Decode-only, never emitted: the emission side
|
|
143
|
+
# writes the renamed `polymorphic_name`. Removable once
|
|
144
|
+
# relaton-data-iho is re-crawled.
|
|
145
|
+
def self.polymorphic_type_map
|
|
146
|
+
@polymorphic_type_map ||= super.merge(
|
|
147
|
+
"pubid:iho:bibliographic" => Pubid::Iho::Identifiers::Bathymetric,
|
|
148
|
+
"pubid:iho:circular-letter" =>
|
|
149
|
+
Pubid::Iho::Identifiers::CapacityBuilding,
|
|
150
|
+
)
|
|
151
|
+
end
|
|
152
|
+
|
|
134
153
|
# The base Pubid::Identifier no longer auto-maps attributes, so each
|
|
135
154
|
# flavor's top class must declare its own key_value mapping. IHO
|
|
136
155
|
# attributes are plain strings, so they map directly. `publisher` is
|
|
@@ -173,8 +192,36 @@ module Pubid
|
|
|
173
192
|
# (part: "S-102", part_edition: "0.2.0") decodes to the product
|
|
174
193
|
# identity (issue #774), so no construction path yields the
|
|
175
194
|
# two-identity disease of issue #775.
|
|
195
|
+
# The pre-rename B/C wire names decode onto the RENAMED canonical tag:
|
|
196
|
+
# a stored row's `_type` is re-tagged beside the class route
|
|
197
|
+
# ({polymorphic_type_map}), so a decoded legacy row reads and compares
|
|
198
|
+
# as the renamed type (`==` compares `_type`; the relaton index
|
|
199
|
+
# matcher rebuilds both sides through from_hash — a row left carrying
|
|
200
|
+
# `pubid:iho:bibliographic` would never equal a parsed
|
|
201
|
+
# `pubid:iho:bathymetric` query). Pure function; the hash without a
|
|
202
|
+
# legacy `_type` passes through untouched.
|
|
203
|
+
LEGACY_TYPE_RETAG = {
|
|
204
|
+
"pubid:iho:bibliographic" => "pubid:iho:bathymetric",
|
|
205
|
+
"pubid:iho:circular-letter" => "pubid:iho:capacity_building",
|
|
206
|
+
}.freeze
|
|
207
|
+
|
|
176
208
|
def self.from_hash(data, options = {})
|
|
177
|
-
super(Builder.normalize_checks_alias(data),
|
|
209
|
+
super(Builder.normalize_checks_alias(normalize_legacy_type(data)),
|
|
210
|
+
options)
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
# Pure function: retags a legacy `_type` (string or symbol key) onto
|
|
214
|
+
# the renamed wire name. Removable once relaton-data-iho is re-crawled.
|
|
215
|
+
def self.normalize_legacy_type(data)
|
|
216
|
+
return data unless data.is_a?(::Hash)
|
|
217
|
+
|
|
218
|
+
canonical = LEGACY_TYPE_RETAG[(data["_type"] || data[:_type]).to_s]
|
|
219
|
+
return data unless canonical
|
|
220
|
+
|
|
221
|
+
data.dup.tap do |hash|
|
|
222
|
+
hash["_type"] = canonical if hash.key?("_type")
|
|
223
|
+
hash[:_type] = canonical if hash.key?(:_type)
|
|
224
|
+
end
|
|
178
225
|
end
|
|
179
226
|
|
|
180
227
|
# The volume/issue and appendix/subnumber pairs are scalar clusters:
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Iho
|
|
5
|
+
module Identifiers
|
|
6
|
+
# IHO Bathymetric Publication (B series; S-11 Part C Ed 1.0.0
|
|
7
|
+
# section 1.2: "B - Bathymetric Publications (Mainly related to
|
|
8
|
+
# GEBCO)" — the MRN guidance's `bathy` publication type).
|
|
9
|
+
# Example: IHO B-4 2.19.0.
|
|
10
|
+
class Bathymetric < Identifier
|
|
11
|
+
def self.type
|
|
12
|
+
{ key: :bathymetric, title: "Bathymetric Publication",
|
|
13
|
+
short: "B" }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Iho
|
|
5
|
+
module Identifiers
|
|
6
|
+
# IHO Capacity Building Publication (C series; S-11 Part C Ed 1.0.0
|
|
7
|
+
# section 1.2: "C - Capacity Building Publications" — the MRN
|
|
8
|
+
# guidance's `cb` publication type).
|
|
9
|
+
# Example: IHO C-13 1.0.0 (the Manual on Hydrography).
|
|
10
|
+
class CapacityBuilding < Identifier
|
|
11
|
+
def self.type
|
|
12
|
+
{ key: :capacity_building, title: "Capacity Building Publication",
|
|
13
|
+
short: "C" }
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# The auto-derived name kebab-cases to "capacity-building"; the
|
|
17
|
+
# wire type keeps the underscore spelling (the domain term, the
|
|
18
|
+
# type key's own shape) — the bsi_pfs hard-return precedent.
|
|
19
|
+
def self.polymorphic_name
|
|
20
|
+
"pubid:iho:capacity_building"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
module Pubid
|
|
4
4
|
module Iho
|
|
5
5
|
module Identifiers
|
|
6
|
-
autoload :
|
|
7
|
-
autoload :
|
|
6
|
+
autoload :Bathymetric, "#{__dir__}/identifiers/bathymetric"
|
|
7
|
+
autoload :CapacityBuilding, "#{__dir__}/identifiers/capacity_building"
|
|
8
8
|
autoload :Miscellaneous, "#{__dir__}/identifiers/miscellaneous"
|
|
9
9
|
autoload :Publication, "#{__dir__}/identifiers/publication"
|
|
10
10
|
autoload :Standard, "#{__dir__}/identifiers/standard"
|
|
@@ -55,8 +55,8 @@ module Pubid
|
|
|
55
55
|
atom "volume_edition", "voled"
|
|
56
56
|
atom "volume_year", "voly"
|
|
57
57
|
|
|
58
|
-
type "pubid:iho:
|
|
59
|
-
type "pubid:iho:
|
|
58
|
+
type "pubid:iho:bathymetric", "b"
|
|
59
|
+
type "pubid:iho:capacity_building", "cl"
|
|
60
60
|
type "pubid:iho:identifier", "id"
|
|
61
61
|
type "pubid:iho:miscellaneous", "m"
|
|
62
62
|
type "pubid:iho:publication", "pub"
|
data/lib/pubid/iho/urn.adoc
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
[[urn-iho]]
|
|
1
2
|
= IHO URN schemes
|
|
2
3
|
|
|
3
4
|
This file is the single home of the IHO flavor's URN documentation (the
|
|
@@ -5,10 +6,10 @@ per-flavor split of the former `docs/URN-SCHEMES.adoc`, owner ruling
|
|
|
5
6
|
2026-11-25: "for URN schemes how can we mix up different flavors in 1
|
|
6
7
|
file? SPLIT THE FILE!"). It covers the three schemes the flavor carries:
|
|
7
8
|
|
|
8
|
-
1. the official URN (`#to_urn`) — the adopted IHO MRN guidance form
|
|
9
|
-
the
|
|
9
|
+
1. the official URN (`#to_urn`) — the adopted IHO MRN guidance form,
|
|
10
|
+
the emission of every series;
|
|
10
11
|
2. the legacy positional `urn:iho:` grammar — decodable for every
|
|
11
|
-
series, emitted
|
|
12
|
+
series, emitted by none;
|
|
12
13
|
3. the pubid-scheme URN (`#to_pubid_urn`) — pubid's own
|
|
13
14
|
`urn:pubid:iho:` codec, not governed by the IHO guidance.
|
|
14
15
|
|
|
@@ -23,14 +24,25 @@ publications, pages 8-9). The guidance proposes the Publications MRN
|
|
|
23
24
|
|
|
24
25
|
urn:mrn:iho:pub:<publication type>:<publication name or number>:<edition number>[:<correction number>[:<clarification number>[:<optional and additional version information>]]]
|
|
25
26
|
|
|
26
|
-
with the publication types `bathy` | `cb` | `reg` | `per` | `spec
|
|
27
|
+
with the publication types `bathy` | `cb` | `reg` | `per` | `spec` (the
|
|
28
|
+
guidance: "Bathymetric Publications - bathy; Capacity Building
|
|
29
|
+
Publications - cb; Miscellaneous (Base Regulatory Publications) - reg;
|
|
30
|
+
Periodic Publications - per; Standards and Specifications - spec"), and
|
|
27
31
|
the example `urn:mrn:iho:pub:spec:s57:3:1:supplement3` (S-57 Ed 3,
|
|
28
32
|
Corr. 1, Supplement 3). IHO's own printed S-98 metadata carries
|
|
29
33
|
`urn:mrn:iho:pub:spec:s98:1.0.0` — the DOTTED edition in the canonical
|
|
30
34
|
4th position, which this flavor adopts verbatim.
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
The series-to-code binding is 1:1 onto the five groups IHO arranges its
|
|
37
|
+
publications under (S-11 Part C Ed 1.0.0, section 1.2: "the IHO has
|
|
38
|
+
arranged their publications under the following groups: B - Bathymetric
|
|
39
|
+
Publications (Mainly related to GEBCO), C - Capacity Building
|
|
40
|
+
Publications, M - Miscellaneous Publications (including Basic
|
|
41
|
+
Documents), P - Periodic Publications, S - Standards and
|
|
42
|
+
Specifications").
|
|
43
|
+
|
|
44
|
+
pubid adopts the guidance as the flavor's official-URN emission for
|
|
45
|
+
every series:
|
|
34
46
|
|
|
35
47
|
[cols="3,1,4,4",options="header"]
|
|
36
48
|
|===
|
|
@@ -38,8 +50,8 @@ series the guidance types:
|
|
|
38
50
|
| S (Standards and Specifications) | `spec` | the guidance's own code | `IHO S-44 5.0.0` → `urn:mrn:iho:pub:spec:s44:5.0.0`
|
|
39
51
|
| P (Publication, the periodic series) | `per` | the guidance's Periodic Publications code | `IHO P-5 Vol. 2024` → `urn:mrn:iho:pub:per:p5:vol-2024`
|
|
40
52
|
| M (Miscellaneous Base Regulatory Publications) | `reg` | the guidance's own code | `IHO M-2 Sup 1` → `urn:mrn:iho:pub:reg:m2:sup-1`
|
|
41
|
-
| B (
|
|
42
|
-
| C (
|
|
53
|
+
| B (Bathymetric Publications; S-11 Part C section 1.2, "Mainly related to GEBCO") | `bathy` | the guidance's Bathymetric Publications code | `IHO B-12 3.0.0` → `urn:mrn:iho:pub:bathy:b12:3.0.0`
|
|
54
|
+
| C (Capacity Building Publications; S-11 Part C section 1.2) | `cb` | the guidance's Capacity Building Publications code | `IHO C-51 6.0.0` → `urn:mrn:iho:pub:cb:c51:6.0.0`
|
|
43
55
|
|===
|
|
44
56
|
|
|
45
57
|
=== The name form
|
|
@@ -106,12 +118,13 @@ The guidance's bare correction/clarification slots (the `s57:3:1`
|
|
|
106
118
|
form) are NOT modeled faces — the flavor has no correction component —
|
|
107
119
|
and a bare digit tail segment rejects on decode.
|
|
108
120
|
|
|
109
|
-
== The legacy positional grammar (decode-only for
|
|
121
|
+
== The legacy positional grammar (decode-only for every series; emitted by none)
|
|
110
122
|
|
|
111
123
|
The pre-guidance emission — `urn:iho:<type>:<number>[:ed-<x.y.z>]
|
|
112
124
|
[:sup-…][:part-…][:annex-…][:appendix-…][:<sub>][:vol-…][:issue-…]
|
|
113
|
-
[:year-…]` — stays fully decodable for every series and
|
|
114
|
-
|
|
125
|
+
[:year-…]` — stays fully decodable for every series and is emitted by
|
|
126
|
+
none: all five series carry a guidance type code, so the guidance form
|
|
127
|
+
above is the flavor's only emission. Its laws:
|
|
115
128
|
|
|
116
129
|
- the docnumber occupies the first bare number segment; a further bare
|
|
117
130
|
digit segment binds the S-158 member (`urn:iho:s:158:100`), never
|
|
@@ -161,9 +174,13 @@ the `from_hash` unification redirects the legacy form onto the
|
|
|
161
174
|
|
|
162
175
|
== relaton-side follow-ups (not this repo)
|
|
163
176
|
|
|
164
|
-
The official-URN namespace moved (`urn:mrn:iho:pub
|
|
177
|
+
The official-URN namespace moved (`urn:mrn:iho:pub:...`, now for every
|
|
178
|
+
series — the B/C rows moved from the legacy `urn:iho:b:/c:` form onto
|
|
179
|
+
their guidance codes `bathy`/`cb`) and
|
|
165
180
|
the S-158 member shape changed (`s158-102`, not `s:158:100` or the
|
|
166
181
|
part form): relaton-data-iho needs a re-crawl when this gem ships, and
|
|
167
182
|
the frozen testsuite corpus rows are re-frozen in the coupled corpus
|
|
168
183
|
round. The pubid-scheme slugs changed for S-158 identities
|
|
169
|
-
(`iho/std/158/product-102/...`)
|
|
184
|
+
(`iho/std/158/product-102/...`); the B/C pubid-scheme slugs (`b`, `cl`)
|
|
185
|
+
are unchanged — only their `_type` names are
|
|
186
|
+
(`pubid:iho:bathymetric`, `pubid:iho:capacity_building`).
|
|
@@ -6,18 +6,22 @@ module Pubid
|
|
|
6
6
|
#
|
|
7
7
|
# == The adopted IHO MRN guidance (owner ruling, 2026-11-25)
|
|
8
8
|
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
9
|
+
# Every series emits the guidance form (S-100WG4, "MRN Guidelines for
|
|
10
|
+
# IHO"; the guidance's own examples are s57 /
|
|
11
|
+
# urn:mrn:iho:pub:spec:s57:3:1:supplement3 and — IHO's printed S-98
|
|
12
|
+
# metadata — urn:mrn:iho:pub:spec:s98:1.0.0):
|
|
13
13
|
#
|
|
14
14
|
# urn:mrn:iho:pub:<type>:<name>[:<edition>][:<trailing atoms>...]
|
|
15
15
|
#
|
|
16
|
-
# - <type>:
|
|
17
|
-
# (
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
16
|
+
# - <type>: the guidance's five publication type codes, one per
|
|
17
|
+
# series letter — bathy (B), cb (C), reg (M), per (P), spec (S).
|
|
18
|
+
# The B/C bindings follow IHO S-11 Part C Ed 1.0.0 section 1.2,
|
|
19
|
+
# which arranges the IHO publications under five groups ("B -
|
|
20
|
+
# Bathymetric Publications (Mainly related to GEBCO)", "C -
|
|
21
|
+
# Capacity Building Publications", M - Miscellaneous Publications
|
|
22
|
+
# (including Basic Documents), P - Periodic Publications, S -
|
|
23
|
+
# Standards and Specifications): the five groups map 1:1 onto the
|
|
24
|
+
# guidance's five codes.
|
|
21
25
|
# - <name>: sNNN — the lowercase series letter + number. The S-158
|
|
22
26
|
# member joins the name segment hyphenated (the fleet extension of
|
|
23
27
|
# the guidance for compound publication numbers, keeping the
|
|
@@ -45,33 +49,16 @@ module Pubid
|
|
|
45
49
|
# - urn:mrn:iho:pub:spec:s158-102:1.0.0 IHO S-158:102 1.0.0
|
|
46
50
|
# - urn:mrn:iho:pub:reg:m2:sup-1 IHO M-2 Sup 1
|
|
47
51
|
# - urn:mrn:iho:pub:per:p5:vol-2024 IHO P-5 Vol. 2024
|
|
52
|
+
# - urn:mrn:iho:pub:bathy:b12:3.0.0 IHO B-12 3.0.0 (CSB)
|
|
53
|
+
# - urn:mrn:iho:pub:cb:c51:6.0.0 IHO C-51 6.0.0
|
|
48
54
|
#
|
|
49
|
-
# == The legacy positional scheme (
|
|
50
|
-
# every series, never emitted for S/P/M)
|
|
55
|
+
# == The legacy positional scheme (decode-only for every series)
|
|
51
56
|
#
|
|
52
|
-
# The pre-guidance positional grammar
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
#
|
|
56
|
-
#
|
|
57
|
-
# [:sup-<n>[:ed-<x.y.z>][:year-<yyyy>]]
|
|
58
|
-
# [:part-<X>[:ed-<x.y.z>][:year-<yyyy>]]
|
|
59
|
-
# [:spec-<n>[:specsub-<n>][:specvar-<X>]]
|
|
60
|
-
# [:annex-<A>[...]]
|
|
61
|
-
# [:appendix-<B>[:<sub>][...]]
|
|
62
|
-
# [:vol-<n>[:issue-<n>][...]]
|
|
63
|
-
# [:year-<yyyy>]
|
|
64
|
-
#
|
|
65
|
-
# Containment: part contains annexes, annex contains appendices, the
|
|
66
|
-
# subnumber is a child atom of its appendix, the issue a child of its
|
|
67
|
-
# volume. Letters are case-preserved. The volume carries every serial
|
|
68
|
-
# locator — the yearbook year IS a volume (P-5 Vol. 2024 gives
|
|
69
|
-
# vol-2024), so a periodical identifier has no year segment; the
|
|
70
|
-
# year- segment exists only for the standards with-year qualifier.
|
|
71
|
-
#
|
|
72
|
-
# Examples (the legacy form):
|
|
73
|
-
# - urn:iho:b:4:ed-2.19.0 IHO B-4 2.19.0
|
|
74
|
-
# - urn:iho:c:13:ed-1.0.0 IHO C-13 1.0.0
|
|
57
|
+
# The pre-guidance positional grammar — one semantic atom per
|
|
58
|
+
# segment, marker = the lowercased human-face token, ed- following
|
|
59
|
+
# ISO's RFC 5141 precedent — is decoded by the UrnParser for every
|
|
60
|
+
# series and emitted by none: all five series carry a guidance type
|
|
61
|
+
# code, so the guidance form above is the only emission.
|
|
75
62
|
class UrnGenerator
|
|
76
63
|
attr_reader :identifier
|
|
77
64
|
|
|
@@ -79,12 +66,14 @@ module Pubid
|
|
|
79
66
|
@identifier = identifier
|
|
80
67
|
end
|
|
81
68
|
|
|
82
|
-
# The guidance publication type per series letter
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
|
|
69
|
+
# The guidance publication type per series letter — the five
|
|
70
|
+
# S-11 Part C groups onto the guidance's five codes: S =
|
|
71
|
+
# Standards and Specifications -> spec, P = the periodic
|
|
72
|
+
# publications -> per, M = Miscellaneous (Base Regulatory
|
|
73
|
+
# Publications) -> reg, B = Bathymetric Publications -> bathy,
|
|
74
|
+
# C = Capacity Building Publications -> cb.
|
|
75
|
+
MRN_TYPES = { "S" => "spec", "P" => "per", "M" => "reg",
|
|
76
|
+
"B" => "bathy", "C" => "cb" }.freeze
|
|
88
77
|
|
|
89
78
|
# The guidance-form trailing atoms in containment order — the same
|
|
90
79
|
# order the legacy scheme prints them. The Appendix subnumber is
|
|
@@ -106,31 +95,8 @@ module Pubid
|
|
|
106
95
|
[:volume_year, "year"]
|
|
107
96
|
].freeze
|
|
108
97
|
|
|
109
|
-
# [component, marker] pairs of the legacy positional scheme, in the
|
|
110
|
-
# containment/canonical-face order. A component edition/year emits
|
|
111
|
-
# right after its component (the ed- segment attaches to the node
|
|
112
|
-
# it follows, recording the separately-published mode). nil markers
|
|
113
|
-
# emit their component as a BARE atom (the appendix subnumber
|
|
114
|
-
# directly after its appendix).
|
|
115
|
-
SEGMENTS = [
|
|
116
|
-
[:edition, "ed"], [:year, "year"],
|
|
117
|
-
[:supplement, "sup"], [:supplement_edition, "ed"],
|
|
118
|
-
[:supplement_year, "year"],
|
|
119
|
-
[:part, "part"], [:part_edition, "ed"], [:part_year, "year"],
|
|
120
|
-
# the S-4 spec citation: a child of its part (the citation
|
|
121
|
-
# letter rides the part- atom), the dotted sub and the
|
|
122
|
-
# parenthesized variant its own children.
|
|
123
|
-
[:spec, "spec"], [:spec_sub, "specsub"], [:spec_variant, "specvar"],
|
|
124
|
-
[:annex, "annex"], [:annex_edition, "ed"], [:annex_year, "year"],
|
|
125
|
-
[:appendix, "appendix"], [:appendix_subnumber, nil],
|
|
126
|
-
[:appendix_edition, "ed"], [:appendix_year, "year"],
|
|
127
|
-
[:volume, "vol"], [:issue, "issue"], [:volume_edition, "ed"],
|
|
128
|
-
[:volume_year, "year"]
|
|
129
|
-
].freeze
|
|
130
|
-
|
|
131
98
|
def generate
|
|
132
|
-
|
|
133
|
-
MRN_TYPES[letter] ? generate_mrn(MRN_TYPES[letter]) : generate_legacy
|
|
99
|
+
generate_mrn(MRN_TYPES.fetch(identifier.class.type[:short].to_s))
|
|
134
100
|
end
|
|
135
101
|
|
|
136
102
|
private
|
|
@@ -176,25 +142,6 @@ module Pubid
|
|
|
176
142
|
end
|
|
177
143
|
end
|
|
178
144
|
end
|
|
179
|
-
|
|
180
|
-
# The legacy positional form (B/C today; the shape every legacy
|
|
181
|
-
# urn:iho: URN decodes from).
|
|
182
|
-
def generate_legacy
|
|
183
|
-
parts = ["urn", "iho"]
|
|
184
|
-
parts << identifier.class.type[:short].to_s.downcase
|
|
185
|
-
parts << identifier.number.to_s
|
|
186
|
-
parts.concat(component_segments)
|
|
187
|
-
parts.join(":")
|
|
188
|
-
end
|
|
189
|
-
|
|
190
|
-
def component_segments
|
|
191
|
-
SEGMENTS.filter_map do |component, marker|
|
|
192
|
-
value = identifier.public_send(component)
|
|
193
|
-
next unless value
|
|
194
|
-
|
|
195
|
-
marker ? "#{marker}-#{value}" : value.to_s
|
|
196
|
-
end
|
|
197
|
-
end
|
|
198
145
|
end
|
|
199
146
|
end
|
|
200
147
|
end
|
data/lib/pubid/iho/urn_parser.rb
CHANGED
|
@@ -4,14 +4,15 @@ module Pubid
|
|
|
4
4
|
module Iho
|
|
5
5
|
# Parses IHO URNs back into identifiers, both emitted schemes:
|
|
6
6
|
#
|
|
7
|
-
# == The adopted IHO MRN guidance form (
|
|
7
|
+
# == The adopted IHO MRN guidance form (the emission of every series)
|
|
8
8
|
#
|
|
9
9
|
# urn:mrn:iho:pub:<type>:<name>[:<edition>][:<trailing atoms>...]
|
|
10
10
|
#
|
|
11
|
-
# - <type>:
|
|
12
|
-
# (
|
|
13
|
-
#
|
|
14
|
-
#
|
|
11
|
+
# - <type>: bathy / cb / reg / per / spec — the guidance publication
|
|
12
|
+
# types (the five S-11 Part C Ed 1.0.0 section 1.2 groups:
|
|
13
|
+
# Bathymetric Publications, Capacity Building Publications,
|
|
14
|
+
# Miscellaneous Publications, Periodic Publications, Standards and
|
|
15
|
+
# Specifications); each maps back to its series letter.
|
|
15
16
|
# - <name>: sNNN — the lowercase series letter + number; the S-158
|
|
16
17
|
# member joins hyphenated (s158-102), the fleet extension of the
|
|
17
18
|
# guidance for compound publication numbers.
|
|
@@ -24,8 +25,8 @@ module Pubid
|
|
|
24
25
|
# correction/clarification slots (the s57:3:1 form) are not modeled
|
|
25
26
|
# faces — a bare digit tail segment rejects as unexpected.
|
|
26
27
|
#
|
|
27
|
-
# == The legacy positional form (
|
|
28
|
-
#
|
|
28
|
+
# == The legacy positional form (decode-only for every series,
|
|
29
|
+
# emitted by none)
|
|
29
30
|
#
|
|
30
31
|
# urn:iho:<type>:<number>[:ed-<x.y.z>][:sup-<n>][:part-<X>]
|
|
31
32
|
# [:spec-<n>[:specsub-<n>][:specvar-<X>]][:annex-<A>]
|
|
@@ -67,6 +68,8 @@ module Pubid
|
|
|
67
68
|
# - urn:mrn:iho:pub:spec:s158-102:1.0.0 → IHO S-158:102 1.0.0
|
|
68
69
|
# - urn:mrn:iho:pub:reg:m2:sup-1 → IHO M-2 Sup 1
|
|
69
70
|
# - urn:mrn:iho:pub:per:p1:vol-30:issue-2 → IHO P-1 Vol. 30 (2)
|
|
71
|
+
# - urn:mrn:iho:pub:bathy:b12:3.0.0 → IHO B-12 3.0.0
|
|
72
|
+
# - urn:mrn:iho:pub:cb:c51:6.0.0 → IHO C-51 6.0.0
|
|
70
73
|
# - urn:iho:s:44:ed-5.0.0 → IHO S-44 5.0.0
|
|
71
74
|
# - urn:iho:s:158:100:ed-1.0.0 → IHO S-158:100 1.0.0
|
|
72
75
|
# - urn:iho:s:4:ed-4.10.0:part-B:spec-401 → IHO S-4 4.10.0 B-401
|
|
@@ -74,9 +77,10 @@ module Pubid
|
|
|
74
77
|
TYPE_LETTERS = %w[s p m b c].freeze
|
|
75
78
|
|
|
76
79
|
# The guidance publication type -> series letter (the emission's
|
|
77
|
-
# MRN_TYPES inverted)
|
|
78
|
-
# unknown type rejects.
|
|
79
|
-
MRN_TYPE_LETTERS = { "spec" => "S", "per" => "P", "reg" => "M"
|
|
80
|
+
# MRN_TYPES inverted): the five S-11 Part C groups onto their
|
|
81
|
+
# series letters. An unknown type rejects.
|
|
82
|
+
MRN_TYPE_LETTERS = { "spec" => "S", "per" => "P", "reg" => "M",
|
|
83
|
+
"bathy" => "B", "cb" => "C" }.freeze
|
|
80
84
|
|
|
81
85
|
MRN_PREFIX = "urn:mrn:iho:pub:"
|
|
82
86
|
# The publication name: the lowercase series letter + number, the
|
|
@@ -192,7 +196,8 @@ module Pubid
|
|
|
192
196
|
end
|
|
193
197
|
|
|
194
198
|
# The legacy positional decode (the pre-guidance emission shape and
|
|
195
|
-
# every legacy spelling it decodes
|
|
199
|
+
# every legacy spelling it decodes; never emitted — all five series
|
|
200
|
+
# carry a guidance type code).
|
|
196
201
|
def parse_legacy_urn(urn)
|
|
197
202
|
segments = split_parts(strip_namespace(urn))
|
|
198
203
|
type_token = read_type!(segments, urn)
|
|
@@ -303,7 +308,7 @@ module Pubid
|
|
|
303
308
|
end
|
|
304
309
|
|
|
305
310
|
# specsub-/specvar- are children of the spec atom — allowed only
|
|
306
|
-
# in their parent's slot (the
|
|
311
|
+
# in their parent's slot (the MRN_SEGMENTS table in the generator).
|
|
307
312
|
def assert_spec_parent!(key, ctx, urn)
|
|
308
313
|
return unless %i[spec_sub spec_variant].include?(key)
|
|
309
314
|
return if SPEC_PARENTS.include?(ctx[:component])
|
data/lib/pubid/version.rb
CHANGED