pubid 2.0.47 → 2.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.adoc +2 -2
- data/conformance/pending.yaml +0 -173
- data/data/parg/ansi.json +1 -1
- data/data/parg/wmo.json +1 -0
- data/data/parg/wmo.parg +108 -0
- data/lib/pubid/ansi/CLAUDE.md +26 -4
- data/lib/pubid/ansi/builder.rb +19 -9
- data/lib/pubid/ansi/identifier.rb +17 -0
- data/lib/pubid/ansi/pubid_urn_schema.rb +2 -0
- data/lib/pubid/ansi/renderer.rb +6 -4
- data/lib/pubid/ansi/urn_generator.rb +2 -0
- data/lib/pubid/version.rb +1 -1
- data/lib/pubid/wmo/CLAUDE.md +183 -0
- data/lib/pubid/wmo/builder.rb +71 -0
- data/lib/pubid/wmo/identifier.rb +167 -0
- data/lib/pubid/wmo/identifiers/annex.rb +43 -0
- data/lib/pubid/wmo/identifiers/publication.rb +17 -0
- data/lib/pubid/wmo/identifiers/standard.rb +18 -0
- data/lib/pubid/wmo/identifiers.rb +11 -0
- data/lib/pubid/wmo/parser.rb +32 -0
- data/lib/pubid/wmo/pubid_urn_schema.rb +42 -0
- data/lib/pubid/wmo/renderer.rb +63 -0
- data/lib/pubid/wmo/urn_generator.rb +96 -0
- data/lib/pubid/wmo/urn_parser.rb +159 -0
- data/lib/pubid/wmo.rb +112 -0
- data/lib/pubid.rb +1 -0
- metadata +17 -2
|
@@ -19,6 +19,16 @@ module Pubid
|
|
|
19
19
|
attribute :date_separator, :string
|
|
20
20
|
equality_ignored :date_separator
|
|
21
21
|
|
|
22
|
+
# How the input joined the publisher group to the number: "-" for the
|
|
23
|
+
# "ANSI/ISA-5.1-2009" spelling, nil for the space of "ANSI/ISA 5.1".
|
|
24
|
+
# Spelling only, so `==`, `hash` and `===` skip it.
|
|
25
|
+
attribute :number_separator, :string
|
|
26
|
+
equality_ignored :number_separator
|
|
27
|
+
|
|
28
|
+
# The revision letter of "ANSI/TIA-568.2-D". It names a different
|
|
29
|
+
# document, so it is identity; `#revision_of?` reads it.
|
|
30
|
+
attribute :revision, :string
|
|
31
|
+
|
|
22
32
|
def self.parse(string)
|
|
23
33
|
unless string.is_a?(String)
|
|
24
34
|
raise Pubid::Errors::InvalidInputError,
|
|
@@ -35,6 +45,13 @@ module Pubid
|
|
|
35
45
|
Pubid::Ansi::Builder.new.build(parsed)
|
|
36
46
|
end
|
|
37
47
|
|
|
48
|
+
# The revision is identity, so it reaches the slug too: "568.2-C" and
|
|
49
|
+
# "568.2-D" must not share a filename.
|
|
50
|
+
def mr_number_with_part
|
|
51
|
+
num = super
|
|
52
|
+
num && mr_join(num, revision&.downcase)
|
|
53
|
+
end
|
|
54
|
+
|
|
38
55
|
# The separator belongs to the year: drop it with the year, so a
|
|
39
56
|
# year-less copy carries no orphan spelling flag in its hash.
|
|
40
57
|
def exclude(*args)
|
|
@@ -22,6 +22,7 @@ module Pubid
|
|
|
22
22
|
atom "type.abbr", "type"
|
|
23
23
|
atom "part", "part"
|
|
24
24
|
atom "subpart", "subpart"
|
|
25
|
+
atom "revision", "rev"
|
|
25
26
|
atom "year", "year"
|
|
26
27
|
atom "date.year", "dateyear"
|
|
27
28
|
atom "date.month", "datemonth"
|
|
@@ -36,6 +37,7 @@ module Pubid
|
|
|
36
37
|
facet "languages.*.original_code", "langsrc"
|
|
37
38
|
facet "edition.original_text", "edsrc"
|
|
38
39
|
facet "date_separator", "datesep"
|
|
40
|
+
facet "number_separator", "numsep"
|
|
39
41
|
|
|
40
42
|
type "pubid:ansi:standard", "std"
|
|
41
43
|
type "pubid:ansi:american-national-standard", "ans"
|
data/lib/pubid/ansi/renderer.rb
CHANGED
|
@@ -16,10 +16,11 @@ module Pubid
|
|
|
16
16
|
def render(context: nil, **opts)
|
|
17
17
|
id = @id
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
# "ANSI/ISA-5.1-2009" keeps its dash; the space is the default.
|
|
20
|
+
result = [
|
|
21
|
+
publisher_portion(id, context),
|
|
22
|
+
number_portion(id, context),
|
|
23
|
+
].join(id.number_separator || " ")
|
|
23
24
|
|
|
24
25
|
result << language_portion(id) if id.languages&.any?
|
|
25
26
|
|
|
@@ -40,6 +41,7 @@ module Pubid
|
|
|
40
41
|
[
|
|
41
42
|
id.number,
|
|
42
43
|
(id.part ? "-#{id.part}" : ""),
|
|
44
|
+
(id.revision ? "-#{id.revision}" : ""),
|
|
43
45
|
date_portion(id, context),
|
|
44
46
|
].join
|
|
45
47
|
end
|
|
@@ -18,6 +18,8 @@ module Pubid
|
|
|
18
18
|
parts << urn_part if urn_part
|
|
19
19
|
parts << urn_subpart if urn_subpart
|
|
20
20
|
parts << urn_year if urn_year
|
|
21
|
+
# "568.2-C" and "568.2-D" are two documents: keep them apart.
|
|
22
|
+
parts << "rev-#{identifier.revision}" if identifier.revision
|
|
21
23
|
parts << urn_edition if urn_edition
|
|
22
24
|
parts << urn_typed_stage if urn_typed_stage
|
|
23
25
|
|
data/lib/pubid/version.rb
CHANGED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# WMO flavor notes
|
|
2
|
+
|
|
3
|
+
WMO (World Meteorological Organization) publication identifiers and
|
|
4
|
+
their MRN URNs (pubid#763, widened): the WMO-No. series, the
|
|
5
|
+
technical-document series (WMO/TD, JCOMM Technical Report, GAW Report)
|
|
6
|
+
and, since the JCOMM dissolution, the WMO-published S-100-family
|
|
7
|
+
product specifications (consumer: metanorma/S-411-Product-Specification,
|
|
8
|
+
authored `mn-document-class: wmo` in the metanorma-taste `data/wmo`
|
|
9
|
+
flavor).
|
|
10
|
+
|
|
11
|
+
Read this before you change `lib/pubid/wmo/` or `spec/pubid/wmo/`. The
|
|
12
|
+
root `CLAUDE.md` keeps the cross-flavor contract that every flavor
|
|
13
|
+
obeys.
|
|
14
|
+
|
|
15
|
+
## The type assignment (the #763 ruling)
|
|
16
|
+
|
|
17
|
+
The S-100 type assignment follows the fleet's own precedent: IALA's
|
|
18
|
+
`S-201` is the S-100-family lexical form under the publishing org's
|
|
19
|
+
flavor (`Pubid::Iala`, `urn:mrn:iala:pub:s-201:ed2.0.0`). WMO-published
|
|
20
|
+
`S-411` is the same shape, so it is a **Pubid::Wmo** type — the
|
|
21
|
+
S-lexical form as a WMO type, publisher-parameterised, not a Pubid::Iho
|
|
22
|
+
identifier. The bare `S-411` string alone still names two documents
|
|
23
|
+
(IHO's and WMO's — each org assigns its own identifier), so like the
|
|
24
|
+
pubid#469 dual-perspective shapes the lexical form leads NO prefix and
|
|
25
|
+
`PREFIXES` carries only the series heads; the umbrella router reaches
|
|
26
|
+
WMO's S-411 through the exact-round-trip preference, never through a
|
|
27
|
+
claimed prefix.
|
|
28
|
+
|
|
29
|
+
## The prefix law (the widening ruling)
|
|
30
|
+
|
|
31
|
+
"Clearly we need a PREFIX — can't just accept 'TD-No.' and assume it's
|
|
32
|
+
WMO, maybe it's another publisher." Every publication series head names
|
|
33
|
+
its publisher, and the head is what the grammar matches:
|
|
34
|
+
|
|
35
|
+
| Head | series key | MRN slug |
|
|
36
|
+
|------|------------|----------|
|
|
37
|
+
| `WMO-No.` | nil (the default) | `wmo-<n>` |
|
|
38
|
+
| `WMO/TD-No.` | `TD` | `wmo-td-<n>` |
|
|
39
|
+
| `JCOMM Technical Report No.` | `JCOMM` | `jcomm-tr-<n>` |
|
|
40
|
+
| `GAW Report No.` | `GAW` | `gaw-<n>` |
|
|
41
|
+
|
|
42
|
+
- The four heads are this flavor's OWN `PREFIXES` entries (routing
|
|
43
|
+
tokens), NOT `JOINT_PREFIXES` rows: `WMO/TD-No.` is WMO's own
|
|
44
|
+
technical-document series, not a co-publication.
|
|
45
|
+
- The rejects and WHY they reject: `TD-No. 1265` / `TD No. 196` (no
|
|
46
|
+
publisher named — no flavor owns them), `IMO/TD-No. 259` (no IMO TD
|
|
47
|
+
series exists; the wild string is an OCR misread), `WMO/GAW Report
|
|
48
|
+
No. 285` (third-party citation only — WMO's own records and covers
|
|
49
|
+
use bare GAW). The spaced cover variant `WMO/TD - No. 1469`
|
|
50
|
+
(GAW-183 cover at gml.noaa.gov) was examined for natural fall-out
|
|
51
|
+
and deliberately rejected: only the glued library-serial head
|
|
52
|
+
`WMO/TD-No.` is defined.
|
|
53
|
+
- `WMO/TD-No.` is the canonical glued form (library serial "TECHNICAL
|
|
54
|
+
DOCUMENT / WMO/TD-No.", typhooncommittee.org TCP-23 PDFs,
|
|
55
|
+
library.wmo.int `wmo-td_NNNN_en` viewers). The JCOMM Technical
|
|
56
|
+
Reports are self-identifying joint WMO/IOC documents cross-referenced
|
|
57
|
+
to TD numbers (TR 14 = TD 1086, TR 24 = TD 1215, TR 47 = TD 1466).
|
|
58
|
+
|
|
59
|
+
## Identifier space
|
|
60
|
+
|
|
61
|
+
| Type | Shape | Edition face | Example |
|
|
62
|
+
|------|-------|--------------|---------|
|
|
63
|
+
| Publication | `<head> <n>` | calendar year: `, 2025 edition` | `WMO-No. 1364, 2025 edition` |
|
|
64
|
+
| Standard | `S-<n>` | dotted x.y.z: ` 1.2.1` | `S-411 1.2.1` |
|
|
65
|
+
| Annex | `S-<n> Annex <L>` (wrapper over Standard) | dotted, on the annex | `S-411 Annex A` |
|
|
66
|
+
|
|
67
|
+
- **Editions are one string attribute with a type-driven face.** The
|
|
68
|
+
issue's semantics: WMO editions are calendar years (`2025 edition`)
|
|
69
|
+
on the publication series, the S-100 shapes carry the dotted
|
|
70
|
+
`ed1.2.1` MRN form. The grammar binds both into the one
|
|
71
|
+
`edition_value` capture; the renderer and the MRN generator key the
|
|
72
|
+
face off the resolved type. There is no Components::Edition.
|
|
73
|
+
- **The compound faces widen the same capture** (the widening ruling):
|
|
74
|
+
the year pair ("2021/2018" — the IMOP wording, primary year first)
|
|
75
|
+
rides the ONE edition string — the pair IS the identity face, the
|
|
76
|
+
dotted-x.y.z law of the S-100 side applied to years; the status word
|
|
77
|
+
(`Provisional`, the IMOP Knowledge-Hub form) and the updated-in year
|
|
78
|
+
(record 69478's "updated in 2025") are their own attributes
|
|
79
|
+
(`edition_status`, `updated_in`), printed inside/after the edition
|
|
80
|
+
face. The NIST `revised_date` atom is the sibling precedent for
|
|
81
|
+
`updated_in`.
|
|
82
|
+
- **The volume face is its own attribute, printed BEFORE the edition**
|
|
83
|
+
(the widening ruling's face order; both faces individually attested
|
|
84
|
+
on record 35713's Volume I.1 and the 2020-edition rows). The values
|
|
85
|
+
are roman numerals (I..V attested, the grammar takes the standard
|
|
86
|
+
longest-first set through X), dotted-roman sub-volumes (I.1/I.2/I.3)
|
|
87
|
+
and letter volumes (D). Arabic volumes reject.
|
|
88
|
+
- **Parse-only alternates**: the cover-stack year face
|
|
89
|
+
(`WMO-No. 1364 2025 edition`), the compact aliases
|
|
90
|
+
(`WMO-No. 1364:ed2025`, `S-411:ed1.2.1` — the compact year alias
|
|
91
|
+
also takes the pair, `:ed2021/2018`) and the uppercase `ANNEX`
|
|
92
|
+
marker all parse and normalize; the canonical faces are the
|
|
93
|
+
repository forms (`S-411 1.2.1`, `S-411 Annex A`) and the WMO catalog
|
|
94
|
+
citations (`WMO-No. 1364, 2025 edition`, `WMO/TD-No. 196`).
|
|
95
|
+
- **The dotted S-100 edition requires a dot** (`S-411 1.2` parses,
|
|
96
|
+
`S-411 1234` rejects): a bare digit run after the code is not an
|
|
97
|
+
edition face in either series, and the year face (4 digits) is
|
|
98
|
+
publication-only. `WMO-No. 1364:ed1.2.1` rejects for the same reason.
|
|
99
|
+
|
|
100
|
+
## The faces carry no publisher token
|
|
101
|
+
|
|
102
|
+
The series heads are designations, not publisher tokens (the GB/GOST
|
|
103
|
+
rule) and the S-number prints bare — the repository's docidentifiers
|
|
104
|
+
are `S-411 Annex A` and `S-411 1.2.1`, never `WMO S-411`.
|
|
105
|
+
`publisher_prefixes` is `[]`, so `to_s(with_publisher:)` is the
|
|
106
|
+
identity on every type.
|
|
107
|
+
|
|
108
|
+
## MR slug (issue #142 distinctness)
|
|
109
|
+
|
|
110
|
+
The widening rows would collide without their discriminators, so
|
|
111
|
+
`mr_type` (the series: `wmo.td.196` vs `wmo.196`), `mr_volume`
|
|
112
|
+
(`wmo.8.vol-i` vs `wmo.8.vol-ii`, the ECMA law) and `mr_edition`
|
|
113
|
+
(`ed2021-2018`, `ed2026-provisional`, `ed2023-updated2025`) all carry
|
|
114
|
+
the compound faces. The year pair keeps its slash out of the slug
|
|
115
|
+
charset as a hyphen.
|
|
116
|
+
|
|
117
|
+
## MRN URN scheme
|
|
118
|
+
|
|
119
|
+
The `mrn` URN tree with WMO as assigning authority, sub-namespace
|
|
120
|
+
`pub`, following the IALA pattern:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
urn:mrn:wmo:pub:wmo-<number>[:vol-<v>][:status-<s>][:ed<year>][:updated-<y>]
|
|
124
|
+
urn:mrn:wmo:pub:wmo-td-<number> / jcomm-tr-<number> / gaw-<number>
|
|
125
|
+
urn:mrn:wmo:pub:s-<number>[:annex[-<letter>]][:ed<x.y.z>]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- The publication series code via their SERIES slugs; the segment order
|
|
129
|
+
mirrors the human face order (volume, status, edition, updated-in).
|
|
130
|
+
Volume and status segment values are caseless (downcased like the
|
|
131
|
+
annex letter, re-cased by the parser). The year pair keeps its slash
|
|
132
|
+
out of the NSS (RFC 2141 has no slash in the trans set) as a hyphen
|
|
133
|
+
(`ed2021-2018`).
|
|
134
|
+
- **No authoritative rule exists yet.** The issue asked for a search
|
|
135
|
+
before assuming the shape: neither the S-411 repository nor any local
|
|
136
|
+
checkout carries a `urn:mrn:wmo:` spelling, so this generator/parser
|
|
137
|
+
pair IS the namespace extension, recorded as the issue's proposed
|
|
138
|
+
form (the #763 ruling keeps `urn:mrn:wmo:` as the fleet's recorded
|
|
139
|
+
extension). If WMO publishes a rule, that rule wins and this pair
|
|
140
|
+
moves.
|
|
141
|
+
- The parser rebuilds the human forms and delegates to the text parser
|
|
142
|
+
(one construction path). The MRN annex segment is caseless
|
|
143
|
+
(`annex-a`), so the rebuild picks the attested face `Annex` — the
|
|
144
|
+
uppercase `ANNEX` human form stays a parse-only alias whose URN
|
|
145
|
+
re-renders to the attested face. Unknown/duplicate segments raise
|
|
146
|
+
`Pubid::Errors::UrnParseError` (the ISO urn_parser strictness); the
|
|
147
|
+
td slug wins over the bare wmo- code by longest-match-first.
|
|
148
|
+
|
|
149
|
+
## pubid-scheme URN (docs/URN-SCHEMES.adoc, `[[urn-wmo]]`)
|
|
150
|
+
|
|
151
|
+
`lib/pubid/wmo/pubid_urn_schema.rb`: atoms `series-`, `vol-`, `ed-`
|
|
152
|
+
(`edition`), `status-` (`edition_status`), `updated-` (`updated_in`),
|
|
153
|
+
`annexform-` (`annex_form`), `letter-` (`letter`); types
|
|
154
|
+
`pub`/`std`/`annex` over the default `number` core. The year pair
|
|
155
|
+
escapes through the codec (`ed-2021~2F2018`). `series` is nil on the
|
|
156
|
+
WMO-No. default, so every pre-widening URN is unchanged. The annex
|
|
157
|
+
rides the root-first chain
|
|
158
|
+
(`urn:pubid:wmo:std:411:annex:annexform-Annex:letter-A`), so the base
|
|
159
|
+
standard is the slug prefix. `annex_form` is an atom (identity) per
|
|
160
|
+
the iala schema — "Annex" and "ANNEX" are two identifiers.
|
|
161
|
+
|
|
162
|
+
## Corpus ground truth (attested only)
|
|
163
|
+
|
|
164
|
+
`spec/fixtures/wmo/identifiers/full/identifiers.txt`, regenerated by
|
|
165
|
+
`rake "validation:classify[wmo]"`. The widening rounds add, with
|
|
166
|
+
provenance in the header comment: the A-set rows (which parse on the
|
|
167
|
+
#763 grammar unchanged), the volume rows (IMOP Guide page I..V, record
|
|
168
|
+
35631's Volume III, Resolution 10 (SERCOM-1)'s Volume D, record
|
|
169
|
+
35713's Volume I.1), the compound rows (the IMOP wording, record
|
|
170
|
+
69478, the IMOP Knowledge-Hub), the TD/JCOMM/GAW rows (library serial
|
|
171
|
+
+ records 37163/55084/69472) and the prefix-law rejects
|
|
172
|
+
(`TD-No. 1265`, `IMO/TD-No. 259`, `TD No. 196`, `WMO/GAW Report No.
|
|
173
|
+
285`, the spaced `WMO/TD - No. 1469`). The MRN rows over the new
|
|
174
|
+
shapes follow the same proposed form.
|
|
175
|
+
|
|
176
|
+
## relaton-side follow-ups (not this repo)
|
|
177
|
+
|
|
178
|
+
bibdata carries the plain string `S-411` today; a relaton-side ask for
|
|
179
|
+
docidentifier types and MRN URNs is to be filed in the relaton monogem
|
|
180
|
+
and cross-linked on #763. metanorma-taste's `data/wmo` flavor registers
|
|
181
|
+
its URN generator the way `Metanorma::Taste::UrnGenerator.register`
|
|
182
|
+
does for the other flavors, so S-411 documents mint the publication
|
|
183
|
+
URN from fields instead of hand-pinning a `:urn:` attribute.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
# Builds a WMO identifier object from the artifact's bound map —
|
|
6
|
+
# the flat attribute hash the grammar's bindings block declares
|
|
7
|
+
# (typed at the engine, one key per capture).
|
|
8
|
+
#
|
|
9
|
+
# Each grammar alternative path carries at most one occurrence of
|
|
10
|
+
# `doc_number` and `edition_value`, so one flat map serves all three
|
|
11
|
+
# types; the builder dispatches on `annex_marker` and `series_head`.
|
|
12
|
+
class Builder
|
|
13
|
+
# The series head the grammar matched -> the model's series key
|
|
14
|
+
# (the widening prefix law: every head names its publisher, and
|
|
15
|
+
# the head face is the grammar's verbatim capture, so the key
|
|
16
|
+
# mapping lives on the one construction site).
|
|
17
|
+
SERIES_HEADS = {
|
|
18
|
+
"WMO-No." => nil,
|
|
19
|
+
"WMO/TD-No." => "TD",
|
|
20
|
+
"JCOMM Technical Report No." => "JCOMM",
|
|
21
|
+
"GAW Report No." => "GAW",
|
|
22
|
+
}.freeze
|
|
23
|
+
|
|
24
|
+
def build(parsed)
|
|
25
|
+
return build_annex(parsed) if parsed[:annex_marker]
|
|
26
|
+
return build_publication(parsed) if parsed[:series_head]
|
|
27
|
+
|
|
28
|
+
Identifiers::Standard.new(**standard_attrs(parsed))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def self.build(parsed)
|
|
32
|
+
new.build(parsed)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
def build_publication(hash)
|
|
38
|
+
attrs = standard_attrs(hash).merge(
|
|
39
|
+
series: SERIES_HEADS.fetch(hash[:series_head]),
|
|
40
|
+
volume: hash[:volume],
|
|
41
|
+
edition_status: hash[:edition_status],
|
|
42
|
+
updated_in: hash[:updated_in],
|
|
43
|
+
).compact
|
|
44
|
+
|
|
45
|
+
Identifiers::Publication.new(**attrs)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def build_annex(hash)
|
|
49
|
+
base = Identifiers::Standard.new(number: hash[:doc_number])
|
|
50
|
+
|
|
51
|
+
attrs = {
|
|
52
|
+
base: base,
|
|
53
|
+
annex_form: hash[:annex_marker],
|
|
54
|
+
letter: hash[:annex_letter],
|
|
55
|
+
edition: hash[:edition_value],
|
|
56
|
+
}.compact
|
|
57
|
+
|
|
58
|
+
Identifiers::Annex.new(**attrs)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def standard_attrs(hash)
|
|
62
|
+
{
|
|
63
|
+
number: hash[:doc_number],
|
|
64
|
+
edition: hash[:edition_value],
|
|
65
|
+
}.compact
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
Pubid::Wmo::Builder.prepend(Pubid::Builder::AllPartsWrap)
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
# Base class for all WMO identifiers. Canonical name
|
|
6
|
+
# Pubid::Wmo::Identifier; every concrete WMO identifier
|
|
7
|
+
# (Identifiers::*) descends from it.
|
|
8
|
+
#
|
|
9
|
+
# The publication series share one type (pubid#763 widened):
|
|
10
|
+
#
|
|
11
|
+
# WMO-No. <number>[, <year> edition] the WMO-No. publication
|
|
12
|
+
# series; editions are
|
|
13
|
+
# calendar years
|
|
14
|
+
# WMO/TD-No. <number> the Technical Document
|
|
15
|
+
# series
|
|
16
|
+
# JCOMM Technical Report No. <number> the joint WMO/IOC series
|
|
17
|
+
# GAW Report No. <number> the GAW series
|
|
18
|
+
# S-<number>[ <x.y.z>] the WMO-published S-100
|
|
19
|
+
# product specifications;
|
|
20
|
+
# editions are dotted x.y.z
|
|
21
|
+
# S-<number> [Annex|ANNEX] [<letter>] [<x.y.z>] annex wrapper
|
|
22
|
+
#
|
|
23
|
+
# The edition is ONE string attribute carrying a type-driven face:
|
|
24
|
+
# "2025" on a Publication, "1.2.1" on a Standard or Annex. The
|
|
25
|
+
# compound faces widen it: a year pair ("2021/2018" — the pair IS
|
|
26
|
+
# the identity face) rides the same string, while the status word
|
|
27
|
+
# ("Provisional") and the updated-in year carry their own
|
|
28
|
+
# attributes. The volume face ("I", "I.1", "D") is its own
|
|
29
|
+
# attribute, printed before the edition face.
|
|
30
|
+
class Identifier < ::Pubid::Identifier
|
|
31
|
+
# The publication series beyond the WMO-No. default (the widening
|
|
32
|
+
# prefix law: every head token names its publisher, so the model
|
|
33
|
+
# carries the short key and derives the citation face and the MRN
|
|
34
|
+
# slug from this table). The default row stays out of the table:
|
|
35
|
+
# series is nil for WMO-No., so existing rows serialize without
|
|
36
|
+
# the key.
|
|
37
|
+
SERIES = {
|
|
38
|
+
"TD" => { face: "WMO/TD-No.", mrn: "wmo-td" },
|
|
39
|
+
"JCOMM" => { face: "JCOMM Technical Report No.", mrn: "jcomm-tr" },
|
|
40
|
+
"GAW" => { face: "GAW Report No.", mrn: "gaw" },
|
|
41
|
+
}.freeze
|
|
42
|
+
# The WMO-No. series itself: the face the grammar matches and the
|
|
43
|
+
# MRN slug prefix of the default series (series nil).
|
|
44
|
+
DEFAULT_SERIES = { face: "WMO-No.", mrn: "wmo" }.freeze
|
|
45
|
+
|
|
46
|
+
# The series config (face + MRN slug prefix) of a series key,
|
|
47
|
+
# defaulting to the WMO-No. row.
|
|
48
|
+
def self.series_config(key)
|
|
49
|
+
SERIES.fetch(key, DEFAULT_SERIES)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# The series config of this identifier's own series. A real
|
|
53
|
+
# instance method: lutaml's Serialize#method_missing would swallow
|
|
54
|
+
# anything the class only exposes statically.
|
|
55
|
+
def series_config
|
|
56
|
+
self.class.series_config(series)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Parse a WMO identifier string — human form ("WMO-No. 1364",
|
|
60
|
+
# "WMO/TD-No. 196", "S-411 1.2.1") or MRN URN
|
|
61
|
+
# ("urn:mrn:wmo:pub:s-411:ed1.2.1") — into an identifier.
|
|
62
|
+
# @param identifier [String]
|
|
63
|
+
# @return [Pubid::Wmo::Identifier]
|
|
64
|
+
# @raise [Pubid::Errors::ParseError] If parsing fails
|
|
65
|
+
def self.parse(identifier)
|
|
66
|
+
unless identifier.is_a?(String)
|
|
67
|
+
raise Pubid::Errors::InvalidInputError,
|
|
68
|
+
Pubid::INPUT_NOT_A_STRING_MESSAGE
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if identifier.length > Pubid::MAX_INPUT_LENGTH
|
|
72
|
+
raise Pubid::Errors::InvalidInputError, Pubid::INPUT_TOO_LONG_MESSAGE
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
identifier = ::Pubid.utf8_input(identifier)
|
|
76
|
+
|
|
77
|
+
if FormatDetector.detect(identifier) == :urn
|
|
78
|
+
UrnParser.parse(identifier)
|
|
79
|
+
else
|
|
80
|
+
parsed = Pubid::Parg::Model.bound(:wmo, identifier)
|
|
81
|
+
Builder.build(parsed)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
attribute :publisher, :string, default: "WMO"
|
|
86
|
+
attribute :number, :string # "1364", "411"
|
|
87
|
+
# The publication series key: nil (the WMO-No. default), "TD",
|
|
88
|
+
# "JCOMM" or "GAW". The citation face and the MRN slug prefix
|
|
89
|
+
# derive from SERIES.
|
|
90
|
+
attribute :series, :string
|
|
91
|
+
# One edition column, type-driven face: "2025" or the year pair
|
|
92
|
+
# "2021/2018" (the WMO-No. series' calendar-year edition) or
|
|
93
|
+
# "1.2.1" (the S-100 dotted edition).
|
|
94
|
+
attribute :edition, :string
|
|
95
|
+
# The publication volume face ("I", "I.1", "D"); publication-only.
|
|
96
|
+
attribute :volume, :string
|
|
97
|
+
# The edition status word ("Provisional"); publication-only.
|
|
98
|
+
attribute :edition_status, :string
|
|
99
|
+
# The year the edition was updated in ("2025"); publication-only.
|
|
100
|
+
attribute :updated_in, :string
|
|
101
|
+
|
|
102
|
+
WMO_TYPE_MAP = {
|
|
103
|
+
"pubid:wmo:publication" => "Pubid::Wmo::Identifiers::Publication",
|
|
104
|
+
"pubid:wmo:standard" => "Pubid::Wmo::Identifiers::Standard",
|
|
105
|
+
"pubid:wmo:annex" => "Pubid::Wmo::Identifiers::Annex",
|
|
106
|
+
}.freeze
|
|
107
|
+
|
|
108
|
+
key_value do
|
|
109
|
+
map "_type", to: :_type, polymorphic_map: WMO_TYPE_MAP
|
|
110
|
+
map "number", to: :number
|
|
111
|
+
map "series", to: :series
|
|
112
|
+
map "edition", to: :edition
|
|
113
|
+
map "volume", to: :volume
|
|
114
|
+
map "edition_status", to: :edition_status
|
|
115
|
+
map "updated_in", to: :updated_in
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def to_urn
|
|
119
|
+
UrnGenerator.new(self).generate
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# The edition is a plain string (the string-edition flavors precede
|
|
123
|
+
# this); the base mr_edition reads edition.number of a
|
|
124
|
+
# Components::Edition, which would crash on the string. The
|
|
125
|
+
# compound faces ride the same segment so distinct identifiers
|
|
126
|
+
# never collide on the slug (issue #142): the year pair keeps its
|
|
127
|
+
# slash out of the MR charset as a hyphen ("2021/2018" rides as
|
|
128
|
+
# "ed2021-2018", the same hyphenation the MRN edition segment
|
|
129
|
+
# uses), the status word and the updated-in year suffix it.
|
|
130
|
+
def mr_edition
|
|
131
|
+
return nil unless edition
|
|
132
|
+
|
|
133
|
+
segment = "ed#{edition.tr('/', '-')}"
|
|
134
|
+
segment << "-#{edition_status.downcase}" if edition_status
|
|
135
|
+
segment << "-updated#{updated_in}" if updated_in
|
|
136
|
+
segment
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# The series is the type discriminator of the publication series:
|
|
140
|
+
# "WMO/TD-No. 196" and "WMO-No. 196" are two documents, so the
|
|
141
|
+
# slug carries the series or they collide. Downcased per the MR
|
|
142
|
+
# charset; nil (no segment) on the WMO-No. default.
|
|
143
|
+
def mr_type
|
|
144
|
+
return nil unless series
|
|
145
|
+
|
|
146
|
+
series.downcase
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# The volume is an identity discriminator (the ECMA law): Volume I
|
|
150
|
+
# and Volume II of WMO-No. 8 are two documents sharing one
|
|
151
|
+
# docidentifier, so the MR slug carries the segment or the two
|
|
152
|
+
# collide. Downcased per the MR charset.
|
|
153
|
+
def mr_volume
|
|
154
|
+
return nil unless volume
|
|
155
|
+
|
|
156
|
+
"vol-#{volume.downcase}"
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# "WMO-No." and the S-number are designations, not publisher
|
|
160
|
+
# tokens: the canonical faces carry no publisher prefix for
|
|
161
|
+
# with_publisher to cut (the GB/GOST/ECMA rule).
|
|
162
|
+
def publisher_prefixes
|
|
163
|
+
[]
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
module Identifiers
|
|
6
|
+
# An annex to a WMO-published S-100 product specification:
|
|
7
|
+
# "S-411 Annex A" (the Data Classification and Encoding Guide's
|
|
8
|
+
# docidentifier in metanorma/S-411-Product-Specification). The
|
|
9
|
+
# marker case is preserved (Annex vs ANNEX) for round-trip
|
|
10
|
+
# fidelity; the optional edition applies to the annex itself,
|
|
11
|
+
# not the base.
|
|
12
|
+
class Annex < Identifier
|
|
13
|
+
# The specification this annex supplements. Always present;
|
|
14
|
+
# carries the S-number (e.g. S-411).
|
|
15
|
+
attribute :base, ::Pubid::Wmo::Identifier, polymorphic: true
|
|
16
|
+
# "Annex" or "ANNEX" — preserved verbatim for exact round-trip.
|
|
17
|
+
attribute :annex_form, :string
|
|
18
|
+
# "A", "B", … or nil for the bare form.
|
|
19
|
+
attribute :letter, :string
|
|
20
|
+
|
|
21
|
+
key_value do
|
|
22
|
+
map "base", to: :base
|
|
23
|
+
map "annex_form", to: :annex_form
|
|
24
|
+
map "letter", to: :letter
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.type
|
|
28
|
+
{ key: :annex, title: "Annex", short: nil }
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# MR string: the base head, then the annex marker (and letter),
|
|
32
|
+
# then the annex's own edition — "wmo.411_annex-a.ed1.2.0".
|
|
33
|
+
# Returning non-nil is what makes the shared MrString renderer
|
|
34
|
+
# recurse into `base` for the head.
|
|
35
|
+
def mr_supplement_suffix
|
|
36
|
+
segments = [letter ? "annex-#{letter.downcase}" : "annex"]
|
|
37
|
+
segments << "ed#{edition}" if edition
|
|
38
|
+
segments.join(".")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
module Identifiers
|
|
6
|
+
# The WMO-No. publication series: "WMO-No. 8", "WMO-No. 49",
|
|
7
|
+
# "WMO-No. 1364". Editions are calendar years — "2025 edition" —
|
|
8
|
+
# never version ordinals; the MRN edition segment is ed<year>
|
|
9
|
+
# (urn:mrn:wmo:pub:wmo-1364:ed2025).
|
|
10
|
+
class Publication < Identifier
|
|
11
|
+
def self.type
|
|
12
|
+
{ key: :publication, title: "Publication", short: nil }
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
module Identifiers
|
|
6
|
+
# The WMO-published S-100 product specifications: the IHO S-100
|
|
7
|
+
# lexical form ("S-411", "S-412") with WMO as the assigning
|
|
8
|
+
# authority — the S-201-of-IALA type assignment of the #763
|
|
9
|
+
# ruling. Editions are the S-100 dotted x.y.z ("S-411 1.2.1",
|
|
10
|
+
# MRN ed1.2.1).
|
|
11
|
+
class Standard < Identifier
|
|
12
|
+
def self.type
|
|
13
|
+
{ key: :standard, title: "Standard", short: "S" }
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
module Identifiers
|
|
6
|
+
autoload :Annex, "#{__dir__}/identifiers/annex"
|
|
7
|
+
autoload :Publication, "#{__dir__}/identifiers/publication"
|
|
8
|
+
autoload :Standard, "#{__dir__}/identifiers/standard"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Pubid
|
|
4
|
+
module Wmo
|
|
5
|
+
# Grammar for WMO identifiers.
|
|
6
|
+
#
|
|
7
|
+
# Accepts every attested shape (pubid#763 widened):
|
|
8
|
+
#
|
|
9
|
+
# WMO-No. 1364
|
|
10
|
+
# WMO-No. 1364, 2025 edition
|
|
11
|
+
# WMO-No. 1364 2025 edition
|
|
12
|
+
# WMO-No. 1364:ed2025
|
|
13
|
+
# WMO-No. 8, Volume I / Volume I.1 / Volume D
|
|
14
|
+
# WMO-No. 306, Volume I.1, 2020 edition
|
|
15
|
+
# WMO-No. 8, 2021/2018 edition
|
|
16
|
+
# WMO-No. 1364, 2023 edition, updated in 2025
|
|
17
|
+
# WMO-No. 8, Provisional 2026 edition
|
|
18
|
+
# WMO/TD-No. 196
|
|
19
|
+
# JCOMM Technical Report No. 14
|
|
20
|
+
# GAW Report No. 312
|
|
21
|
+
# S-411
|
|
22
|
+
# S-411 1.2.1
|
|
23
|
+
# S-411:ed1.2.1
|
|
24
|
+
# S-411 Annex A
|
|
25
|
+
#
|
|
26
|
+
# The runtime is the baked artifact (data/parg/wmo.json, the
|
|
27
|
+
# grammar of record in pubid-grammar/grammars/wmo.parg); this class
|
|
28
|
+
# documents the accepted shapes.
|
|
29
|
+
class Parser
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|