pubid 2.0.51 → 2.0.53
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/parg/iala.json +1 -1
- data/data/parg/iho.json +1 -1
- data/data/parg/iho.parg +126 -33
- data/lib/pubid/iala/CLAUDE.md +55 -6
- data/lib/pubid/iala/builder.rb +26 -3
- data/lib/pubid/iala/identifier.rb +16 -11
- data/lib/pubid/iala/identifiers/product_specification.rb +40 -0
- data/lib/pubid/iala/identifiers.rb +2 -0
- data/lib/pubid/iala/pubid_urn_schema.rb +1 -0
- data/lib/pubid/iala/renderer.rb +20 -2
- data/lib/pubid/iala/urn.adoc +133 -0
- data/lib/pubid/iala/urn_generator.rb +22 -4
- data/lib/pubid/iala/urn_parser.rb +10 -4
- data/lib/pubid/iho/CLAUDE.md +89 -73
- data/lib/pubid/iho/builder.rb +135 -8
- data/lib/pubid/iho/identifiers/base.rb +38 -2
- data/lib/pubid/iho/pubid_urn_schema.rb +22 -13
- data/lib/pubid/iho/renderer.rb +11 -2
- data/lib/pubid/iho/urn.adoc +169 -0
- data/lib/pubid/iho/urn_generator.rb +143 -28
- data/lib/pubid/iho/urn_parser.rb +145 -37
- data/lib/pubid/version.rb +1 -1
- metadata +4 -1
|
@@ -46,9 +46,25 @@ module Pubid
|
|
|
46
46
|
# `number` overrides the generic Components::Code attribute with a plain
|
|
47
47
|
# string (same pattern as the other string components); it holds the IHO
|
|
48
48
|
# document number (e.g. "100", "1/21" until the slash-chain volume
|
|
49
|
-
# parse, "158
|
|
49
|
+
# parse, "158"). Kept as the generic `number` so the relaton index
|
|
50
50
|
# sorts/binary-searches on it natively via `id.number`.
|
|
51
51
|
attribute :number, :string
|
|
52
|
+
# The S-158 series-member designator (issue #774; S-158 Ed 1.0.0
|
|
53
|
+
# clause 2.1): S-158 is a framework publication defining a series
|
|
54
|
+
# of separate check specifications — S-158:100 (generic),
|
|
55
|
+
# S-158:1xx (one per S-100 product; :101 ENC, :102 Bathymetric
|
|
56
|
+
# Surface), S-158:98 (interoperability), S-158:128 (catalogue) —
|
|
57
|
+
# each a publication of its own with its own edition stream. The
|
|
58
|
+
# value is the S-100 product number whose checks the member
|
|
59
|
+
# specifies; the colon form `S-158:102` is the primary designator.
|
|
60
|
+
attribute :checks_for, :string
|
|
61
|
+
# The spelling face of the member designator (facets-spelling-only,
|
|
62
|
+
# equality-ignored): the parse records the draft-era part value as
|
|
63
|
+
# written ("S-102", "102") so the render keeps the input's
|
|
64
|
+
# spelling; the canonical colon form renders when this is nil.
|
|
65
|
+
# Deserialization (from_hash) restores no face — equality/URN use
|
|
66
|
+
# the canonical shape.
|
|
67
|
+
attribute :checks_for_face, :string
|
|
52
68
|
attribute :publisher, :string, default: "IHO"
|
|
53
69
|
# The official IHO edition is the dotted x.y.z (a plain string — the
|
|
54
70
|
# ~16 string-edition flavors precede this). `IHO S-100 1.0.0` is
|
|
@@ -98,6 +114,12 @@ module Pubid
|
|
|
98
114
|
attribute :spec_sub, :string
|
|
99
115
|
attribute :spec_variant, :string
|
|
100
116
|
|
|
117
|
+
# The member-designator spelling face carries no identity
|
|
118
|
+
# (facets-spelling-only): `S-158 Part S-102 0.2.0` and
|
|
119
|
+
# `S-158:102 0.2.0` are one document, so `==`, `hash`, `eql?` and
|
|
120
|
+
# the subset match skip the face; only the render reads it.
|
|
121
|
+
equality_ignored :checks_for_face
|
|
122
|
+
|
|
101
123
|
# Polymorphic type map for lutaml::Model key_value serialization: maps
|
|
102
124
|
# each subclass's polymorphic_name to its class name so `from_hash` can
|
|
103
125
|
# re-instantiate the concrete type from `_type`.
|
|
@@ -117,6 +139,7 @@ module Pubid
|
|
|
117
139
|
key_value do
|
|
118
140
|
map "_type", to: :_type, polymorphic_map: IHO_TYPE_MAP
|
|
119
141
|
map "number", to: :number
|
|
142
|
+
map "checks_for", to: :checks_for
|
|
120
143
|
map "edition", to: :edition
|
|
121
144
|
map "year", to: :year
|
|
122
145
|
map "supplement", to: :supplement
|
|
@@ -144,6 +167,16 @@ module Pubid
|
|
|
144
167
|
# from_hash is the shared polymorphic dispatch on Pubid::Identifier.
|
|
145
168
|
# IHO_TYPE_MAP remains the key_value polymorphic_map.
|
|
146
169
|
|
|
170
|
+
# The deserialization path applies the same S-158 alias
|
|
171
|
+
# unification the parse path applies (Builder.normalize_checks_alias):
|
|
172
|
+
# a stored row or a legacy URN carrying the draft-era part model
|
|
173
|
+
# (part: "S-102", part_edition: "0.2.0") decodes to the checks_for
|
|
174
|
+
# identity (issue #774), so no construction path yields the
|
|
175
|
+
# two-identity disease of issue #775.
|
|
176
|
+
def self.from_hash(data, options = {})
|
|
177
|
+
super(Builder.normalize_checks_alias(data), options)
|
|
178
|
+
end
|
|
179
|
+
|
|
147
180
|
# The volume/issue and appendix/subnumber pairs are scalar clusters:
|
|
148
181
|
# a reference that omits the finer component must still match a hit
|
|
149
182
|
# that carries one ("P-1 Vol. 30" vs "P-1 Vol. 30 (2)"), so excluding
|
|
@@ -230,7 +263,10 @@ module Pubid
|
|
|
230
263
|
end
|
|
231
264
|
|
|
232
265
|
def base_code
|
|
233
|
-
"#{self.class.type[:short]}-#{number}"
|
|
266
|
+
code = +"#{self.class.type[:short]}-#{number}"
|
|
267
|
+
# the S-158 member designator rides the code (the colon form)
|
|
268
|
+
code << ":#{checks_for}" if checks_for
|
|
269
|
+
code
|
|
234
270
|
end
|
|
235
271
|
|
|
236
272
|
def compact_code
|
|
@@ -2,24 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
module Pubid
|
|
4
4
|
module Iho
|
|
5
|
-
# The pubid-scheme URN of IHO (issue #670;
|
|
5
|
+
# The pubid-scheme URN of IHO (issue #670; the flavor's own urn
|
|
6
|
+
# scheme notes, lib/pubid/iho/urn.adoc).
|
|
6
7
|
#
|
|
7
8
|
# IHO S-100 5.0.0 Part 2 (2024) ->
|
|
8
9
|
# urn:pubid:iho:std:100:ed-5.0.0:year-2024:part-2
|
|
10
|
+
# IHO S-158:102 1.0.0 ->
|
|
11
|
+
# urn:pubid:iho:std:158:checks-102:ed-1.0.0
|
|
9
12
|
#
|
|
10
|
-
# The atoms follow the containment order of the official URN
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
# (the
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
13
|
+
# The atoms follow the containment order of the official URN: the
|
|
14
|
+
# S-158 member designator rides the document code (the checks_for
|
|
15
|
+
# component is the series member itself — `checks-<NNN>`, issue
|
|
16
|
+
# #774), then the document's edition and year, then each component
|
|
17
|
+
# with its own edition/year right after it — supplement, part,
|
|
18
|
+
# annex, appendix (the two-level Appendix D-2 keeps the subnumber as
|
|
19
|
+
# its own atom), volume (the unified locator, yearbook volumes
|
|
20
|
+
# included: `vol-2024`), issue. The S-4 spec citation sits inside
|
|
21
|
+
# its part (`spec-`, `specsub-`, `specvar-`). Letters stay
|
|
22
|
+
# case-preserved (`part-A`). The legacy `y.` yearbook marker is
|
|
23
|
+
# decodable in the official URN parser, never emitted here: a
|
|
24
|
+
# periodical has no `year-` atom value, its volume carries the year.
|
|
25
|
+
# The official URN of the S/P/M series is the adopted IHO MRN
|
|
26
|
+
# guidance form (`urn:mrn:iho:pub:spec:...`, UrnGenerator) — this
|
|
27
|
+
# scheme is pubid's own and is not governed by the guidance.
|
|
22
28
|
PubidUrnSchema = Pubid::PubidUrn.define("iho") do
|
|
29
|
+
# The S-158 series member (issue #774): rides the document code,
|
|
30
|
+
# before the edition — `urn:pubid:iho:std:158:checks-102:ed-1.0.0`.
|
|
31
|
+
atom "checks_for", "checks"
|
|
23
32
|
atom "edition", "ed"
|
|
24
33
|
atom "year", "year"
|
|
25
34
|
atom "supplement", "sup"
|
data/lib/pubid/iho/renderer.rb
CHANGED
|
@@ -60,7 +60,13 @@ module Pubid
|
|
|
60
60
|
|
|
61
61
|
def render(context: nil, **opts)
|
|
62
62
|
id = @id
|
|
63
|
-
rendered = "#{id.publisher} #{id.class.type[:short]}-#{id.number}"
|
|
63
|
+
rendered = +"#{id.publisher} #{id.class.type[:short]}-#{id.number}"
|
|
64
|
+
# The S-158 member designator (issue #774): the canonical face
|
|
65
|
+
# is the official colon designator (`S-158:102`). The draft-era
|
|
66
|
+
# part-face spelling keeps its own face (` Part S-102`) through
|
|
67
|
+
# the part slot below — facets-spelling-only: the render keeps
|
|
68
|
+
# the input's spelling, equality/URN use the canonical shape.
|
|
69
|
+
rendered << ":#{id.checks_for}" if id.checks_for && !id.checks_for_face
|
|
64
70
|
FACES.each do |component, face|
|
|
65
71
|
value = face_value(id, component)
|
|
66
72
|
rendered << (face % value) if value
|
|
@@ -72,7 +78,9 @@ module Pubid
|
|
|
72
78
|
|
|
73
79
|
# nil = the face does not print. The citation face replaces the
|
|
74
80
|
# Part face (same containment slot: the citation letter IS the
|
|
75
|
-
# part), and it prints only on a spec citation.
|
|
81
|
+
# part), and it prints only on a spec citation. The S-158
|
|
82
|
+
# member's draft-era part face (`checks_for_face`, the part value
|
|
83
|
+
# as written) takes the Part slot the same way.
|
|
76
84
|
def face_value(id, component)
|
|
77
85
|
if component == :spec
|
|
78
86
|
return nil unless id.spec
|
|
@@ -80,6 +88,7 @@ module Pubid
|
|
|
80
88
|
return spec_citation(id)
|
|
81
89
|
end
|
|
82
90
|
return nil if component == :part && id.spec
|
|
91
|
+
return id.checks_for_face if component == :part && id.checks_for_face
|
|
83
92
|
|
|
84
93
|
id.public_send(component)
|
|
85
94
|
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
= IHO URN schemes
|
|
2
|
+
|
|
3
|
+
This file is the single home of the IHO flavor's URN documentation (the
|
|
4
|
+
per-flavor split of the former `docs/URN-SCHEMES.adoc`, owner ruling
|
|
5
|
+
2026-11-25: "for URN schemes how can we mix up different flavors in 1
|
|
6
|
+
file? SPLIT THE FILE!"). It covers the three schemes the flavor carries:
|
|
7
|
+
|
|
8
|
+
1. the official URN (`#to_urn`) — the adopted IHO MRN guidance form for
|
|
9
|
+
the S/P/M series, the legacy positional form for the B/C series;
|
|
10
|
+
2. the legacy positional `urn:iho:` grammar — decodable for every
|
|
11
|
+
series, emitted only by the B/C series;
|
|
12
|
+
3. the pubid-scheme URN (`#to_pubid_urn`) — pubid's own
|
|
13
|
+
`urn:pubid:iho:` codec, not governed by the IHO guidance.
|
|
14
|
+
|
|
15
|
+
The implementations are `lib/pubid/iho/urn_generator.rb` and
|
|
16
|
+
`lib/pubid/iho/urn_parser.rb`; the flavor's component law lives in
|
|
17
|
+
`lib/pubid/iho/CLAUDE.md`.
|
|
18
|
+
|
|
19
|
+
== The adopted IHO MRN guidance (owner ruling, 2026-11-25)
|
|
20
|
+
|
|
21
|
+
Source: S-100WG4, "MRN Guidelines for IHO" (the IHO Level guidance for
|
|
22
|
+
publications, pages 8-9). The guidance proposes the Publications MRN
|
|
23
|
+
|
|
24
|
+
urn:mrn:iho:pub:<publication type>:<publication name or number>:<edition number>[:<correction number>[:<clarification number>[:<optional and additional version information>]]]
|
|
25
|
+
|
|
26
|
+
with the publication types `bathy` | `cb` | `reg` | `per` | `spec`, and
|
|
27
|
+
the example `urn:mrn:iho:pub:spec:s57:3:1:supplement3` (S-57 Ed 3,
|
|
28
|
+
Corr. 1, Supplement 3). IHO's own printed S-98 metadata carries
|
|
29
|
+
`urn:mrn:iho:pub:spec:s98:1.0.0` — the DOTTED edition in the canonical
|
|
30
|
+
4th position, which this flavor adopts verbatim.
|
|
31
|
+
|
|
32
|
+
pubid adopts the guidance as the flavor's official-URN emission for the
|
|
33
|
+
series the guidance types:
|
|
34
|
+
|
|
35
|
+
[cols="3,1,4,4",options="header"]
|
|
36
|
+
|===
|
|
37
|
+
| series | type | law | example
|
|
38
|
+
| 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
|
+
| 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
|
+
| 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 (Bibliographic) | — | no guidance code: the legacy emission below, until IHO assigns one | `IHO B-4 2.19.0` → `urn:iho:b:4:ed-2.19.0`
|
|
42
|
+
| C (Circular Letter) | — | no guidance code: the legacy emission below, until IHO assigns one | `IHO C-13 1.0.0` → `urn:iho:c:13:ed-1.0.0`
|
|
43
|
+
|===
|
|
44
|
+
|
|
45
|
+
=== The name form
|
|
46
|
+
|
|
47
|
+
`<name>` is the lowercase series letter + number — the guidance's own
|
|
48
|
+
`s57`/`s98` spelling:
|
|
49
|
+
|
|
50
|
+
IHO S-100 -> urn:mrn:iho:pub:spec:s100
|
|
51
|
+
|
|
52
|
+
=== The S-158 member encoding (issue #774)
|
|
53
|
+
|
|
54
|
+
S-158 is a framework publication defining a series of separate check
|
|
55
|
+
specifications (`S-158:100` generic, `S-158:1xx` product-specific,
|
|
56
|
+
`S-158:98` interoperability, `S-158:128` catalogue; the `checks_for`
|
|
57
|
+
component carries the member number). The member joins the name segment
|
|
58
|
+
hyphenated — the documented fleet extension of the guidance for
|
|
59
|
+
compound publication numbers — so the edition stays in its canonical
|
|
60
|
+
4th position exactly like the S-98 metadata:
|
|
61
|
+
|
|
62
|
+
S-158 1.0.0 -> urn:mrn:iho:pub:spec:s158:1.0.0
|
|
63
|
+
S-158:102 1.0.0 -> urn:mrn:iho:pub:spec:s158-102:1.0.0
|
|
64
|
+
|
|
65
|
+
The member designator is order-stable: every citation spelling
|
|
66
|
+
(`S-158 0.2.0 Part S-102`, `S-158 Part S-102 0.2.0`, `S-158-S-102`,
|
|
67
|
+
the draft-era aliases of issue #775) emits the identical URN.
|
|
68
|
+
|
|
69
|
+
=== The edition segment
|
|
70
|
+
|
|
71
|
+
The dotted `x.y.z` edition emits BARE (not `ed-`-prefixed), in the
|
|
72
|
+
canonical 4th segment — the S-98 precedent. An edition-non-specific
|
|
73
|
+
reference emits no edition segment. A component's own edition (the
|
|
74
|
+
separately-published mode) rides as `ed-` right after its component,
|
|
75
|
+
keeping the two modes decodable:
|
|
76
|
+
|
|
77
|
+
IHO P-6 Vol. 2 1.0.1 -> urn:mrn:iho:pub:per:p6:vol-2:ed-1.0.1
|
|
78
|
+
IHO S-98 Part A 1.0.0 (2024) -> urn:mrn:iho:pub:spec:s98:part-A:ed-1.0.0:year-2024
|
|
79
|
+
|
|
80
|
+
=== The trailing atoms
|
|
81
|
+
|
|
82
|
+
The components the guidance's tail slots do not model emit as
|
|
83
|
+
lowercase marker segments, RFC 3986-safe, in the containment order.
|
|
84
|
+
Values are case-preserved (identity law: `part-A` and `part-a` are
|
|
85
|
+
distinct documents; `appendix-D-2` keeps its letter). The Appendix
|
|
86
|
+
subnumber hyphen-joins its appendix as one compound segment; the base
|
|
87
|
+
with-year qualifier keeps its `year-` marker; the S-4 spec citation is
|
|
88
|
+
a child of its part (`spec-`, `specsub-`, `specvar-`; the SECTION is
|
|
89
|
+
derivable, never emitted):
|
|
90
|
+
|
|
91
|
+
[:year-<yyyy>][:sup-<n>[:ed-…][:year-…]]
|
|
92
|
+
[:part-<X>[:ed-…][:year-…]]
|
|
93
|
+
[:spec-<n>[:specsub-<n>][:specvar-<X>]]
|
|
94
|
+
[:annex-<A>[…]]
|
|
95
|
+
[:appendix-<B>[-<sub>][…]]
|
|
96
|
+
[:vol-<n>[:issue-<n>][…]]
|
|
97
|
+
|
|
98
|
+
Examples:
|
|
99
|
+
|
|
100
|
+
IHO S-100 5.0.0 Part 2 (2024) -> urn:mrn:iho:pub:spec:s100:5.0.0:year-2024:part-2
|
|
101
|
+
IHO S-122 1.0.0 Appendix D-2 -> urn:mrn:iho:pub:spec:s122:1.0.0:appendix-D-2
|
|
102
|
+
IHO S-4 4.10.0 B-401 -> urn:mrn:iho:pub:spec:s4:4.10.0:part-B:spec-401
|
|
103
|
+
IHO P-1 Vol. 30 (2) -> urn:mrn:iho:pub:per:p1:vol-30:issue-2
|
|
104
|
+
|
|
105
|
+
The guidance's bare correction/clarification slots (the `s57:3:1`
|
|
106
|
+
form) are NOT modeled faces — the flavor has no correction component —
|
|
107
|
+
and a bare digit tail segment rejects on decode.
|
|
108
|
+
|
|
109
|
+
== The legacy positional grammar (decode-only for S/P/M; the B/C emission)
|
|
110
|
+
|
|
111
|
+
The pre-guidance emission — `urn:iho:<type>:<number>[:ed-<x.y.z>]
|
|
112
|
+
[:sup-…][:part-…][:annex-…][:appendix-…][:<sub>][:vol-…][:issue-…]
|
|
113
|
+
[:year-…]` — stays fully decodable for every series and remains the
|
|
114
|
+
emission of the B/C series (no guidance type code). Its laws:
|
|
115
|
+
|
|
116
|
+
- the docnumber occupies the first bare number segment; a further bare
|
|
117
|
+
digit segment binds the S-158 member (`urn:iho:s:158:100`), never
|
|
118
|
+
glued into the number (issue #774);
|
|
119
|
+
- `ed-` and `year-` are POSITIONAL: the edition attaches to the node it
|
|
120
|
+
follows (the base when no component precedes it, else that
|
|
121
|
+
component's own edition); a year belongs to a component only when it
|
|
122
|
+
follows that component's own edition;
|
|
123
|
+
- containment: part ⊃ annex ⊃ appendix ⊃ subnumber (the bare digit
|
|
124
|
+
atom, only directly after its appendix); vol ⊃ issue;
|
|
125
|
+
- the number may span bare segments only through the member slot; a
|
|
126
|
+
colon number and a volume stay distinct because the volume is
|
|
127
|
+
marker-tagged (`urn:iho:s:158:2024` vs `urn:iho:s:158:vol-2024` —
|
|
128
|
+
the #637 hazard, kept under the positional scheme);
|
|
129
|
+
- the legacy 2.0.x spellings (the dotted keys `part.4a`/`suppl.1`/
|
|
130
|
+
`ap.A`/`vol.30`/`issue.2`/`appendix.D-2`, the bare `a.b.c` edition
|
|
131
|
+
segment, the `y.2024` yearbook tag) decode but are never emitted.
|
|
132
|
+
|
|
133
|
+
Both decode paths build through `Builder.build` — the S-158 alias
|
|
134
|
+
unification (a draft-era `part-S-102` URN resolves to the
|
|
135
|
+
`checks_for` identity) and every other semantic validation is shared
|
|
136
|
+
with the text parse.
|
|
137
|
+
|
|
138
|
+
== The pubid-scheme URN (`urn:pubid:iho:`)
|
|
139
|
+
|
|
140
|
+
pubid's own lossless codec (issue #670;
|
|
141
|
+
`lib/pubid/iho/pubid_urn_schema.rb`). NOT governed by the IHO guidance
|
|
142
|
+
— the atoms carry the full typed model and always round-trip
|
|
143
|
+
(`Pubid.parse_urn(id.to_pubid_urn).to_hash == id.to_hash`).
|
|
144
|
+
|
|
145
|
+
urn:pubid:iho:std:100:ed-5.0.0:year-2024:part-2 IHO S-100 5.0.0 Part 2 (2024)
|
|
146
|
+
urn:pubid:iho:std:158:checks-102:ed-1.0.0 IHO S-158:102 1.0.0
|
|
147
|
+
urn:pubid:iho:std:122:ed-1.0.0:appendix-D:appsub-2 IHO S-122 1.0.0 Appendix D-2
|
|
148
|
+
urn:pubid:iho:pub:5:vol-2024 IHO P-5 Vol. 2024
|
|
149
|
+
|
|
150
|
+
Types: `std` (S), `pub` (P), `m` (M), `b` (B), `cl` (C), `id`.
|
|
151
|
+
Atoms, canonical order: `checks-` (the S-158 member, riding the
|
|
152
|
+
document code before the edition — issue #774), `ed-`, `year-`,
|
|
153
|
+
`sup-`/`suped-`/`supyear-`, `part-`/`parted-`/`party-`, `spec-`/
|
|
154
|
+
`specsub-`/`specvar-`, `annex-`/`anned-`/`annyear-`, `appendix-`/
|
|
155
|
+
`appsub-`/`apped-`/`appyear-`, `vol-`/`issue-`/`voled-`/`voly-`. Case
|
|
156
|
+
is preserved (`part-A`); the yearbook year is a volume (`vol-2024`, no
|
|
157
|
+
`year-` value). The S-158 member emits the typed `checks-<NNN>` atom —
|
|
158
|
+
the draft-era part-faceted emission (`part-S-102`, `parted-`) is dead:
|
|
159
|
+
the `from_hash` unification redirects the legacy form onto the
|
|
160
|
+
`checks_for` identity, so the legacy URN fails the canonical gate.
|
|
161
|
+
|
|
162
|
+
== relaton-side follow-ups (not this repo)
|
|
163
|
+
|
|
164
|
+
The official-URN namespace moved (`urn:mrn:iho:pub:...` for S/P/M) and
|
|
165
|
+
the S-158 member shape changed (`s158-102`, not `s:158:100` or the
|
|
166
|
+
part form): relaton-data-iho needs a re-crawl when this gem ships, and
|
|
167
|
+
the frozen testsuite corpus rows are re-frozen in the coupled corpus
|
|
168
|
+
round. The pubid-scheme slugs changed for S-158 identities
|
|
169
|
+
(`iho/std/158/checks-102/...`).
|
|
@@ -4,14 +4,62 @@ module Pubid
|
|
|
4
4
|
module Iho
|
|
5
5
|
# Generates URN strings for IHO identifiers.
|
|
6
6
|
#
|
|
7
|
-
# The
|
|
8
|
-
# grammar header in pubid-grammar's grammars/iho.parg and the flavor
|
|
9
|
-
# notes): containment-ordered, one semantic atom per segment, every
|
|
10
|
-
# non-number component a marker-prefixed segment whose marker is the
|
|
11
|
-
# lowercased human-face token (edition follows ISO's ed- precedent):
|
|
7
|
+
# == The adopted IHO MRN guidance (owner ruling, 2026-11-25)
|
|
12
8
|
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
9
|
+
# The series the guidance gives a publication type emit the guidance
|
|
10
|
+
# form (S-100WG4, "MRN Guidelines for IHO"; the guidance's own
|
|
11
|
+
# examples are s57 / urn:mrn:iho:pub:spec:s57:3:1:supplement3 and —
|
|
12
|
+
# IHO's printed S-98 metadata — urn:mrn:iho:pub:spec:s98:1.0.0):
|
|
13
|
+
#
|
|
14
|
+
# urn:mrn:iho:pub:<type>:<name>[:<edition>][:<trailing atoms>...]
|
|
15
|
+
#
|
|
16
|
+
# - <type>: spec (S series, Standards and Specifications) / per
|
|
17
|
+
# (P series, periodic publications) / reg (M series, Miscellaneous
|
|
18
|
+
# Base Regulatory Publications). The B (Bibliographic) and C
|
|
19
|
+
# (Circular Letter) series have no guidance type code — until IHO
|
|
20
|
+
# assigns one they keep the legacy positional emission below.
|
|
21
|
+
# - <name>: sNNN — the lowercase series letter + number. The S-158
|
|
22
|
+
# member joins the name segment hyphenated (the fleet extension of
|
|
23
|
+
# the guidance for compound publication numbers, keeping the
|
|
24
|
+
# edition in its canonical 4th position):
|
|
25
|
+
#
|
|
26
|
+
# S-158 1.0.0 -> urn:mrn:iho:pub:spec:s158:1.0.0
|
|
27
|
+
# S-158:102 1.0.0 -> urn:mrn:iho:pub:spec:s158-102:1.0.0
|
|
28
|
+
#
|
|
29
|
+
# - <edition>: the bare dotted x.y.z, NOT ed-prefixed (the S-98
|
|
30
|
+
# precedent). Absent for an edition-non-specific reference.
|
|
31
|
+
# - The trailing atoms carry the components the guidance's tail
|
|
32
|
+
# slots do not model: lowercase marker tokens, RFC 3986-safe,
|
|
33
|
+
# values case-preserved (identity law: part-A and part-a are
|
|
34
|
+
# distinct documents). A component's own edition rides as ed-
|
|
35
|
+
# right after it (the duality law); the Appendix subnumber
|
|
36
|
+
# hyphen-joins its appendix; the base with-year qualifier keeps
|
|
37
|
+
# its year- marker. The guidance's bare correction/clarification
|
|
38
|
+
# slots (the s57:3:1 form) are not modeled faces — never emitted.
|
|
39
|
+
#
|
|
40
|
+
# Examples (the guidance form):
|
|
41
|
+
# - urn:mrn:iho:pub:spec:s44:5.0.0 IHO S-44 5.0.0
|
|
42
|
+
# - urn:mrn:iho:pub:spec:s100:5.0.0:year-2024:part-2 IHO S-100 5.0.0 Part 2 (2024)
|
|
43
|
+
# - urn:mrn:iho:pub:spec:s122:1.0.0:appendix-D-2 IHO S-122 1.0.0 Appendix D-2
|
|
44
|
+
# - urn:mrn:iho:pub:spec:s4:4.10.0:part-B:spec-401 IHO S-4 4.10.0 B-401
|
|
45
|
+
# - urn:mrn:iho:pub:spec:s158-102:1.0.0 IHO S-158:102 1.0.0
|
|
46
|
+
# - urn:mrn:iho:pub:reg:m2:sup-1 IHO M-2 Sup 1
|
|
47
|
+
# - urn:mrn:iho:pub:per:p5:vol-2024 IHO P-5 Vol. 2024
|
|
48
|
+
#
|
|
49
|
+
# == The legacy positional scheme (the B/C emission; decodable for
|
|
50
|
+
# every series, never emitted for S/P/M)
|
|
51
|
+
#
|
|
52
|
+
# The pre-guidance positional grammar (containment-ordered, one
|
|
53
|
+
# semantic atom per segment, marker = the lowercased human-face
|
|
54
|
+
# token; ed- follows ISO's RFC 5141 precedent):
|
|
55
|
+
#
|
|
56
|
+
# urn:iho:<type>:<number>[:ed-<x.y.z>][:year-<yyyy>]
|
|
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>][...]]
|
|
15
63
|
# [:year-<yyyy>]
|
|
16
64
|
#
|
|
17
65
|
# Containment: part contains annexes, annex contains appendices, the
|
|
@@ -20,18 +68,10 @@ module Pubid
|
|
|
20
68
|
# locator — the yearbook year IS a volume (P-5 Vol. 2024 gives
|
|
21
69
|
# vol-2024), so a periodical identifier has no year segment; the
|
|
22
70
|
# year- segment exists only for the standards with-year qualifier.
|
|
23
|
-
# Both are marker-tagged so neither can collide with a colon-number
|
|
24
|
-
# segment (the number is not escaped and may span bare segments:
|
|
25
|
-
# "IHO S-158:100" gives "urn:iho:s:158:100").
|
|
26
71
|
#
|
|
27
|
-
# Examples:
|
|
28
|
-
# - urn:iho:
|
|
29
|
-
# - urn:iho:
|
|
30
|
-
# - urn:iho:s:122:ed-1.0.0:appendix-D:2 IHO S-122 1.0.0 Appendix D-2
|
|
31
|
-
# - urn:iho:m:2:sup-1 IHO M-2 Sup 1
|
|
32
|
-
# - urn:iho:p:5:vol-2024 IHO P-5 Vol. 2024
|
|
33
|
-
# - urn:iho:p:1:vol-30:issue-2 IHO P-1 Vol. 30 (2)
|
|
34
|
-
# - urn:iho:s:4:ed-4.10.0:part-B:spec-401 IHO S-4 4.10.0 B-401
|
|
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
|
|
35
75
|
class UrnGenerator
|
|
36
76
|
attr_reader :identifier
|
|
37
77
|
|
|
@@ -39,12 +79,39 @@ module Pubid
|
|
|
39
79
|
@identifier = identifier
|
|
40
80
|
end
|
|
41
81
|
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
|
|
82
|
+
# The guidance publication type per series letter. S = Standards
|
|
83
|
+
# and Specifications -> spec (the owner ruling names the guidance
|
|
84
|
+
# code explicitly); P = the periodic publications -> per; M =
|
|
85
|
+
# Miscellaneous (Base Regulatory Publications) -> reg. B and C
|
|
86
|
+
# have no guidance code (legacy emission until IHO assigns one).
|
|
87
|
+
MRN_TYPES = { "S" => "spec", "P" => "per", "M" => "reg" }.freeze
|
|
88
|
+
|
|
89
|
+
# The guidance-form trailing atoms in containment order — the same
|
|
90
|
+
# order the legacy scheme prints them. The Appendix subnumber is
|
|
91
|
+
# handled inline (it hyphen-joins its appendix, one compound
|
|
92
|
+
# segment); the checks_for member rides the name segment.
|
|
93
|
+
MRN_SEGMENTS = [
|
|
94
|
+
[:year, "year"],
|
|
95
|
+
[:supplement, "sup"], [:supplement_edition, "ed"],
|
|
96
|
+
[:supplement_year, "year"],
|
|
97
|
+
[:part, "part"], [:part_edition, "ed"], [:part_year, "year"],
|
|
98
|
+
# the S-4 spec citation: a child of its part (the citation
|
|
99
|
+
# letter rides the part- atom); the SECTION is NOT emitted —
|
|
100
|
+
# derivable from the spec's hundreds digit.
|
|
101
|
+
[:spec, "spec"], [:spec_sub, "specsub"], [:spec_variant, "specvar"],
|
|
102
|
+
[:annex, "annex"], [:annex_edition, "ed"], [:annex_year, "year"],
|
|
103
|
+
[:appendix, "appendix"], [:appendix_subnumber, nil],
|
|
104
|
+
[:appendix_edition, "ed"], [:appendix_year, "year"],
|
|
105
|
+
[:volume, "vol"], [:issue, "issue"], [:volume_edition, "ed"],
|
|
106
|
+
[:volume_year, "year"]
|
|
107
|
+
].freeze
|
|
108
|
+
|
|
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).
|
|
48
115
|
SEGMENTS = [
|
|
49
116
|
[:edition, "ed"], [:year, "year"],
|
|
50
117
|
[:supplement, "sup"], [:supplement_edition, "ed"],
|
|
@@ -52,8 +119,7 @@ module Pubid
|
|
|
52
119
|
[:part, "part"], [:part_edition, "ed"], [:part_year, "year"],
|
|
53
120
|
# the S-4 spec citation: a child of its part (the citation
|
|
54
121
|
# letter rides the part- atom), the dotted sub and the
|
|
55
|
-
# parenthesized variant its own children.
|
|
56
|
-
# emitted — derivable from the spec's hundreds digit.
|
|
122
|
+
# parenthesized variant its own children.
|
|
57
123
|
[:spec, "spec"], [:spec_sub, "specsub"], [:spec_variant, "specvar"],
|
|
58
124
|
[:annex, "annex"], [:annex_edition, "ed"], [:annex_year, "year"],
|
|
59
125
|
[:appendix, "appendix"], [:appendix_subnumber, nil],
|
|
@@ -63,6 +129,57 @@ module Pubid
|
|
|
63
129
|
].freeze
|
|
64
130
|
|
|
65
131
|
def generate
|
|
132
|
+
letter = identifier.class.type[:short].to_s
|
|
133
|
+
MRN_TYPES[letter] ? generate_mrn(MRN_TYPES[letter]) : generate_legacy
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
private
|
|
137
|
+
|
|
138
|
+
# The guidance form: type, name (sNNN / s158-NNN), the bare dotted
|
|
139
|
+
# edition, then the trailing atoms in containment order.
|
|
140
|
+
def generate_mrn(mrn_type)
|
|
141
|
+
parts = ["urn:mrn:iho:pub", mrn_type, mrn_name]
|
|
142
|
+
parts << identifier.edition if identifier.edition
|
|
143
|
+
parts.concat(mrn_segments)
|
|
144
|
+
parts.join(":")
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
# The lowercase name form (the guidance's "s57"/"s98" spelling).
|
|
148
|
+
# The S-158 member joins hyphenated so the edition stays in its
|
|
149
|
+
# canonical 4th position: s158-102.
|
|
150
|
+
def mrn_name
|
|
151
|
+
name = +"#{identifier.class.type[:short].downcase}#{identifier.number}"
|
|
152
|
+
name << "-#{identifier.checks_for}" if identifier.checks_for
|
|
153
|
+
name
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def mrn_segments
|
|
157
|
+
MRN_SEGMENTS.filter_map do |component, marker|
|
|
158
|
+
case component
|
|
159
|
+
when :appendix
|
|
160
|
+
value = identifier.appendix
|
|
161
|
+
next unless value
|
|
162
|
+
|
|
163
|
+
segment = +"appendix-#{value}"
|
|
164
|
+
# the subnumber hyphen-joins its appendix (one compound
|
|
165
|
+
# segment, RFC 3986-safe)
|
|
166
|
+
segment << "-#{identifier.appendix_subnumber}" if
|
|
167
|
+
identifier.appendix_subnumber
|
|
168
|
+
segment
|
|
169
|
+
when :appendix_subnumber
|
|
170
|
+
next # compound-joined into its appendix segment above
|
|
171
|
+
else
|
|
172
|
+
value = identifier.public_send(component)
|
|
173
|
+
next unless value
|
|
174
|
+
|
|
175
|
+
"#{marker}-#{value}"
|
|
176
|
+
end
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# The legacy positional form (B/C today; the shape every legacy
|
|
181
|
+
# urn:iho: URN decodes from).
|
|
182
|
+
def generate_legacy
|
|
66
183
|
parts = ["urn", "iho"]
|
|
67
184
|
parts << identifier.class.type[:short].to_s.downcase
|
|
68
185
|
parts << identifier.number.to_s
|
|
@@ -70,8 +187,6 @@ module Pubid
|
|
|
70
187
|
parts.join(":")
|
|
71
188
|
end
|
|
72
189
|
|
|
73
|
-
private
|
|
74
|
-
|
|
75
190
|
def component_segments
|
|
76
191
|
SEGMENTS.filter_map do |component, marker|
|
|
77
192
|
value = identifier.public_send(component)
|