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
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
= IALA URN schemes
|
|
2
|
+
|
|
3
|
+
The IALA flavor carries two URN forms: the official Maritime Resource
|
|
4
|
+
Name (`#to_urn`) and the pubid scheme (`#to_pubid_urn`, the round-trip
|
|
5
|
+
codec). This file is the flavor's URN record; the mixed
|
|
6
|
+
`docs/URN-SCHEMES.adoc` keeps its per-flavor snapshots frozen.
|
|
7
|
+
|
|
8
|
+
== Official URN: the IALA MRN scheme (`#to_urn`)
|
|
9
|
+
|
|
10
|
+
IALA owns the `mrn` URN namespace's IALA subtree. The scheme is defined
|
|
11
|
+
by three IALA documents, all published through the IALA MRN portal
|
|
12
|
+
(https://www.iala.int/technical/data-modelling-mrn/):
|
|
13
|
+
|
|
14
|
+
* *IALA Recommendation (Normative) R1023, Maritime Resource Names, Ed
|
|
15
|
+
1.0, June 2022* —
|
|
16
|
+
https://www.iala.int/technical/data-modelling-mrn/ (R1023). Normative
|
|
17
|
+
root: it ADOPTS the MRN and RECOMMENDS observing G1143; its own cover
|
|
18
|
+
and every page footer print the attested publication form
|
|
19
|
+
`urn:mrn:iala:pub:r1023:ed1.0`.
|
|
20
|
+
* *IALA Guideline G1143, Unique Identifiers for Maritime Resources, Ed
|
|
21
|
+
3.1* —
|
|
22
|
+
https://www.iala.int/technical/data-modelling-mrn/ (G1143). The
|
|
23
|
+
structure-and-use authority R1023 points at: the ABNF, the character
|
|
24
|
+
set, case rules, and the per-type annexes.
|
|
25
|
+
* *IALA Guideline G1164, Management of MRN Organisation Identifiers,
|
|
26
|
+
Ed 1.1* —
|
|
27
|
+
https://www.iala.int/technical/data-modelling-mrn/ (G1164). The
|
|
28
|
+
org-ID governance: rules for OIDs, IALA's own org id, and the
|
|
29
|
+
application procedure.
|
|
30
|
+
|
|
31
|
+
=== The derived scheme
|
|
32
|
+
|
|
33
|
+
G1143 §5.1/§5.2 define the MRN as
|
|
34
|
+
`urn:mrn:<governing-organization>:<type>:<type-specific-part>` with the
|
|
35
|
+
type (the Organization-specific namespace ID) a minimum of three
|
|
36
|
+
*lowercase alphanumeric* characters, the whole MRN case-insensitive and
|
|
37
|
+
conventionally lowercase (§5.1.3). The flavor emits:
|
|
38
|
+
|
|
39
|
+
----
|
|
40
|
+
urn:mrn:iala:pub:<doc-id>[:annex[-<letter>]][:ed<edition>][:<lang>]
|
|
41
|
+
----
|
|
42
|
+
|
|
43
|
+
[cols="3,1,4",options="header"]
|
|
44
|
+
|===
|
|
45
|
+
| segment | rule | source
|
|
46
|
+
| `urn:mrn:` | lowercase conventional (case-insensitive) | G1143 §5.1
|
|
47
|
+
| `iala` | IALA's Organization ID (min 3 lowercase alphanumerics, never
|
|
48
|
+
an ISO 3166-1 alpha-3 code) | G1164 §3.1; the portal's OID registry
|
|
49
|
+
row `urn:mrn:iala:`
|
|
50
|
+
| `pub` | the publication type, 3 lowercase alphanumerics (G1143 Annex
|
|
51
|
+
A4; the other defined types are `aton`, `vts`, `wwy`, and the
|
|
52
|
+
wildcards `obj`/`int`) | G1143 §5.2, Annex A
|
|
53
|
+
| `<doc-id>` | the lowercase document identifier in IALA's managed
|
|
54
|
+
namespace: the legacy series codes joined letter+number (`s1070`,
|
|
55
|
+
`r0126`, `c0103-1`, `m0001`, `ga01.01`, `l2.1.11`, `a12-01`, the
|
|
56
|
+
reserved `x0123`, `p0123`) and the S-100-family codes hyphenated
|
|
57
|
+
(`s-201` … `s-299`) | G1143 Annex A4
|
|
58
|
+
| `annex[-<letter>]` | the Annex wrapper (lettered form for `ANNEX`
|
|
59
|
+
A-style, bare for `Annex` without a letter; the letter carries the
|
|
60
|
+
sub-numbered S-100 annex letters, `annex-b2`) — a managed-namespace
|
|
61
|
+
extension; no cover prints it yet | G1143 Annex A4 (the managed
|
|
62
|
+
namespace is IALA's to define)
|
|
63
|
+
| `ed<edition>` | the edition glued after the lowercase `ed` marker,
|
|
64
|
+
digits verbatim in IALA's own face: dotted `x.y` for the legacy
|
|
65
|
+
series (`ed1.0`, `ed3.1`, `ed2.0` — the cover/footer forms of R1023,
|
|
66
|
+
G1143 and G1164, and G1164 §2's `urn:mrn:iala:pub:g1143:ed2.0`
|
|
67
|
+
example), dotted `x.y.z` for the S-100-family product specifications
|
|
68
|
+
(`ed2.0.0`, IALA S-201 Edition 2.0.0) | R1023/G1143/G1164 covers;
|
|
69
|
+
G1164 §2
|
|
70
|
+
| `<lang>` | one lowercase letter (`e`, `f`, `s`) — the catalogue's own
|
|
71
|
+
language suffix form (`urn:mrn:iala:pub:a12-01:e`) | relaton-data-iala
|
|
72
|
+
assigned MRNs
|
|
73
|
+
|===
|
|
74
|
+
|
|
75
|
+
=== Divergences found against the official rules (2026-11 revamp)
|
|
76
|
+
|
|
77
|
+
* The S-100-family product specifications were outside the grammar:
|
|
78
|
+
`S-201 2.0.0` raised in the flavor, the lower-case spelling fell to
|
|
79
|
+
the codeless `Publication` (`#to_urn` nil), and the bare string was
|
|
80
|
+
claimed by the WMO flavor's generic S-rule — the wrong organization's
|
|
81
|
+
namespace (`urn:mrn:wmo:pub:s-201:ed2.0.0`). The IHO grant fixes the
|
|
82
|
+
range (S-201..S-299, hundreds digit 2), the hyphenated lexical form,
|
|
83
|
+
and the dotted edition; the exact round trip on the bare face now
|
|
84
|
+
routes the strings here, while WMO keeps its own S-4xx (the
|
|
85
|
+
pubid#469/#763 dual-perspective law: the lexical form leads no
|
|
86
|
+
prefix; each org assigns its own identifier).
|
|
87
|
+
* Everything already attested was verified conformant and unchanged:
|
|
88
|
+
the 15 cover/footer URNs transcribed into the testsuite corpus and
|
|
89
|
+
the 687 catalogue-assigned MRNs in relaton-data-iala all match the
|
|
90
|
+
emission (lowercase doc id, `pub` type, glued `ed` marker, dotted
|
|
91
|
+
editions, `:lang` suffix). No frozen URN changed in the revamp.
|
|
92
|
+
* The corpus-attested malformed R1026 spellings (`Ed1.0`, `ed.1.0`)
|
|
93
|
+
stay parse-accepted as normalization aliases; the canonical emission
|
|
94
|
+
is the lowercase glued form.
|
|
95
|
+
|
|
96
|
+
=== Parse acceptance
|
|
97
|
+
|
|
98
|
+
The MRN is case-insensitive (G1143 §5.1.3): the namespace, the code,
|
|
99
|
+
the annex segments, the `ed` marker and the language letter all parse
|
|
100
|
+
in any case. The parser rebuilds the human identifier through the
|
|
101
|
+
grammar, so URN decode and string parse share one construction path.
|
|
102
|
+
|
|
103
|
+
== The pubid-scheme URN (`#to_pubid_urn`)
|
|
104
|
+
|
|
105
|
+
Namespace: `urn:pubid:iala:` (the `_type` flavor segment). Schema:
|
|
106
|
+
`lib/pubid/iala/pubid_urn_schema.rb`; the fleet-wide design rules live
|
|
107
|
+
in the root `CLAUDE.md`'s URN bullet (issue #656).
|
|
108
|
+
|
|
109
|
+
[cols="3,1,1,1,4",options="header"]
|
|
110
|
+
|===
|
|
111
|
+
| `_type` | token | core | example
|
|
112
|
+
| `pubid:iala:advice` | `advice` | number | `IALA A12-01`
|
|
113
|
+
| `pubid:iala:annex` | `annex` | number | `IALA G1045 Annex Ed 1`
|
|
114
|
+
| `pubid:iala:general-assembly` | `ga` | number | `IALA GA01.01`
|
|
115
|
+
| `pubid:iala:guideline` | `g` | number | `urn:mrn:iala:pub:g1195:ed1.0`
|
|
116
|
+
| `pubid:iala:identifier` | `id` | number | —
|
|
117
|
+
| `pubid:iala:letter` | `letter` | number | `IALA L2.1.11 Ed 2`
|
|
118
|
+
| `pubid:iala:manual` | `manual` | number | `IALA M0001 Ed 9.0`
|
|
119
|
+
| `pubid:iala:model-course` | `mc` | number | `urn:mrn:iala:pub:c0103-1:ed3.0`
|
|
120
|
+
| `pubid:iala:product-specification` | `ps` | number | `S-201 2.0.0`
|
|
121
|
+
| `pubid:iala:publication` | `pub` | number | `IALA arctic-seminar-report (E)`
|
|
122
|
+
| `pubid:iala:recommendation` | `rec` | number | `urn:mrn:iala:pub:r1023:ed1.0`
|
|
123
|
+
| `pubid:iala:report` | `rpt` | number | —
|
|
124
|
+
| `pubid:iala:resolution` | `r` | number | —
|
|
125
|
+
| `pubid:iala:standard` | `std` | number | `urn:mrn:iala:pub:s1040:ed2.0`
|
|
126
|
+
|===
|
|
127
|
+
|
|
128
|
+
Atoms, canonical order: `ed-` (`edition`), `lang-` (`language`),
|
|
129
|
+
`annexform-` (`annex_form`), `letter-` (`letter`).
|
|
130
|
+
|
|
131
|
+
The codeless publications (`pub`, the product-URL slug as core
|
|
132
|
+
`number`) have no official URN: `#to_urn` is nil, because IALA assigns
|
|
133
|
+
them no MRN (the #772 ruling).
|
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
module Pubid
|
|
4
4
|
module Iala
|
|
5
5
|
# Generates URN strings for IALA identifiers using the Maritime Resource
|
|
6
|
-
# Name (MRN) namespace that IALA prints on its cover pages
|
|
6
|
+
# Name (MRN) namespace that IALA prints on its cover pages — the
|
|
7
|
+
# official scheme of IALA Recommendation R1023 (Maritime Resource
|
|
8
|
+
# Names, Ed 1.0, whose own cover prints urn:mrn:iala:pub:r1023:ed1.0)
|
|
9
|
+
# and Guideline G1143 (Unique Identifiers for Maritime Resources):
|
|
10
|
+
# urn:mrn:<org>:<type>:<type-specific-part> with IALA's Organization
|
|
11
|
+
# ID "iala" (G1164) and the publication type "pub" (G1143 Annex A4).
|
|
7
12
|
#
|
|
8
13
|
# Format: urn:mrn:iala:pub:<type-lower><number>[:ed<edition>][:<lang-lower>]
|
|
9
14
|
# Example: urn:mrn:iala:pub:s1070:ed2.0
|
|
10
15
|
# urn:mrn:iala:pub:r1016:ed2.0:f
|
|
16
|
+
# urn:mrn:iala:pub:s-201:ed2.0.0 (the S-100-family code face)
|
|
11
17
|
class UrnGenerator
|
|
12
18
|
attr_reader :identifier
|
|
13
19
|
|
|
@@ -30,10 +36,10 @@ module Pubid
|
|
|
30
36
|
# (with optional letter suffix), then the annex's own edition/lang.
|
|
31
37
|
# G1045 Annex Ed 1 → urn:mrn:iala:pub:g1045:annex:ed1
|
|
32
38
|
# G1128 ANNEX A Ed 1.6 (E) → urn:mrn:iala:pub:g1128:annex-a:ed1.6:e
|
|
39
|
+
# S-201 ANNEX B2 → urn:mrn:iala:pub:s-201:annex-b2
|
|
33
40
|
def generate_annex
|
|
34
41
|
base = identifier.base
|
|
35
|
-
parts = ["urn:mrn:iala:pub",
|
|
36
|
-
"#{base.type_letter.downcase}#{base.number}"]
|
|
42
|
+
parts = ["urn:mrn:iala:pub", base_code_segment(base)]
|
|
37
43
|
annex_seg = identifier.letter ? "annex-#{identifier.letter.downcase}" : "annex"
|
|
38
44
|
parts << annex_seg
|
|
39
45
|
parts << "ed#{identifier.edition}" if identifier.edition
|
|
@@ -42,7 +48,19 @@ module Pubid
|
|
|
42
48
|
end
|
|
43
49
|
|
|
44
50
|
def code_segment
|
|
45
|
-
|
|
51
|
+
base_code_segment(identifier)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# The lowercase document identifier in IALA's managed namespace
|
|
55
|
+
# (G1143 §5.1.3: the MRN is case-insensitive, conventionally
|
|
56
|
+
# written lowercase): the legacy series codes join letter and
|
|
57
|
+
# number ("s1070"), the S-100-family codes hyphenate ("s-201").
|
|
58
|
+
def base_code_segment(base)
|
|
59
|
+
if base.is_a?(Identifiers::ProductSpecification)
|
|
60
|
+
"s-#{base.number}"
|
|
61
|
+
else
|
|
62
|
+
"#{base.type_letter.downcase}#{base.number}"
|
|
63
|
+
end
|
|
46
64
|
end
|
|
47
65
|
end
|
|
48
66
|
end
|
|
@@ -15,8 +15,10 @@ module Pubid
|
|
|
15
15
|
# urn:mrn:iala:pub:c0103-1 → IALA C0103-1
|
|
16
16
|
# urn:mrn:iala:pub:g1045:annex:ed1 → IALA G1045 Annex Ed 1
|
|
17
17
|
# urn:mrn:iala:pub:g1128:annex-a:ed1.6 → IALA G1128 ANNEX A Ed 1.6
|
|
18
|
+
# urn:mrn:iala:pub:s-201:ed2.0.0 → IALA S-201 2.0.0
|
|
19
|
+
# urn:mrn:iala:pub:s-201:annex-b2 → IALA S-201 ANNEX B2
|
|
18
20
|
class UrnParser < Pubid::UrnParser::Base
|
|
19
|
-
PREFIX = "urn:mrn:iala:pub:"
|
|
21
|
+
PREFIX = "urn:mrn:iala:pub:"
|
|
20
22
|
|
|
21
23
|
def parse_urn(urn)
|
|
22
24
|
body = strip_namespace(urn)
|
|
@@ -30,17 +32,18 @@ module Pubid
|
|
|
30
32
|
|
|
31
33
|
parts.drop(1).each do |seg|
|
|
32
34
|
case seg
|
|
33
|
-
when /\Aannex(-([a-z]))?\z/i
|
|
35
|
+
when /\Aannex(-([a-z]\d?))?\z/i
|
|
34
36
|
# UrnGenerator emits "annex" (bare) for the Annex-without-letter
|
|
35
37
|
# form and "annex-X" (lettered) for the uppercase ANNEX form.
|
|
36
38
|
# The human parser accepts both "Annex" and "ANNEX"; mirror the
|
|
37
|
-
# generator's casing so URN round-trip is exact.
|
|
39
|
+
# generator's casing so URN round-trip is exact. The letter
|
|
40
|
+
# carries the sub-numbered S-100 annex letters ("annex-b2").
|
|
38
41
|
annex_letter = Regexp.last_match(2)&.upcase
|
|
39
42
|
annex_form = annex_letter ? "ANNEX" : "Annex"
|
|
40
43
|
# Edition marker: case-insensitive with an optional separator dot.
|
|
41
44
|
# Both variants occur in published documents (R1026 prints
|
|
42
45
|
# "Ed1.0" and "ed.1.0"); each parses to the canonical edition
|
|
43
|
-
# value and re-renders as lowercase "ed<x.
|
|
46
|
+
# value and re-renders as lowercase "ed<x.y[.z]>".
|
|
44
47
|
when /\Aed\.?/i
|
|
45
48
|
edition = seg.sub(/\Aed\.?/i, "")
|
|
46
49
|
when /\A[a-z]\z/i
|
|
@@ -51,6 +54,9 @@ module Pubid
|
|
|
51
54
|
text = "IALA #{code.upcase}"
|
|
52
55
|
text += " #{annex_form}" if annex_form
|
|
53
56
|
text += " #{annex_letter}" if annex_letter
|
|
57
|
+
# The S-100-family codes carry the bare dotted edition on the
|
|
58
|
+
# human face; the rebuilt text names the edition through the
|
|
59
|
+
# grammar's "Ed" alias and the renderer restores the bare face.
|
|
54
60
|
text += " Ed #{edition}" if edition
|
|
55
61
|
text += " (#{language})" if language
|
|
56
62
|
flavor_parse(text)
|
data/lib/pubid/iho/CLAUDE.md
CHANGED
|
@@ -15,22 +15,20 @@ obeys.
|
|
|
15
15
|
There is no `parser.rb` and no Parslet anywhere in this flavor: parse
|
|
16
16
|
goes `Pubid::Parg::Model.bound(:iho, ...)` — the artifact's
|
|
17
17
|
`bindings identifier` block delivers every component as an
|
|
18
|
-
attribute-named scalar, and `Builder`
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
pattern).
|
|
25
|
-
|
|
26
|
-
**Bake pin:** the artifact must be baked at parsanol 1.
|
|
27
|
-
grammar repo's `scripts/bake-one.rb` forces the gem
|
|
28
|
-
verifies the `compiler_version` stamp
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
## The component model (owner rulings, 2026-11-03)
|
|
18
|
+
attribute-named scalar, and `Builder` dispatches the series letter to
|
|
19
|
+
its concrete class and resolves two grammar-level aliases (the S-100
|
|
20
|
+
`v1`/`v5.1` shorthand pads `edition` to `1.0.0`/`5.1.0`; the S-158
|
|
21
|
+
draft-era part faces rebind onto `checks_for`). The artifact is baked
|
|
22
|
+
from `grammars/iho.parg` in pubid-grammar; the vendored twin
|
|
23
|
+
`data/parg/iho.parg` is the embedded source's provenance copy and must
|
|
24
|
+
move together with `data/parg/iho.json` (the ISO pattern).
|
|
25
|
+
|
|
26
|
+
**Bake pin:** the artifact must be baked at parsanol 1.5.1.0 (the
|
|
27
|
+
fleet pin; the grammar repo's `scripts/bake-one.rb` forces the gem
|
|
28
|
+
version and verifies the `compiler_version` stamp; bake at ruby 3.4.8).
|
|
29
|
+
|
|
30
|
+
## The component model (owner rulings, 2026-11-03; the S-158 series
|
|
31
|
+
model, issue #774, 2026-11-25)
|
|
34
32
|
|
|
35
33
|
Every component is a FIRST-CLASS SEMANTIC component: a typed `:string`
|
|
36
34
|
attribute, independently addressable, URN-encodable and matchable —
|
|
@@ -40,8 +38,9 @@ never a string suffix. All of them live flat on `Pubid::Iho::Identifier`
|
|
|
40
38
|
| component | attribute | canonical face | parse-only aliases |
|
|
41
39
|
|-------------|--------------------|-------------------|------------------------------|
|
|
42
40
|
| edition | `edition` | `1.0.0` (bare) | `v1`/`v5.1` (padded) |
|
|
41
|
+
| checks member | `checks_for` | `:102` (the S-158 colon designator) | `Part S-102`, `S-158-S-102`, `Part 102` (the draft-era faces; `checks_for_face` keeps the spelling) |
|
|
43
42
|
| supplement | `supplement` | `Sup 1` | `Suppl 1` |
|
|
44
|
-
| part | `part` | `Part A`/`Part 1
|
|
43
|
+
| part | `part` | `Part A`/`Part 1` | `S-5-B`, `S-100-1` (compact) |
|
|
45
44
|
| annex | `annex` | `Annex A` | — |
|
|
46
45
|
| appendix | `appendix` | `Appendix D` | `App`, `Ap.` |
|
|
47
46
|
| subnumber | `appendix_subnumber` | `-2` (joined) | — |
|
|
@@ -79,12 +78,24 @@ never a string suffix. All of them live flat on `Pubid::Iho::Identifier`
|
|
|
79
78
|
cited edition-less). The builder raises when both appear. Every
|
|
80
79
|
trailing edition now follows a component, so the historical
|
|
81
80
|
edition-last spellings reinterpret as component editions.
|
|
82
|
-
- **Series-reference parts
|
|
83
|
-
series
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
- **Series-reference parts are DEAD on S-158 (issue #774, the S-158
|
|
82
|
+
series model; S-158 Ed 1.0.0 clause 2.1):** S-158 is a framework
|
|
83
|
+
publication defining a series of separate check specifications —
|
|
84
|
+
S-158:100 (generic), S-158:1xx (one per S-100 product; :101 ENC,
|
|
85
|
+
:102 Bathymetric Surface), S-158:98 (interoperability), S-158:128
|
|
86
|
+
(catalogue) — each a publication of its own with its own edition
|
|
87
|
+
stream. The colon designator `S-158:102` is the PRIMARY form and
|
|
88
|
+
binds the typed `checks_for` component; the draft-era spellings
|
|
89
|
+
(`S-158 Part S-102`, `S-158-S-102`, `S-158 Part 102`) are
|
|
90
|
+
NON-NORMALIZED ALIASES of the same identity — facets-spelling-only
|
|
91
|
+
(the render keeps the Part face through `checks_for_face`;
|
|
92
|
+
equality/URN use the canonical shape), and the edition that follows
|
|
93
|
+
the part face is the BASE edition (the parted- mis-bind of #775 is
|
|
94
|
+
fixed). A series-reference-shaped part face rebinds only while
|
|
95
|
+
checks_for is UNBOUND: `S-158:100 Part 2` keeps a genuine part. The
|
|
96
|
+
member designator rides the S-158 anchor only (`S-44:5` rejects).
|
|
97
|
+
Lettered/compound part values on other series are untouched
|
|
98
|
+
(`S-100-1` stays Part 1).
|
|
88
99
|
- **Supplement canonical face is `Sup`** (the M-2 spelling — why save
|
|
89
100
|
two characters when Annex and Appendix stay full-length); `Suppl`
|
|
90
101
|
(the S-66 wild spelling) is the parse-only alias, never rendered.
|
|
@@ -162,49 +173,48 @@ Section 400` ≡ `IHO S-4 B-400` (one identity, two spellings).
|
|
|
162
173
|
`%i[date year edition version]` already covers `:year` and
|
|
163
174
|
`:edition`.
|
|
164
175
|
|
|
165
|
-
## URN
|
|
166
|
-
|
|
167
|
-
The
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
-
|
|
193
|
-
|
|
194
|
-
-
|
|
195
|
-
rejects unknown/reordered/duplicate/junk segments with
|
|
196
|
-
`Pubid::Errors::UrnParseError` (the ISO urn_parser strictness); it
|
|
197
|
-
builds through `Builder.build` from the decoded attributes, so URN
|
|
198
|
-
decode and string parse share one construction path.
|
|
176
|
+
## URN schemes — the adopted IHO MRN guidance + the legacy positional decode
|
|
177
|
+
|
|
178
|
+
The full scheme documentation lives in `lib/pubid/iho/urn.adoc` (the
|
|
179
|
+
per-flavor home of the former `docs/URN-SCHEMES.adoc` iho section; the
|
|
180
|
+
owner's per-flavor split ruling of 2026-11-25). The laws:
|
|
181
|
+
|
|
182
|
+
- **The S/P/M emission is the IHO MRN guidance form**
|
|
183
|
+
(`urn:mrn:iho:pub:<type>:<name>[:<edition>][:trailing...]`):
|
|
184
|
+
`spec` (S), `per` (P), `reg` (M); the name is the lowercase
|
|
185
|
+
`sNNN` (the guidance's own s57/s98 spelling); the dotted edition is
|
|
186
|
+
the bare canonical 4th segment; the S-158 member joins the name
|
|
187
|
+
hyphenated (`s158-102`, the fleet extension for compound publication
|
|
188
|
+
numbers). The B/C series have no guidance type code and keep the
|
|
189
|
+
legacy emission until IHO assigns one.
|
|
190
|
+
- **The legacy positional `urn:iho:` grammar is decode-only for S/P/M**
|
|
191
|
+
(the B/C emission): marker segments, positional `ed-`/`year-`, the
|
|
192
|
+
bare appendix-subnumber atom, and the further bare digit segment
|
|
193
|
+
binding the S-158 member. The legacy 2.0.x spellings (dotted keys,
|
|
194
|
+
bare `a.b.c` editions, `y.`) stay decodable, never emitted.
|
|
195
|
+
- **Both decode paths build through `Builder.build`** — the S-158
|
|
196
|
+
alias unification and every other semantic validation is shared
|
|
197
|
+
with the text parse; a URN decode renders the canonical shape (the
|
|
198
|
+
spelling face is parse-only).
|
|
199
|
+
|
|
200
|
+
IHO S-44 5.0.0 -> urn:mrn:iho:pub:spec:s44:5.0.0
|
|
201
|
+
IHO S-158:102 1.0.0 -> urn:mrn:iho:pub:spec:s158-102:1.0.0
|
|
202
|
+
IHO S-158 Part S-102 0.2.0 -> urn:mrn:iho:pub:spec:s158-102:0.2.0 (order-stable)
|
|
203
|
+
IHO M-2 Sup 1 -> urn:mrn:iho:pub:reg:m2:sup-1
|
|
204
|
+
IHO P-1 Vol. 30 (2) -> urn:mrn:iho:pub:per:p1:vol-30:issue-2
|
|
205
|
+
IHO B-4 2.19.0 -> urn:iho:b:4:ed-2.19.0 (legacy, no guidance code)
|
|
199
206
|
|
|
200
207
|
**Breaking URN migrations this scheme carries** (legacy forms stay
|
|
201
|
-
decodable, never emitted): the
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
+
decodable, never emitted): the official-URN namespace moved to the
|
|
209
|
+
guidance form (`urn:mrn:iho:pub:...`) for S/P/M; the S-158 member
|
|
210
|
+
moved to the `s158-NNN` name encoding (issue #774) with the draft-era
|
|
211
|
+
part spellings rebinding onto `checks_for` (#775's parted- mis-bind
|
|
212
|
+
fixed); the dotted keys (`part.4a`, `suppl.1`, `ap.A`, `annex.A`,
|
|
213
|
+
`vol.30`, `issue.2`, `appendix.D-2`) and the bare a.b.c edition segment
|
|
214
|
+
stay decode-only; the #635/#637 `y.2024` tag decodes into the
|
|
215
|
+
**volume**. relaton-data-iho needs a re-crawl (it is already legacy
|
|
216
|
+
pre-pubid-2 shape); the frozen testsuite corpus rows are re-frozen in
|
|
217
|
+
the coupled corpus round.
|
|
208
218
|
|
|
209
219
|
## Fixtures run through the classify pipeline
|
|
210
220
|
|
|
@@ -227,12 +237,18 @@ pubid pin moves in step with the relaton-data-iho re-key.
|
|
|
227
237
|
|
|
228
238
|
## pubid-scheme URN (issue #670)
|
|
229
239
|
|
|
230
|
-
`lib/pubid/iho/pubid_urn_schema.rb`; rulings in
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
`lib/pubid/iho/pubid_urn_schema.rb`; rulings in the flavor's
|
|
241
|
+
`lib/pubid/iho/urn.adoc`. The atoms follow the containment order of
|
|
242
|
+
the official URN — the S-158 member designator rides the document code
|
|
243
|
+
(`checks-102`, issue #774) before the document's `ed-`/`year-`, then
|
|
244
|
+
each component with its own edition/year right after it (`sup-`,
|
|
245
|
+
`part-`, `parted-`, `appendix-`, `appsub-`, `vol-`, `issue-` …). Case
|
|
246
|
+
is preserved (`part-A`); the yearbook year is a volume (`vol-2024`, no
|
|
247
|
+
`year-` value — the legacy `y.` marker stays decodable in the official
|
|
248
|
+
URN parser, never emitted). The draft-era part-faceted S-158 emission
|
|
249
|
+
(`part-S-102`, `parted-`) is dead: the `from_hash` unification
|
|
250
|
+
redirects it onto the `checks_for` identity, so the legacy URN fails
|
|
251
|
+
the canonical gate. The official URN of the S/P/M series is the
|
|
252
|
+
adopted IHO MRN guidance form (`urn:mrn:iho:pub:...`); the
|
|
253
|
+
`urn:pubid:iho:` scheme is pubid's own and is not governed by the
|
|
254
|
+
guidance.
|
data/lib/pubid/iho/builder.rb
CHANGED
|
@@ -6,15 +6,21 @@ module Pubid
|
|
|
6
6
|
#
|
|
7
7
|
# Parse goes through {Pubid::Parg::Model.bound} — the artifact's
|
|
8
8
|
# `bindings identifier` block delivers every component as an
|
|
9
|
-
# attribute-named scalar (type, number, part, annex,
|
|
10
|
-
# appendix_subnumber, supplement, edition,
|
|
11
|
-
# volume, issue) — so the builder
|
|
12
|
-
# to its concrete class and resolves
|
|
13
|
-
#
|
|
14
|
-
#
|
|
9
|
+
# attribute-named scalar (type, number, checks_for, part, annex,
|
|
10
|
+
# appendix, appendix_subnumber, supplement, edition,
|
|
11
|
+
# edition_shorthand, year, volume, issue) — so the builder dispatches
|
|
12
|
+
# the series letter to its concrete class and resolves two
|
|
13
|
+
# grammar-level aliases:
|
|
14
|
+
# - the S-100 "v1"/"v5.1" edition shorthand pads to the official
|
|
15
|
+
# dotted x.y.z edition ("1" -> "1.0.0", "5.1" -> "5.1.0");
|
|
16
|
+
# - the S-158 draft-era spellings of the series-member designator
|
|
17
|
+
# (`S-158 Part S-102`, `S-158-S-102`, `S-158 Part 102`) rebind onto
|
|
18
|
+
# `checks_for` — the model of issue #774, where the colon form
|
|
19
|
+
# `S-158:102` is the primary designator and the member is a
|
|
20
|
+
# publication of its own, not a part.
|
|
15
21
|
class Builder
|
|
16
|
-
ATTRIBUTES = %i[number appendix appendix_subnumber part
|
|
17
|
-
supplement year volume issue
|
|
22
|
+
ATTRIBUTES = %i[number checks_for appendix appendix_subnumber part
|
|
23
|
+
annex supplement year volume issue
|
|
18
24
|
part_edition part_year supplement_edition
|
|
19
25
|
supplement_year annex_edition annex_year
|
|
20
26
|
appendix_edition appendix_year volume_edition
|
|
@@ -26,6 +32,16 @@ module Pubid
|
|
|
26
32
|
# ruling on the two publication modes).
|
|
27
33
|
COMPONENT_EDITIONS = %i[part_edition supplement_edition annex_edition
|
|
28
34
|
appendix_edition volume_edition].freeze
|
|
35
|
+
# The S-158 series anchor: the only series the checks_for member
|
|
36
|
+
# designator rides (issue #774 — the colon form `S-158:102` is the
|
|
37
|
+
# S-158 series device; `S-44:5` has no such meaning and rejects).
|
|
38
|
+
CHECKS_SERIES = "158"
|
|
39
|
+
# The draft-era part-face spellings that rebind onto checks_for:
|
|
40
|
+
# the expanded series reference ("Part S-102") and the bare member
|
|
41
|
+
# number ("Part 102"). A lettered or compound part value ("Part A",
|
|
42
|
+
# "Part 4a") is a genuine part face and never rebinds.
|
|
43
|
+
CHECKS_SERIES_REF_RE = /\A[SPMBC]-(\d+)\z/.freeze
|
|
44
|
+
CHECKS_NUMBER_RE = /\A\d+\z/.freeze
|
|
29
45
|
# The S-4 anchor: the loose-leaf publication every spec citation
|
|
30
46
|
# resolves through (bare "B-401" carries it implicitly).
|
|
31
47
|
S4_TYPE = "S"
|
|
@@ -44,6 +60,7 @@ module Pubid
|
|
|
44
60
|
resolve_spec_citation!(attrs)
|
|
45
61
|
type = type_letter_from(hash, attrs)
|
|
46
62
|
assert_spec_anchor!(attrs, type)
|
|
63
|
+
resolve_checks_alias!(attrs, type)
|
|
47
64
|
assert_edition_mode!(attrs)
|
|
48
65
|
klass = Pubid::Iho.identifier_klass_for_type_letter(type)
|
|
49
66
|
klass.new(**attrs)
|
|
@@ -53,8 +70,118 @@ module Pubid
|
|
|
53
70
|
new.build(parsed)
|
|
54
71
|
end
|
|
55
72
|
|
|
73
|
+
class << self
|
|
74
|
+
# The alias unification {Builder#build} applies at parse time also
|
|
75
|
+
# runs on the deserialization path ({Identifier.from_hash}), so a
|
|
76
|
+
# stored row or a legacy URN carrying the draft-era part model
|
|
77
|
+
# decodes to the checks_for identity (issue #774). Pure function:
|
|
78
|
+
# returns the given hash untouched when it carries no draft-era
|
|
79
|
+
# part face, a normalized copy otherwise. The spelling face is
|
|
80
|
+
# NOT restored here — a deserialized identifier renders the
|
|
81
|
+
# canonical colon designator (equality/URN use the canonical
|
|
82
|
+
# shape; only the parse path keeps the input's spelling).
|
|
83
|
+
def normalize_checks_alias(data)
|
|
84
|
+
return data unless data.is_a?(::Hash)
|
|
85
|
+
|
|
86
|
+
part = data["part"] || data[:part]
|
|
87
|
+
number = data["number"] || data[:number]
|
|
88
|
+
checks = data["checks_for"] || data[:checks_for]
|
|
89
|
+
type_key = data["_type"] || data[:_type]
|
|
90
|
+
return data unless part && number == CHECKS_SERIES && !checks
|
|
91
|
+
return data unless standard_type?(type_key)
|
|
92
|
+
|
|
93
|
+
digits = checks_digits_of(part)
|
|
94
|
+
return data unless digits
|
|
95
|
+
|
|
96
|
+
hash = data.dup
|
|
97
|
+
edition = hash["part_edition"] || hash[:part_edition]
|
|
98
|
+
year = hash["part_year"] || hash[:part_year]
|
|
99
|
+
if (hash["edition"] || hash[:edition]) && edition
|
|
100
|
+
raise ArgumentError,
|
|
101
|
+
"duplicate edition: the base edition and the member " \
|
|
102
|
+
"edition #{edition} cannot both ride S-158:#{digits}"
|
|
103
|
+
end
|
|
104
|
+
hash.delete("part")
|
|
105
|
+
hash.delete(:part)
|
|
106
|
+
hash.delete("part_edition")
|
|
107
|
+
hash.delete(:part_edition)
|
|
108
|
+
hash.delete("part_year")
|
|
109
|
+
hash.delete(:part_year)
|
|
110
|
+
hash["checks_for"] = digits
|
|
111
|
+
hash["edition"] ||= edition if edition
|
|
112
|
+
hash["year"] ||= year if year
|
|
113
|
+
hash
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# The member number of a draft-era part face: the digits of a
|
|
117
|
+
# series reference ("S-102") or of the bare number face ("102").
|
|
118
|
+
def checks_digits_of(part)
|
|
119
|
+
if (match = CHECKS_SERIES_REF_RE.match(part.to_s))
|
|
120
|
+
match[1]
|
|
121
|
+
elsif CHECKS_NUMBER_RE.match?(part.to_s)
|
|
122
|
+
part.to_s
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
private
|
|
127
|
+
|
|
128
|
+
# The rebind applies to the standard family (the S series): the
|
|
129
|
+
# member designator is a facet of the S-158 standard family.
|
|
130
|
+
def standard_type?(type_key)
|
|
131
|
+
type_key.nil? || type_key.to_s.end_with?("standard")
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
56
135
|
private
|
|
57
136
|
|
|
137
|
+
# The S-158 alias unification (issue #774). A bound checks_for
|
|
138
|
+
# must ride the S-158 anchor. Otherwise a draft-era part face on
|
|
139
|
+
# the S-158 family — a series reference ("Part S-102") or the
|
|
140
|
+
# bare member number ("Part 102") — rebinds onto checks_for: the
|
|
141
|
+
# member is a publication of its own, not a part. The edition
|
|
142
|
+
# that follows the part face is the BASE edition (the parted-
|
|
143
|
+
# mis-bind fix of issue #775), and the spelling face records the
|
|
144
|
+
# part value as written so the render keeps the input's spelling
|
|
145
|
+
# (facets-spelling-only; equality/URN use the canonical shape).
|
|
146
|
+
def resolve_checks_alias!(attrs, type)
|
|
147
|
+
return assert_checks_anchor!(attrs, type) if attrs[:checks_for]
|
|
148
|
+
|
|
149
|
+
return unless type == S4_TYPE && attrs[:number] == CHECKS_SERIES
|
|
150
|
+
|
|
151
|
+
digits = Builder.checks_digits_of(attrs[:part]) if attrs[:part]
|
|
152
|
+
return unless digits
|
|
153
|
+
|
|
154
|
+
edition = attrs.delete(:part_edition)
|
|
155
|
+
year = attrs.delete(:part_year)
|
|
156
|
+
if attrs[:edition] && edition
|
|
157
|
+
raise ArgumentError,
|
|
158
|
+
"duplicate edition: the base edition " \
|
|
159
|
+
"#{attrs[:edition]} and the member edition #{edition} " \
|
|
160
|
+
"cannot both ride S-158:#{digits}"
|
|
161
|
+
end
|
|
162
|
+
if attrs[:year] && year
|
|
163
|
+
raise ArgumentError,
|
|
164
|
+
"duplicate year: the base year #{attrs[:year]} and the " \
|
|
165
|
+
"member year #{year} cannot both ride S-158:#{digits}"
|
|
166
|
+
end
|
|
167
|
+
attrs[:checks_for] = digits
|
|
168
|
+
attrs[:checks_for_face] = attrs.delete(:part)
|
|
169
|
+
attrs[:edition] ||= edition
|
|
170
|
+
attrs[:year] ||= year
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
# The colon member designator is the S-158 series device: another
|
|
174
|
+
# anchor cannot carry it (the grammar binds the shape for every
|
|
175
|
+
# series; the anchor is semantic).
|
|
176
|
+
def assert_checks_anchor!(attrs, type)
|
|
177
|
+
return if type == S4_TYPE && attrs[:number] == CHECKS_SERIES
|
|
178
|
+
|
|
179
|
+
raise ArgumentError,
|
|
180
|
+
"the checks_for member designator is the S-158 series " \
|
|
181
|
+
"device: #{type}-#{attrs[:number]}:#{attrs[:checks_for]} " \
|
|
182
|
+
"cannot carry it"
|
|
183
|
+
end
|
|
184
|
+
|
|
58
185
|
# The citation captures resolve onto the model (see the grammar
|
|
59
186
|
# header): the citation letter folds into `part` (a Part-rule
|
|
60
187
|
# capture must agree), and the long form's spelled section becomes
|