colregs 0.2.4 → 0.3.1
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.
- package/PROVENANCE.md +3 -3
- package/README.md +19 -10
- package/data/applicability.json +219 -244
- package/data/corpora.json +41 -0
- package/data/editions.json +27 -0
- package/data/facts.json +4 -4
- package/data/geometry.json +8 -8
- package/data/i18n/en.json +27 -0
- package/data/i18n/fi.json +25 -0
- package/data/images.json +32 -32
- package/data/operations.json +79 -0
- package/data/rules.json +176 -599
- package/data/text/intl/2016/en-US.uscg.json +877 -0
- package/data/text/intl/2016/es.boe.json +23 -0
- package/data/text/intl/2016/fi.finlex.json +22 -0
- package/data/text/us/inland/2014/en-US.ecfr.json +22 -0
- package/data/version.json +1 -1
- package/docs/adr/0001-name-and-jurisdiction-model.md +42 -2
- package/docs/adr/0003-language-as-a-dimension.md +8 -7
- package/docs/adr/0006-json-schema-and-identifier-diff.md +2 -0
- package/docs/adr/0011-api-shape.md +1 -1
- package/docs/adr/0012-trace-and-rule2-departure-api.md +3 -4
- package/docs/adr/0013-corpus-files-with-editions.md +70 -0
- package/docs/adr/0014-engine-interface-owned-by-colregs.md +103 -0
- package/docs/adr/0015-rule-ids-are-paragraph-keys.md +191 -0
- package/docs/budgets.json +17 -17
- package/docs/gates.json +3 -3
- package/docs/identifiers.md +49 -51
- package/docs/maritime-sources.md +58 -0
- package/docs/normative-language.md +103 -0
- package/docs/part-b-invariants.md +31 -29
- package/docs/requirements.md +118 -97
- package/docs/timeline.md +102 -0
- package/docs/verification/2026-09-09-text-slug-straw-man.md +3 -2
- package/fixtures/applicability-fixtures.json +190 -190
- package/fixtures/situation-fixtures.json +287 -287
- package/package.json +1 -1
- package/schema/applicability-fixtures.schema.json +4 -13
- package/schema/applicability.schema.json +27 -27
- package/schema/conduct-evaluation.schema.json +135 -0
- package/schema/corpora.schema.json +68 -0
- package/schema/corpus.schema.json +329 -0
- package/schema/display-evaluation.schema.json +146 -0
- package/schema/editions.schema.json +47 -0
- package/schema/encounter-evaluation.schema.json +109 -0
- package/schema/evaluation.schema.json +149 -0
- package/schema/fact-record.schema.json +30 -0
- package/schema/i18n-catalog.schema.json +47 -0
- package/schema/operations.schema.json +124 -0
- package/schema/rule2-departure-finding.schema.json +72 -0
- package/schema/rule2-departure-model.schema.json +159 -0
- package/schema/rules.schema.json +20 -90
- package/schema/situation-fixtures.schema.json +10 -146
- package/schema/situation.schema.json +72 -0
- package/schema/trace.schema.json +33 -0
- package/data/deprecated-identifiers.json +0 -7
- package/schema/deprecated-identifiers.schema.json +0 -29
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/rule2-departure-finding.schema.json",
|
|
4
|
+
"title": "Rule2DepartureFinding",
|
|
5
|
+
"description": "The result of evaluateRule2Departure: what a named grid found for a situation, with the rule-derived obligations unchanged beside it and the model that made the claim (ADR 0012 §4, ADR 0014). Advisories are ranked best margin first and are empty under no-robust-policy-in-model. Structure only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"status",
|
|
10
|
+
"rules",
|
|
11
|
+
"advisories",
|
|
12
|
+
"model"
|
|
13
|
+
],
|
|
14
|
+
"properties": {
|
|
15
|
+
"status": {
|
|
16
|
+
"$ref": "rule2-departure-model.schema.json#/$defs/status"
|
|
17
|
+
},
|
|
18
|
+
"rules": {
|
|
19
|
+
"$ref": "encounter-evaluation.schema.json"
|
|
20
|
+
},
|
|
21
|
+
"advisories": {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"$ref": "rule2-departure-model.schema.json#/$defs/advisory"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"model": {
|
|
28
|
+
"$comment": "`version` names the grid, `colregs_version` the release it was solved against; a mismatch with rules.colregs.version is reported, not refused. `assumptions_violated` is display text, never matched on.",
|
|
29
|
+
"type": "object",
|
|
30
|
+
"additionalProperties": false,
|
|
31
|
+
"required": [
|
|
32
|
+
"version",
|
|
33
|
+
"colregs_version",
|
|
34
|
+
"parameters",
|
|
35
|
+
"assumptions_violated"
|
|
36
|
+
],
|
|
37
|
+
"properties": {
|
|
38
|
+
"version": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1
|
|
41
|
+
},
|
|
42
|
+
"colregs_version": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
},
|
|
46
|
+
"parameters": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"allOf": [
|
|
49
|
+
{
|
|
50
|
+
"$ref": "rule2-departure-model.schema.json#/$defs/solverParameters"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"required": [
|
|
54
|
+
"dynamics",
|
|
55
|
+
"horizon_s",
|
|
56
|
+
"cadence_s",
|
|
57
|
+
"separation_m",
|
|
58
|
+
"information",
|
|
59
|
+
"adversary"
|
|
60
|
+
],
|
|
61
|
+
"unevaluatedProperties": false
|
|
62
|
+
},
|
|
63
|
+
"assumptions_violated": {
|
|
64
|
+
"type": "array",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/rule2-departure-model.schema.json",
|
|
4
|
+
"title": "Rule2DepartureModel",
|
|
5
|
+
"description": "One solved region grid, named immutably by `version`, the positional second input of evaluateRule2Departure (ADR 0012 §4, ADR 0014). Only `version`, `colregs_version`, the solver parameters and the `regions` encoding are API; any other field is the artefact's own, so additional properties are allowed. Structure only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"version",
|
|
9
|
+
"colregs_version",
|
|
10
|
+
"dynamics",
|
|
11
|
+
"horizon_s",
|
|
12
|
+
"cadence_s",
|
|
13
|
+
"separation_m",
|
|
14
|
+
"information",
|
|
15
|
+
"adversary"
|
|
16
|
+
],
|
|
17
|
+
"allOf": [
|
|
18
|
+
{
|
|
19
|
+
"$ref": "#/$defs/solverParameters"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"version": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"minLength": 1
|
|
26
|
+
},
|
|
27
|
+
"colregs_version": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"minLength": 1
|
|
30
|
+
},
|
|
31
|
+
"regions": {
|
|
32
|
+
"type": "array",
|
|
33
|
+
"items": {
|
|
34
|
+
"$ref": "#/$defs/region"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"$defs": {
|
|
39
|
+
"solverParameters": {
|
|
40
|
+
"$comment": "The axes the Rule 2 sensitivity matrix varies (colregs Q-17 to Q-22); the field set is a claim about what that matrix is.",
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"dynamics": {
|
|
44
|
+
"type": "array",
|
|
45
|
+
"items": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"horizon_s": {
|
|
50
|
+
"type": "number"
|
|
51
|
+
},
|
|
52
|
+
"cadence_s": {
|
|
53
|
+
"type": "number"
|
|
54
|
+
},
|
|
55
|
+
"separation_m": {
|
|
56
|
+
"type": "number"
|
|
57
|
+
},
|
|
58
|
+
"information": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"enum": [
|
|
61
|
+
"full",
|
|
62
|
+
"partial"
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"adversary": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"enum": [
|
|
68
|
+
"compliant",
|
|
69
|
+
"physics"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"status": {
|
|
75
|
+
"$comment": "The status alphabet is colregs' (ADR 0005 §5), not an engine's to rename: not-flagged, model-rule-conflict and no-robust-policy-in-model name R0, R1 and R2; inconclusive-in-model names none.",
|
|
76
|
+
"type": "string",
|
|
77
|
+
"enum": [
|
|
78
|
+
"not-flagged",
|
|
79
|
+
"model-rule-conflict",
|
|
80
|
+
"no-robust-policy-in-model",
|
|
81
|
+
"inconclusive-in-model"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"advisory": {
|
|
85
|
+
"type": "object",
|
|
86
|
+
"additionalProperties": false,
|
|
87
|
+
"required": [
|
|
88
|
+
"action",
|
|
89
|
+
"margin_m",
|
|
90
|
+
"breaches",
|
|
91
|
+
"envelope"
|
|
92
|
+
],
|
|
93
|
+
"properties": {
|
|
94
|
+
"action": {
|
|
95
|
+
"type": "object",
|
|
96
|
+
"additionalProperties": false,
|
|
97
|
+
"properties": {
|
|
98
|
+
"alter_deg": {
|
|
99
|
+
"type": "number"
|
|
100
|
+
},
|
|
101
|
+
"sog_kn": {
|
|
102
|
+
"type": "number"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"margin_m": {
|
|
107
|
+
"type": "number"
|
|
108
|
+
},
|
|
109
|
+
"breaches": {
|
|
110
|
+
"type": "array",
|
|
111
|
+
"items": {
|
|
112
|
+
"$ref": "evaluation.schema.json#/$defs/paragraphCite"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"envelope": {
|
|
116
|
+
"type": "object",
|
|
117
|
+
"additionalProperties": false,
|
|
118
|
+
"required": [
|
|
119
|
+
"holds_until_s"
|
|
120
|
+
],
|
|
121
|
+
"properties": {
|
|
122
|
+
"holds_until_s": {
|
|
123
|
+
"type": "number"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"region": {
|
|
130
|
+
"$comment": "Regions of situation space as predicates over the flat `<subject>:<class>:<key>` namespace, first match wins, no match is inconclusive-in-model.",
|
|
131
|
+
"type": "object",
|
|
132
|
+
"additionalProperties": false,
|
|
133
|
+
"required": [
|
|
134
|
+
"when",
|
|
135
|
+
"status"
|
|
136
|
+
],
|
|
137
|
+
"properties": {
|
|
138
|
+
"when": {
|
|
139
|
+
"$ref": "applicability.schema.json#/$defs/situationWhen"
|
|
140
|
+
},
|
|
141
|
+
"status": {
|
|
142
|
+
"$ref": "#/$defs/status"
|
|
143
|
+
},
|
|
144
|
+
"advisories": {
|
|
145
|
+
"type": "array",
|
|
146
|
+
"items": {
|
|
147
|
+
"$ref": "#/$defs/advisory"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"assumptions_violated": {
|
|
151
|
+
"type": "array",
|
|
152
|
+
"items": {
|
|
153
|
+
"type": "string"
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
package/schema/rules.schema.json
CHANGED
|
@@ -2,53 +2,15 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/mark-brannan/colregs/schema/rules.schema.json",
|
|
4
4
|
"title": "data/rules.json",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "The language-neutral skeleton: paragraph paths, rule numbers, jurisdictions and figures. No text -- the words live in data/text/ corpora (schema/corpus.schema.json); the edition each jurisdiction consolidates is declared in data/editions.json. Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md, docs/adr/0003-language-as-a-dimension.md and docs/adr/0013-corpus-files-with-editions.md.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
|
-
"required": [
|
|
9
|
-
|
|
10
|
-
{
|
|
11
|
-
"$comment": "colregs#85: a withheld paragraph is a citation, not a reproduction (ADR 0010) -- 'retrieved' is when that citation was last checked against the primary source, so it can't be blank on a document that withholds text.",
|
|
12
|
-
"if": {
|
|
13
|
-
"properties": {
|
|
14
|
-
"paragraphs": {
|
|
15
|
-
"not": {
|
|
16
|
-
"type": "object",
|
|
17
|
-
"patternProperties": {
|
|
18
|
-
"^.*$": {
|
|
19
|
-
"not": {
|
|
20
|
-
"type": "object",
|
|
21
|
-
"properties": { "text_status": { "const": "withheld" } },
|
|
22
|
-
"required": ["text_status"]
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"then": {
|
|
31
|
-
"properties": { "retrieved": { "type": "string" } },
|
|
32
|
-
"required": ["retrieved"]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
8
|
+
"required": [
|
|
9
|
+
"paragraphs"
|
|
35
10
|
],
|
|
36
11
|
"properties": {
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
"retrieved": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
|
|
40
|
-
"note": { "type": "string" },
|
|
41
|
-
"gaps": {
|
|
42
|
-
"type": "array",
|
|
43
|
-
"items": {
|
|
44
|
-
"type": "object",
|
|
45
|
-
"additionalProperties": false,
|
|
46
|
-
"required": ["path", "reason"],
|
|
47
|
-
"properties": {
|
|
48
|
-
"path": { "type": "string", "minLength": 1 },
|
|
49
|
-
"reason": { "type": "string", "minLength": 1 }
|
|
50
|
-
}
|
|
51
|
-
}
|
|
12
|
+
"note": {
|
|
13
|
+
"type": "string"
|
|
52
14
|
},
|
|
53
15
|
"paragraphs": {
|
|
54
16
|
"type": "object",
|
|
@@ -57,62 +19,30 @@
|
|
|
57
19
|
"^[0-9]+(\\([a-z]\\))?(\\([ivx]+\\))?$": {
|
|
58
20
|
"type": "object",
|
|
59
21
|
"additionalProperties": false,
|
|
60
|
-
"required": [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"if": {
|
|
65
|
-
"properties": { "text_status": { "const": "withheld" } },
|
|
66
|
-
"required": ["text_status"]
|
|
67
|
-
},
|
|
68
|
-
"then": {
|
|
69
|
-
"properties": {
|
|
70
|
-
"text": false,
|
|
71
|
-
"withheld_reason": { "type": "string", "minLength": 1 }
|
|
72
|
-
},
|
|
73
|
-
"required": ["withheld_reason"]
|
|
74
|
-
},
|
|
75
|
-
"else": {
|
|
76
|
-
"$comment": "mirrors, text_digest and text_slug are open to verbatim paragraphs too; only withheld_reason is incoherent without a bar.",
|
|
77
|
-
"properties": {
|
|
78
|
-
"text": { "type": "string", "minLength": 1 },
|
|
79
|
-
"withheld_reason": false
|
|
80
|
-
},
|
|
81
|
-
"required": ["text"]
|
|
82
|
-
}
|
|
83
|
-
}
|
|
22
|
+
"required": [
|
|
23
|
+
"path",
|
|
24
|
+
"rule",
|
|
25
|
+
"jurisdiction"
|
|
84
26
|
],
|
|
85
27
|
"properties": {
|
|
86
|
-
"path": {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"jurisdiction": { "type": "string", "pattern": "^[a-z]+(/[a-z]+)*$" },
|
|
90
|
-
"text": { "type": "string", "minLength": 1 },
|
|
91
|
-
"text_status": {
|
|
92
|
-
"$comment": "Absent means verbatim. 'withheld' means the text is not ours to publish -- ADR 0010.",
|
|
93
|
-
"enum": ["verbatim", "withheld"]
|
|
94
|
-
},
|
|
95
|
-
"withheld_reason": { "type": "string", "minLength": 1 },
|
|
96
|
-
"text_slug": {
|
|
97
|
-
"$comment": "Pencil, ADR 0010: sorted set of lemmatised key nouns and verbs, English counterparts where the source is not English. Defined so the option is not walled off; nothing writes it yet.",
|
|
98
|
-
"type": "array",
|
|
99
|
-
"items": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
100
|
-
"minItems": 1,
|
|
101
|
-
"uniqueItems": true
|
|
28
|
+
"path": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^[0-9]+(\\([a-z]\\))?(\\([ivx]+\\))?$"
|
|
102
31
|
},
|
|
103
|
-
"
|
|
104
|
-
"$comment": "Pencil, ADR 0010: algorithm-qualified digest of the normalised text, e.g. 'sha256:<hex>'. Defined so the option is not walled off by additionalProperties; nothing writes it yet.",
|
|
32
|
+
"rule": {
|
|
105
33
|
"type": "string",
|
|
106
|
-
"pattern": "^[
|
|
34
|
+
"pattern": "^[0-9]+$"
|
|
107
35
|
},
|
|
108
|
-
"
|
|
109
|
-
"$comment": "Paragraph path in intl this provision restates; display labelled as the international equivalent, never as this jurisdiction's text.",
|
|
36
|
+
"jurisdiction": {
|
|
110
37
|
"type": "string",
|
|
111
|
-
"pattern": "^[
|
|
38
|
+
"pattern": "^[a-z]+(/[a-z]+)*$"
|
|
112
39
|
},
|
|
113
40
|
"images": {
|
|
114
41
|
"type": "array",
|
|
115
|
-
"items": {
|
|
42
|
+
"items": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1
|
|
45
|
+
},
|
|
116
46
|
"minItems": 1
|
|
117
47
|
}
|
|
118
48
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://github.com/mark-brannan/colregs/schema/situation-fixtures.schema.json",
|
|
4
4
|
"title": "fixtures/situation-fixtures.json",
|
|
5
|
-
"description": "Two-subject situation fixtures (ADR 0005, REQ-CAT-5). Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md.
|
|
5
|
+
"description": "Two-subject situation fixtures (ADR 0005, REQ-CAT-5). Structure only -- see docs/adr/0006-json-schema-and-identifier-diff.md. A case's situation is schema/situation.schema.json; namespace resolution (every kin:/geo:/hist: key declared in facts.json) stays in the tests.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"required": [
|
|
@@ -12,26 +12,16 @@
|
|
|
12
12
|
"cases"
|
|
13
13
|
],
|
|
14
14
|
"$defs": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"pattern": "^[0-9]+[a-z0-9]*(-[a-z0-9]+)*$"
|
|
15
|
+
"ruleId": {
|
|
16
|
+
"$ref": "applicability.schema.json#/$defs/ruleId"
|
|
18
17
|
},
|
|
19
18
|
"modality": {
|
|
20
|
-
"
|
|
21
|
-
"enum": [
|
|
22
|
-
"shall",
|
|
23
|
-
"may",
|
|
24
|
-
"shall-if-practicable",
|
|
25
|
-
"conditional",
|
|
26
|
-
"exempt",
|
|
27
|
-
"shall-not",
|
|
28
|
-
"shall-not-impede"
|
|
29
|
-
]
|
|
19
|
+
"$ref": "applicability.schema.json#/$defs/modality"
|
|
30
20
|
},
|
|
31
21
|
"expectItem": {
|
|
32
22
|
"oneOf": [
|
|
33
23
|
{
|
|
34
|
-
"$ref": "#/$defs/
|
|
24
|
+
"$ref": "#/$defs/ruleId"
|
|
35
25
|
},
|
|
36
26
|
{
|
|
37
27
|
"type": "object",
|
|
@@ -42,7 +32,7 @@
|
|
|
42
32
|
],
|
|
43
33
|
"properties": {
|
|
44
34
|
"entry": {
|
|
45
|
-
"$ref": "#/$defs/
|
|
35
|
+
"$ref": "#/$defs/ruleId"
|
|
46
36
|
},
|
|
47
37
|
"modality": {
|
|
48
38
|
"$ref": "#/$defs/modality"
|
|
@@ -50,109 +40,6 @@
|
|
|
50
40
|
}
|
|
51
41
|
}
|
|
52
42
|
]
|
|
53
|
-
},
|
|
54
|
-
"scalar": {
|
|
55
|
-
"oneOf": [
|
|
56
|
-
{
|
|
57
|
-
"type": "string",
|
|
58
|
-
"pattern": "^[a-z][a-z0-9_]*:[a-z0-9_]+$"
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"type": "number"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"type": "boolean"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "null"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"type": "object",
|
|
71
|
-
"additionalProperties": false,
|
|
72
|
-
"required": [
|
|
73
|
-
"latitude",
|
|
74
|
-
"longitude"
|
|
75
|
-
],
|
|
76
|
-
"properties": {
|
|
77
|
-
"latitude": {
|
|
78
|
-
"type": "number",
|
|
79
|
-
"minimum": -90,
|
|
80
|
-
"maximum": 90
|
|
81
|
-
},
|
|
82
|
-
"longitude": {
|
|
83
|
-
"type": "number",
|
|
84
|
-
"minimum": -180,
|
|
85
|
-
"maximum": 180
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
]
|
|
90
|
-
},
|
|
91
|
-
"factRecord": {
|
|
92
|
-
"type": "object",
|
|
93
|
-
"additionalProperties": false,
|
|
94
|
-
"patternProperties": {
|
|
95
|
-
"^fact:[a-z0-9_]+$": {
|
|
96
|
-
"$ref": "#/$defs/scalar"
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"kinRecord": {
|
|
101
|
-
"type": "object",
|
|
102
|
-
"additionalProperties": false,
|
|
103
|
-
"patternProperties": {
|
|
104
|
-
"^kin:[a-z0-9_]+$": {
|
|
105
|
-
"$ref": "#/$defs/scalar"
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"geoRecord": {
|
|
110
|
-
"type": "object",
|
|
111
|
-
"additionalProperties": false,
|
|
112
|
-
"patternProperties": {
|
|
113
|
-
"^geo:[a-z0-9_]+$": {
|
|
114
|
-
"$ref": "#/$defs/scalar"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"histRecord": {
|
|
119
|
-
"type": "object",
|
|
120
|
-
"additionalProperties": false,
|
|
121
|
-
"patternProperties": {
|
|
122
|
-
"^hist:[a-z0-9_]+$": {
|
|
123
|
-
"$ref": "#/$defs/scalar"
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
},
|
|
127
|
-
"envRecord": {
|
|
128
|
-
"type": "object",
|
|
129
|
-
"additionalProperties": false,
|
|
130
|
-
"patternProperties": {
|
|
131
|
-
"^env:[a-z0-9_]+$": {
|
|
132
|
-
"$ref": "#/$defs/scalar"
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
"vessel": {
|
|
137
|
-
"type": "object",
|
|
138
|
-
"additionalProperties": false,
|
|
139
|
-
"required": [
|
|
140
|
-
"fact"
|
|
141
|
-
],
|
|
142
|
-
"properties": {
|
|
143
|
-
"fact": {
|
|
144
|
-
"$ref": "#/$defs/factRecord"
|
|
145
|
-
},
|
|
146
|
-
"kin": {
|
|
147
|
-
"$ref": "#/$defs/kinRecord"
|
|
148
|
-
},
|
|
149
|
-
"geo": {
|
|
150
|
-
"$ref": "#/$defs/geoRecord"
|
|
151
|
-
},
|
|
152
|
-
"hist": {
|
|
153
|
-
"$ref": "#/$defs/histRecord"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
43
|
}
|
|
157
44
|
},
|
|
158
45
|
"properties": {
|
|
@@ -200,7 +87,7 @@
|
|
|
200
87
|
"type": "string"
|
|
201
88
|
},
|
|
202
89
|
"bare": {
|
|
203
|
-
"$ref": "#/$defs/
|
|
90
|
+
"$ref": "#/$defs/ruleId"
|
|
204
91
|
},
|
|
205
92
|
"with_modality": {
|
|
206
93
|
"type": "object",
|
|
@@ -211,7 +98,7 @@
|
|
|
211
98
|
],
|
|
212
99
|
"properties": {
|
|
213
100
|
"entry": {
|
|
214
|
-
"$ref": "#/$defs/
|
|
101
|
+
"$ref": "#/$defs/ruleId"
|
|
215
102
|
},
|
|
216
103
|
"modality": {
|
|
217
104
|
"$ref": "#/$defs/modality"
|
|
@@ -286,31 +173,8 @@
|
|
|
286
173
|
}
|
|
287
174
|
},
|
|
288
175
|
"situation": {
|
|
289
|
-
"
|
|
290
|
-
"
|
|
291
|
-
"required": [
|
|
292
|
-
"own"
|
|
293
|
-
],
|
|
294
|
-
"properties": {
|
|
295
|
-
"own": {
|
|
296
|
-
"$ref": "#/$defs/vessel"
|
|
297
|
-
},
|
|
298
|
-
"other": {
|
|
299
|
-
"$ref": "#/$defs/vessel"
|
|
300
|
-
},
|
|
301
|
-
"pair": {
|
|
302
|
-
"type": "object",
|
|
303
|
-
"additionalProperties": false,
|
|
304
|
-
"properties": {
|
|
305
|
-
"geo": {
|
|
306
|
-
"$ref": "#/$defs/geoRecord"
|
|
307
|
-
},
|
|
308
|
-
"env": {
|
|
309
|
-
"$ref": "#/$defs/envRecord"
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
176
|
+
"$comment": "A Situation (schema/situation.schema.json, ADR 0014).",
|
|
177
|
+
"$ref": "situation.schema.json"
|
|
314
178
|
}
|
|
315
179
|
}
|
|
316
180
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/situation.schema.json",
|
|
4
|
+
"title": "Situation",
|
|
5
|
+
"description": "Two vessels and the encounter at one instant: the input evaluateEncounter reads, nested by subject and class (ADR 0005 §2, ADR 0011 §3, ADR 0014). Structure only -- every kin:/geo:/hist:/env: key must be declared in data/facts.json §situation, checked in the tests.",
|
|
6
|
+
"$comment": "The same shape as a case's `situation` in schema/situation-fixtures.schema.json, stated once here so an operation can name it; `own` required, `other` optional (Rule 19's single-vessel scope), every class and key optional -- absent is absent.",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"required": ["own"],
|
|
10
|
+
"properties": {
|
|
11
|
+
"own": { "$ref": "#/$defs/subject" },
|
|
12
|
+
"other": { "$ref": "#/$defs/subject" },
|
|
13
|
+
"pair": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"properties": {
|
|
17
|
+
"geo": { "$ref": "#/$defs/geoRecord" },
|
|
18
|
+
"env": { "$ref": "#/$defs/envRecord" }
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"$defs": {
|
|
23
|
+
"scalar": {
|
|
24
|
+
"oneOf": [
|
|
25
|
+
{ "type": "string", "pattern": "^[a-z][a-z0-9_]*:[a-z0-9_]+$" },
|
|
26
|
+
{ "type": "number" },
|
|
27
|
+
{ "type": "boolean" },
|
|
28
|
+
{ "type": "null" },
|
|
29
|
+
{
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": ["latitude", "longitude"],
|
|
33
|
+
"properties": {
|
|
34
|
+
"latitude": { "type": "number", "minimum": -90, "maximum": 90 },
|
|
35
|
+
"longitude": { "type": "number", "minimum": -180, "maximum": 180 }
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"kinRecord": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"patternProperties": { "^kin:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
44
|
+
},
|
|
45
|
+
"geoRecord": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"patternProperties": { "^geo:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
49
|
+
},
|
|
50
|
+
"histRecord": {
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"patternProperties": { "^hist:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
54
|
+
},
|
|
55
|
+
"envRecord": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"additionalProperties": false,
|
|
58
|
+
"patternProperties": { "^env:[a-z0-9_]+$": { "$ref": "#/$defs/scalar" } }
|
|
59
|
+
},
|
|
60
|
+
"subject": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["fact"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"fact": { "$ref": "fact-record.schema.json" },
|
|
66
|
+
"kin": { "$ref": "#/$defs/kinRecord" },
|
|
67
|
+
"geo": { "$ref": "#/$defs/geoRecord" },
|
|
68
|
+
"hist": { "$ref": "#/$defs/histRecord" }
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/mark-brannan/colregs/schema/trace.schema.json",
|
|
4
|
+
"title": "Trace",
|
|
5
|
+
"description": "The situation over time: the window evaluateConduct reads (ADR 0012 §2, ADR 0014). A conforming implementation rejects an empty samples list, a `t_s` that does not strictly increase, and `other` present in some samples and absent in others; `t_s` is seconds on the caller's clock, read as differences only, and the pair's identity is the caller's, since a Situation names no vessel. Structure only.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"samples"
|
|
10
|
+
],
|
|
11
|
+
"properties": {
|
|
12
|
+
"samples": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"items": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"required": [
|
|
19
|
+
"t_s",
|
|
20
|
+
"situation"
|
|
21
|
+
],
|
|
22
|
+
"properties": {
|
|
23
|
+
"t_s": {
|
|
24
|
+
"type": "number"
|
|
25
|
+
},
|
|
26
|
+
"situation": {
|
|
27
|
+
"$ref": "situation.schema.json"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|