pubid 2.0.51 → 2.0.52
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/iho.json +1 -1
- data/data/parg/iho.parg +126 -33
- 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 +2 -1
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
|
|
@@ -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
|