ruml-parser 1.0.0__py3-none-any.whl
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.
- ruml_parser/__init__.py +183 -0
- ruml_parser/internal/__init__.py +2 -0
- ruml_parser/internal/extension.py +91 -0
- ruml_parser/internal/mapping.py +731 -0
- ruml_parser/internal/ruml/__init__.py +237 -0
- ruml_parser/internal/ruml/actions/__init__.py +2 -0
- ruml_parser/internal/ruml/actions/actions_capability_declaration.py +23 -0
- ruml_parser/internal/ruml/actions/actions_node_capability.py +40 -0
- ruml_parser/internal/ruml/ai_query/__init__.py +2 -0
- ruml_parser/internal/ruml/ai_query/ai_query_capability_declaration.py +25 -0
- ruml_parser/internal/ruml/ai_query/ai_query_node_capability.py +66 -0
- ruml_parser/internal/ruml/aliases.py +93 -0
- ruml_parser/internal/ruml/capability/__init__.py +2 -0
- ruml_parser/internal/ruml/capability/abstract_capability_declaration.py +23 -0
- ruml_parser/internal/ruml/capability/abstract_node_capability.py +14 -0
- ruml_parser/internal/ruml/capability/capability_declaration.py +52 -0
- ruml_parser/internal/ruml/capability/capability_declarations.py +199 -0
- ruml_parser/internal/ruml/capability/extension_node_capability.py +17 -0
- ruml_parser/internal/ruml/capability/node_capabilities.py +113 -0
- ruml_parser/internal/ruml/capability/other_node_capability.py +21 -0
- ruml_parser/internal/ruml/context/__init__.py +2 -0
- ruml_parser/internal/ruml/context/context.py +40 -0
- ruml_parser/internal/ruml/context/context_capability_declaration.py +25 -0
- ruml_parser/internal/ruml/context/context_refs_node_capability.py +17 -0
- ruml_parser/internal/ruml/datapoints/__init__.py +2 -0
- ruml_parser/internal/ruml/datapoints/datapoint.py +101 -0
- ruml_parser/internal/ruml/datapoints/datapoint_set.py +20 -0
- ruml_parser/internal/ruml/datapoints/datapoints_capability_declaration.py +29 -0
- ruml_parser/internal/ruml/datapoints/option.py +11 -0
- ruml_parser/internal/ruml/expression/__init__.py +2 -0
- ruml_parser/internal/ruml/expression/expression_capability_declaration.py +23 -0
- ruml_parser/internal/ruml/expression/expression_node_capability.py +20 -0
- ruml_parser/internal/ruml/metadata.py +83 -0
- ruml_parser/internal/ruml/nodes/__init__.py +2 -0
- ruml_parser/internal/ruml/nodes/abstract_node.py +29 -0
- ruml_parser/internal/ruml/nodes/branch_node.py +15 -0
- ruml_parser/internal/ruml/nodes/leaf_node.py +10 -0
- ruml_parser/internal/ruml/nodes/node.py +6 -0
- ruml_parser/internal/ruml/protocol/__init__.py +2 -0
- ruml_parser/internal/ruml/protocol/protocol_capability_declaration.py +29 -0
- ruml_parser/internal/ruml/query/__init__.py +2 -0
- ruml_parser/internal/ruml/query/query_capability_declaration.py +23 -0
- ruml_parser/internal/ruml/query/query_node_capability.py +17 -0
- ruml_parser/internal/ruml/ruml_document.py +45 -0
- ruml_parser/internal/ruml/text_reference/__init__.py +2 -0
- ruml_parser/internal/ruml/text_reference/text.py +69 -0
- ruml_parser/internal/ruml/text_reference/text_reference_capability_declaration.py +25 -0
- ruml_parser/internal/ruml/text_reference/text_refs_node_capability.py +32 -0
- ruml_parser/internal/ruml/tree/__init__.py +2 -0
- ruml_parser/internal/ruml/tree/tree_capability_declarations.py +30 -0
- ruml_parser/internal/validation/__init__.py +14 -0
- ruml_parser/internal/validation/capabilities.py +227 -0
- ruml_parser/internal/validation/contexts.py +51 -0
- ruml_parser/internal/validation/datapoint_sets.py +125 -0
- ruml_parser/internal/validation/modular.py +42 -0
- ruml_parser/internal/validation/recursion.py +197 -0
- ruml_parser/internal/validation/root.py +36 -0
- ruml_parser/internal/validation/texts.py +50 -0
- ruml_parser/model/__init__.py +2 -0
- ruml_parser/model/ruml.py +1156 -0
- ruml_parser/model/ruml_result.py +430 -0
- ruml_parser/node_result_status.py +19 -0
- ruml_parser/pydantic.py +96 -0
- ruml_parser/ruml_parser.py +75 -0
- ruml_parser/schema_files.py +23 -0
- ruml_parser/schema_validation.py +354 -0
- ruml_parser/structural_error.py +36 -0
- ruml_parser/text.py +220 -0
- ruml_parser-1.0.0.dist-info/METADATA +119 -0
- ruml_parser-1.0.0.dist-info/RECORD +72 -0
- ruml_parser-1.0.0.dist-info/WHEEL +4 -0
- ruml_parser-1.0.0.dist-info/licenses/LICENSE +73 -0
|
@@ -0,0 +1,1156 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 Rulemapping Group GmbH
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
# generated by datamodel-codegen:
|
|
4
|
+
# filename: ruml.schema.json
|
|
5
|
+
|
|
6
|
+
from collections.abc import Mapping, Sequence
|
|
7
|
+
from datetime import date as date_aliased
|
|
8
|
+
from enum import StrEnum
|
|
9
|
+
from typing import Annotated, Any, Literal
|
|
10
|
+
from uuid import UUID
|
|
11
|
+
|
|
12
|
+
from pydantic import (
|
|
13
|
+
AnyUrl,
|
|
14
|
+
AwareDatetime,
|
|
15
|
+
BaseModel,
|
|
16
|
+
ConfigDict,
|
|
17
|
+
EmailStr,
|
|
18
|
+
Field,
|
|
19
|
+
confloat,
|
|
20
|
+
conint,
|
|
21
|
+
constr,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class FieldSpecVersion(StrEnum):
|
|
26
|
+
field_1_0 = "1.0"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
type Timestamp = AwareDatetime
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
type DatapointDateTime = Annotated[
|
|
33
|
+
constr(
|
|
34
|
+
pattern=r"^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])[Tt](?:[01][0-9]|2[0-3]):[0-5][0-9](?::(?:[0-5][0-9]|60)(?:\.[0-9]+)?)?(?:[Zz]|[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)?$"
|
|
35
|
+
),
|
|
36
|
+
Field(
|
|
37
|
+
...,
|
|
38
|
+
description="Date and time of day for a datapoint: YYYY-MM-DDTHH:MM, optionally with seconds, a fraction of a second and an offset (§4.7.1, §4.7.3)",
|
|
39
|
+
),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
type DatapointTime = Annotated[
|
|
44
|
+
constr(
|
|
45
|
+
pattern=r"^(?:[01][0-9]|2[0-3]):[0-5][0-9](?::(?:[0-5][0-9]|60)(?:\.[0-9]+)?)?(?:[Zz]|[+-](?:[01][0-9]|2[0-3])(?::?[0-5][0-9])?)?$"
|
|
46
|
+
),
|
|
47
|
+
Field(
|
|
48
|
+
...,
|
|
49
|
+
description="Time of day without a date: HH:MM, optionally with seconds, a fraction of a second and an offset (§4.7.1, §4.7.3)",
|
|
50
|
+
),
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
type Uuid = UUID
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class DocumentStatus(StrEnum):
|
|
58
|
+
draft = "draft"
|
|
59
|
+
review = "review"
|
|
60
|
+
approved = "approved"
|
|
61
|
+
inForce = "inForce"
|
|
62
|
+
suspended = "suspended"
|
|
63
|
+
expired = "expired"
|
|
64
|
+
replaced = "replaced"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class DocumentType(StrEnum):
|
|
68
|
+
law = "law"
|
|
69
|
+
regulation = "regulation"
|
|
70
|
+
guideline = "guideline"
|
|
71
|
+
decision = "decision"
|
|
72
|
+
procedure = "procedure"
|
|
73
|
+
form = "form"
|
|
74
|
+
documentGeneration = "documentGeneration"
|
|
75
|
+
other = "other"
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class Author(BaseModel):
|
|
79
|
+
model_config = ConfigDict(
|
|
80
|
+
extra="forbid",
|
|
81
|
+
populate_by_name=True,
|
|
82
|
+
frozen=True,
|
|
83
|
+
)
|
|
84
|
+
name: str = Field(..., description="Name of the author")
|
|
85
|
+
email: EmailStr | None = Field(None, description="Optional email of the author")
|
|
86
|
+
organization: str | None = Field(
|
|
87
|
+
None,
|
|
88
|
+
description="Refers to the institutional affiliation of the author - not the publishing organization of the document",
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class DerivationType(StrEnum):
|
|
93
|
+
workingCopy = "workingCopy"
|
|
94
|
+
amendment = "amendment"
|
|
95
|
+
revision = "revision"
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class DerivedFrom(BaseModel):
|
|
99
|
+
model_config = ConfigDict(
|
|
100
|
+
extra="forbid",
|
|
101
|
+
populate_by_name=True,
|
|
102
|
+
frozen=True,
|
|
103
|
+
)
|
|
104
|
+
originalId: Uuid = Field(..., description="The id of the original document")
|
|
105
|
+
originalHash: (
|
|
106
|
+
constr(pattern=r"^(?:sha3-256|sha256|blake3):[0-9a-f]{64}$") | None
|
|
107
|
+
) = Field(None, description="The hash of the original document")
|
|
108
|
+
originalStatus: DocumentStatus = Field(
|
|
109
|
+
..., description="The status of the original at the time of copying"
|
|
110
|
+
)
|
|
111
|
+
derivationType: DerivationType = Field(
|
|
112
|
+
..., description="How this document was derived from the original"
|
|
113
|
+
)
|
|
114
|
+
derivedAt: Timestamp = Field(..., description="The timestamp of the copy creation")
|
|
115
|
+
derivedBy: str | None = Field(None, description="Creating entity/person")
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class Metadata(BaseModel):
|
|
119
|
+
model_config = ConfigDict(
|
|
120
|
+
extra="forbid",
|
|
121
|
+
populate_by_name=True,
|
|
122
|
+
frozen=True,
|
|
123
|
+
)
|
|
124
|
+
id: Uuid = Field(..., description="Unique identifier of the RUML file")
|
|
125
|
+
title: str | None = Field(None, description="Title of the rulemap")
|
|
126
|
+
description: str | None = Field(
|
|
127
|
+
None, description="Description of what the rulemap represents"
|
|
128
|
+
)
|
|
129
|
+
version: str = Field(..., description="Content version")
|
|
130
|
+
created: Timestamp = Field(..., description="Creation timestamp")
|
|
131
|
+
modified: Timestamp = Field(..., description="Timestamp of the last modification")
|
|
132
|
+
status: DocumentStatus = Field(..., description="The status of a RUML file")
|
|
133
|
+
documentType: DocumentType | None = Field(
|
|
134
|
+
None, description="The type of the document"
|
|
135
|
+
)
|
|
136
|
+
authors: Sequence[Author] | None = Field(
|
|
137
|
+
None, description="List of authors", min_length=1
|
|
138
|
+
)
|
|
139
|
+
organization: str | None = Field(
|
|
140
|
+
None,
|
|
141
|
+
description="Publishing organization who is institutionally responsible for the document",
|
|
142
|
+
)
|
|
143
|
+
jurisdiction: constr(pattern=r"^[A-Z]{2}(?:-[A-Z0-9]+)*$") | None = Field(
|
|
144
|
+
None, description="Jurisdiction"
|
|
145
|
+
)
|
|
146
|
+
legalDomain: str | None = Field(None, description="Legal domain")
|
|
147
|
+
tags: Sequence[str] | None = Field(None, description="Categorization/tagging")
|
|
148
|
+
derivedFrom: DerivedFrom | None = Field(
|
|
149
|
+
None, description="Derivation of the document"
|
|
150
|
+
)
|
|
151
|
+
language: constr(pattern=r"^[a-z]{2}$") | None = Field(None, description="Language")
|
|
152
|
+
validFrom: Timestamp | None = Field(None, description="Validity start date")
|
|
153
|
+
validUntil: Timestamp | None = Field(None, description="Validity end date")
|
|
154
|
+
replaces: Uuid | None = Field(None, description="Reference a replaced version")
|
|
155
|
+
replacedBy: Uuid | None = Field(None, description="Reference a successor version")
|
|
156
|
+
comment: str | None = Field(
|
|
157
|
+
None,
|
|
158
|
+
description="Free-text comment on the document, e.g. the reason for status suspended (§3.3.3)",
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class OfficialCapabilityId(StrEnum):
|
|
163
|
+
ruml_datapoints = "ruml:datapoints"
|
|
164
|
+
ruml_text_reference = "ruml:text-reference"
|
|
165
|
+
ruml_tree_reference = "ruml:tree-reference"
|
|
166
|
+
ruml_tree_include = "ruml:tree-include"
|
|
167
|
+
ruml_context = "ruml:context"
|
|
168
|
+
ruml_query = "ruml:query"
|
|
169
|
+
ruml_ai_query = "ruml:ai-query"
|
|
170
|
+
ruml_expression = "ruml:expression"
|
|
171
|
+
ruml_actions = "ruml:actions"
|
|
172
|
+
ruml_protocol = "ruml:protocol"
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
type DraftCapabilityId = Annotated[
|
|
176
|
+
constr(pattern=r"^ruml:draft(?:\/[a-z0-9_-]+)+$", max_length=128),
|
|
177
|
+
Field(
|
|
178
|
+
...,
|
|
179
|
+
description="Local draft capability id (e.g. `ruml:draft/my-capability`). Used for in-progress capabilities.",
|
|
180
|
+
),
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
type ReverseDomainCapabilityId = Annotated[
|
|
185
|
+
constr(
|
|
186
|
+
pattern=r"^[a-z0-9_-]+(?:\.[a-z0-9_-]+)+(?:\/[a-z0-9_-]+)+$", max_length=128
|
|
187
|
+
),
|
|
188
|
+
Field(
|
|
189
|
+
...,
|
|
190
|
+
description="Third-party capability id in reverse-domain form (e.g. `com.example/my-capability`).",
|
|
191
|
+
),
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
type LexId = constr(pattern=r"^[1-9][0-9]*$")
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class Operator(StrEnum):
|
|
199
|
+
AND = "AND"
|
|
200
|
+
OR = "OR"
|
|
201
|
+
XOR = "XOR"
|
|
202
|
+
NOT_AND = "NOT_AND"
|
|
203
|
+
NOT_OR = "NOT_OR"
|
|
204
|
+
NOT_XOR = "NOT_XOR"
|
|
205
|
+
DELEGATED = "DELEGATED"
|
|
206
|
+
undefined = "undefined"
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class DecisionMode(StrEnum):
|
|
210
|
+
fallback = "fallback"
|
|
211
|
+
agreement = "agreement"
|
|
212
|
+
majority = "majority"
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
type DatapointId = constr(pattern=r"^[a-z_][a-z0-9_]*$")
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
class Type(StrEnum):
|
|
219
|
+
string = "string"
|
|
220
|
+
number = "number"
|
|
221
|
+
boolean = "boolean"
|
|
222
|
+
date = "date"
|
|
223
|
+
datetime = "datetime"
|
|
224
|
+
time = "time"
|
|
225
|
+
integer = "integer"
|
|
226
|
+
currency = "currency"
|
|
227
|
+
percentage = "percentage"
|
|
228
|
+
duration = "duration"
|
|
229
|
+
email = "email"
|
|
230
|
+
phone = "phone"
|
|
231
|
+
location = "location"
|
|
232
|
+
identifier = "identifier"
|
|
233
|
+
iban = "iban"
|
|
234
|
+
count = "count"
|
|
235
|
+
url = "url"
|
|
236
|
+
address = "address"
|
|
237
|
+
enum = "enum"
|
|
238
|
+
object = "object"
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
class Option(BaseModel):
|
|
242
|
+
model_config = ConfigDict(
|
|
243
|
+
extra="forbid",
|
|
244
|
+
populate_by_name=True,
|
|
245
|
+
frozen=True,
|
|
246
|
+
)
|
|
247
|
+
value: str = Field(..., description="Value of the option")
|
|
248
|
+
label: str | None = Field(None, description="Human-readable label for the option")
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class Type1(StrEnum):
|
|
252
|
+
input = "input"
|
|
253
|
+
external = "external"
|
|
254
|
+
computed = "computed"
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class SourceType(StrEnum):
|
|
258
|
+
api = "api"
|
|
259
|
+
database = "database"
|
|
260
|
+
file = "file"
|
|
261
|
+
rulemap = "rulemap"
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class Fallback(BaseModel):
|
|
265
|
+
model_config = ConfigDict(
|
|
266
|
+
extra="forbid",
|
|
267
|
+
populate_by_name=True,
|
|
268
|
+
frozen=True,
|
|
269
|
+
)
|
|
270
|
+
type: Literal["input"] = Field(
|
|
271
|
+
..., description="Binding kind: the value is supplied by user input"
|
|
272
|
+
)
|
|
273
|
+
hint: str | None = Field(
|
|
274
|
+
None, description="Hint shown to the user when entering the value"
|
|
275
|
+
)
|
|
276
|
+
placeholder: str | None = Field(
|
|
277
|
+
None, description="Placeholder text for the input field"
|
|
278
|
+
)
|
|
279
|
+
defaultValue: Any | None = Field(
|
|
280
|
+
None, description="Default value pre-filled for the input"
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class Binding(BaseModel):
|
|
285
|
+
model_config = ConfigDict(
|
|
286
|
+
extra="forbid",
|
|
287
|
+
populate_by_name=True,
|
|
288
|
+
frozen=True,
|
|
289
|
+
)
|
|
290
|
+
type: Type1 = Field(
|
|
291
|
+
...,
|
|
292
|
+
description="Binding kind: `input` is supplied by the user, `external` is fetched from a source, `computed` is derived from other datapoints",
|
|
293
|
+
)
|
|
294
|
+
hint: str | None = Field(
|
|
295
|
+
None, description="Hint shown to the user when entering the value"
|
|
296
|
+
)
|
|
297
|
+
placeholder: str | None = Field(
|
|
298
|
+
None, description="Placeholder text for the input field"
|
|
299
|
+
)
|
|
300
|
+
defaultValue: Any | None = Field(
|
|
301
|
+
None, description="Default value pre-filled for the input"
|
|
302
|
+
)
|
|
303
|
+
ref: str | None = Field(
|
|
304
|
+
None, description="Symbolic reference to the external source"
|
|
305
|
+
)
|
|
306
|
+
sourceType: SourceType | None = Field(
|
|
307
|
+
None, description="Kind of external source the value is fetched from"
|
|
308
|
+
)
|
|
309
|
+
fallback: Fallback | None = Field(
|
|
310
|
+
None,
|
|
311
|
+
description="Input binding used when the external source cannot be reached",
|
|
312
|
+
)
|
|
313
|
+
expression: str | None = Field(
|
|
314
|
+
None,
|
|
315
|
+
description="JSONata expression; other datapoints are referenced by their id",
|
|
316
|
+
)
|
|
317
|
+
description: str | None = Field(
|
|
318
|
+
None, description="Description of the external source or of the calculation"
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
class Validation(BaseModel):
|
|
323
|
+
model_config = ConfigDict(
|
|
324
|
+
extra="forbid",
|
|
325
|
+
populate_by_name=True,
|
|
326
|
+
frozen=True,
|
|
327
|
+
)
|
|
328
|
+
required: bool | None = Field(None, description="Whether a value must be provided")
|
|
329
|
+
min: float | str | None = Field(
|
|
330
|
+
None,
|
|
331
|
+
description="Minimum value (number, or ISO-8601 string for temporal types)",
|
|
332
|
+
)
|
|
333
|
+
max: float | str | None = Field(
|
|
334
|
+
None,
|
|
335
|
+
description="Maximum value (number, or ISO-8601 string for temporal types)",
|
|
336
|
+
)
|
|
337
|
+
minLength: conint(ge=0, le=9007199254740991) | None = Field(
|
|
338
|
+
None, description="Minimum length of the value"
|
|
339
|
+
)
|
|
340
|
+
maxLength: conint(ge=0, le=9007199254740991) | None = Field(
|
|
341
|
+
None, description="Maximum length of the value"
|
|
342
|
+
)
|
|
343
|
+
pattern: str | None = Field(
|
|
344
|
+
None, description="Regular expression the value must match"
|
|
345
|
+
)
|
|
346
|
+
enum: Sequence[Any] | None = Field(
|
|
347
|
+
None, description="Explicit set of allowed values"
|
|
348
|
+
)
|
|
349
|
+
message: str | None = Field(None, description="Custom validation error message")
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
class Cardinality(BaseModel):
|
|
353
|
+
model_config = ConfigDict(
|
|
354
|
+
extra="forbid",
|
|
355
|
+
populate_by_name=True,
|
|
356
|
+
frozen=True,
|
|
357
|
+
)
|
|
358
|
+
min: conint(ge=0) | None = None
|
|
359
|
+
max: conint(ge=1) | None = None
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
type TextId = constr(pattern=r"^[a-z_][a-z0-9_]*$")
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
class Status(StrEnum):
|
|
366
|
+
draft = "draft"
|
|
367
|
+
proposed = "proposed"
|
|
368
|
+
enacted = "enacted"
|
|
369
|
+
inForce = "inForce"
|
|
370
|
+
amended = "amended"
|
|
371
|
+
repealed = "repealed"
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
class Type2(StrEnum):
|
|
375
|
+
embedded = "embedded"
|
|
376
|
+
container = "container"
|
|
377
|
+
url = "url"
|
|
378
|
+
external = "external"
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
type Sha3Digest = constr(pattern=r"^sha3-256:[0-9a-f]{64}$")
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
class TextSource(BaseModel):
|
|
385
|
+
model_config = ConfigDict(
|
|
386
|
+
extra="forbid",
|
|
387
|
+
populate_by_name=True,
|
|
388
|
+
frozen=True,
|
|
389
|
+
)
|
|
390
|
+
uri: constr(min_length=1) = Field(
|
|
391
|
+
..., description="URI of the source document the content was imported from"
|
|
392
|
+
)
|
|
393
|
+
digest: Sha3Digest | None = Field(
|
|
394
|
+
None, description="Digest of the archived source document"
|
|
395
|
+
)
|
|
396
|
+
terms: constr(min_length=1) | None = Field(
|
|
397
|
+
None,
|
|
398
|
+
description="URI of the source's reuse terms, where the source attaches any",
|
|
399
|
+
)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
type RumlTextName = Annotated[
|
|
403
|
+
constr(pattern=r"^(?:[A-Za-z_][A-Za-z0-9._-]*:)?[A-Za-z_][A-Za-z0-9._-]*$"),
|
|
404
|
+
Field(
|
|
405
|
+
...,
|
|
406
|
+
description="Element or attribute name as in the XML, optionally with a prefix declared by an xmlns:<prefix> attribute in scope",
|
|
407
|
+
),
|
|
408
|
+
]
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
type RumlTextAttrs = Annotated[
|
|
412
|
+
Mapping[RumlTextName, str],
|
|
413
|
+
Field(..., description="Attributes of an element, keyed by (prefixed) name"),
|
|
414
|
+
]
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
type RumlTextRootAttrs = Annotated[
|
|
418
|
+
Mapping[RumlTextName, str],
|
|
419
|
+
Field(
|
|
420
|
+
...,
|
|
421
|
+
description="Attributes of the root element; xmlns declares the dialect's namespace as the default namespace",
|
|
422
|
+
),
|
|
423
|
+
]
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
class Type3(StrEnum):
|
|
427
|
+
represents = "represents"
|
|
428
|
+
refers_to = "refers-to"
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
class TextAnchor(BaseModel):
|
|
432
|
+
model_config = ConfigDict(
|
|
433
|
+
extra="forbid",
|
|
434
|
+
populate_by_name=True,
|
|
435
|
+
frozen=True,
|
|
436
|
+
)
|
|
437
|
+
id: TextId = Field(..., description="Key of the text entry in this RUML's own data")
|
|
438
|
+
element: (
|
|
439
|
+
constr(
|
|
440
|
+
pattern=r"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
441
|
+
)
|
|
442
|
+
| None
|
|
443
|
+
) = Field(
|
|
444
|
+
None,
|
|
445
|
+
description="GUID of an element of the entry's RUML Text; omitted for the whole text",
|
|
446
|
+
)
|
|
447
|
+
type: Type3 = Field(
|
|
448
|
+
...,
|
|
449
|
+
description="represents: the norm the node implements (at most one per node); refers-to: a text the node refers to",
|
|
450
|
+
)
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
type ContextId = constr(pattern=r"^[a-z_][a-z0-9_]*$")
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
class Category(StrEnum):
|
|
457
|
+
courtDecision = "courtDecision"
|
|
458
|
+
commentary = "commentary"
|
|
459
|
+
administrativeGuidance = "administrativeGuidance"
|
|
460
|
+
explanatoryMemorandum = "explanatoryMemorandum"
|
|
461
|
+
example = "example"
|
|
462
|
+
literature = "literature"
|
|
463
|
+
faq = "faq"
|
|
464
|
+
history = "history"
|
|
465
|
+
rulemap = "rulemap"
|
|
466
|
+
custom = "custom"
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
class Type4(StrEnum):
|
|
470
|
+
embedded = "embedded"
|
|
471
|
+
container = "container"
|
|
472
|
+
url = "url"
|
|
473
|
+
external = "external"
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
class Context(BaseModel):
|
|
477
|
+
model_config = ConfigDict(
|
|
478
|
+
extra="forbid",
|
|
479
|
+
populate_by_name=True,
|
|
480
|
+
frozen=True,
|
|
481
|
+
)
|
|
482
|
+
title: str = Field(..., description="Title of the context entry")
|
|
483
|
+
category: Category = Field(..., description="Category of the context")
|
|
484
|
+
type: Type4 | None = Field(
|
|
485
|
+
Type4.embedded, description="How the context content is carried"
|
|
486
|
+
)
|
|
487
|
+
timestamp: Timestamp = Field(
|
|
488
|
+
..., description="Modification time of the context in ISO 8601 format"
|
|
489
|
+
)
|
|
490
|
+
subject: bool | None = Field(
|
|
491
|
+
False, description="Whether this context is the subject of the evaluation"
|
|
492
|
+
)
|
|
493
|
+
metadata: Mapping[str, Any] | None = Field(
|
|
494
|
+
None, description="Free-form metadata about the context"
|
|
495
|
+
)
|
|
496
|
+
content: Mapping[str, Any] | None = Field(
|
|
497
|
+
None, description="Embedded context content"
|
|
498
|
+
)
|
|
499
|
+
source: Mapping[str, Any] | None = Field(
|
|
500
|
+
None, description="Free-form description of the context source"
|
|
501
|
+
)
|
|
502
|
+
url: AnyUrl | None = Field(
|
|
503
|
+
None, description="URL of the context; required for type 'url'"
|
|
504
|
+
)
|
|
505
|
+
containerPath: constr(pattern=r"^\.context\/") | None = Field(
|
|
506
|
+
None,
|
|
507
|
+
description="Path to the context inside the RUML container; required for type 'container'",
|
|
508
|
+
)
|
|
509
|
+
ref: str | None = Field(
|
|
510
|
+
None, description="Symbolic reference; required for type 'external'"
|
|
511
|
+
)
|
|
512
|
+
hash: constr(pattern=r"^(?:sha3-256|sha256|blake3):[0-9a-f]{64}$") | None = Field(
|
|
513
|
+
None, description="Integrity hash, format <algorithm>:<value>"
|
|
514
|
+
)
|
|
515
|
+
accessDate: date_aliased | None = Field(
|
|
516
|
+
None, description="Date the context url was last accessed"
|
|
517
|
+
)
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
class CapabilityQuery(BaseModel):
|
|
521
|
+
model_config = ConfigDict(
|
|
522
|
+
extra="forbid",
|
|
523
|
+
populate_by_name=True,
|
|
524
|
+
frozen=True,
|
|
525
|
+
)
|
|
526
|
+
expression: constr(min_length=1) = Field(
|
|
527
|
+
..., description="JSONata expression computing the node's truth value"
|
|
528
|
+
)
|
|
529
|
+
description: str | None = Field(
|
|
530
|
+
None, description="Optional explanation of what the expression evaluates"
|
|
531
|
+
)
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
class CapabilityExpression(BaseModel):
|
|
535
|
+
model_config = ConfigDict(
|
|
536
|
+
extra="forbid",
|
|
537
|
+
populate_by_name=True,
|
|
538
|
+
frozen=True,
|
|
539
|
+
)
|
|
540
|
+
expression: constr(min_length=1) = Field(
|
|
541
|
+
...,
|
|
542
|
+
description="JSONata expression computing the node's status from `$children` and the datapoints",
|
|
543
|
+
)
|
|
544
|
+
description: constr(min_length=1) = Field(
|
|
545
|
+
...,
|
|
546
|
+
description="Human-readable statement of the rule the expression encodes; required, because the operator alone no longer says what the node does",
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
class Action(BaseModel):
|
|
551
|
+
model_config = ConfigDict(
|
|
552
|
+
extra="forbid",
|
|
553
|
+
populate_by_name=True,
|
|
554
|
+
frozen=True,
|
|
555
|
+
)
|
|
556
|
+
operation: str = Field(
|
|
557
|
+
..., description="The operation to perform (open vocabulary)"
|
|
558
|
+
)
|
|
559
|
+
ref: str = Field(
|
|
560
|
+
..., description="Symbolic reference to the operation implementation"
|
|
561
|
+
)
|
|
562
|
+
config: Mapping[str, Any] | None = Field(
|
|
563
|
+
None, description="Optional, runtime-defined configuration for the action"
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
class ContextRefs(BaseModel):
|
|
568
|
+
model_config = ConfigDict(
|
|
569
|
+
extra="forbid",
|
|
570
|
+
populate_by_name=True,
|
|
571
|
+
frozen=True,
|
|
572
|
+
)
|
|
573
|
+
refs: Sequence[ContextId] = Field(
|
|
574
|
+
...,
|
|
575
|
+
description="Ids of root-level context entries referenced by the node",
|
|
576
|
+
min_length=1,
|
|
577
|
+
)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
class Role(StrEnum):
|
|
581
|
+
reference = "reference"
|
|
582
|
+
subject = "subject"
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
class Context1(BaseModel):
|
|
586
|
+
model_config = ConfigDict(
|
|
587
|
+
extra="forbid",
|
|
588
|
+
populate_by_name=True,
|
|
589
|
+
frozen=True,
|
|
590
|
+
)
|
|
591
|
+
id: constr(min_length=1) = Field(
|
|
592
|
+
..., description="Id of the referenced context entry"
|
|
593
|
+
)
|
|
594
|
+
role: Role | None = Field(
|
|
595
|
+
Role.reference,
|
|
596
|
+
description="Role the context plays in the query (reference or subject)",
|
|
597
|
+
)
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
class Inputs(BaseModel):
|
|
601
|
+
model_config = ConfigDict(
|
|
602
|
+
extra="forbid",
|
|
603
|
+
populate_by_name=True,
|
|
604
|
+
frozen=True,
|
|
605
|
+
)
|
|
606
|
+
context: Sequence[constr(min_length=1) | Context1] | None = Field(
|
|
607
|
+
None, description="Context entries supplied as input to the query"
|
|
608
|
+
)
|
|
609
|
+
dataPoints: Sequence[str] | None = Field(
|
|
610
|
+
None, description="Ids of datapoints supplied as input to the query"
|
|
611
|
+
)
|
|
612
|
+
texts: Sequence[str] | None = Field(
|
|
613
|
+
None, description="Ids of texts supplied as input to the query"
|
|
614
|
+
)
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
class Effort(StrEnum):
|
|
618
|
+
low = "low"
|
|
619
|
+
medium = "medium"
|
|
620
|
+
high = "high"
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
class Config(BaseModel):
|
|
624
|
+
model_config = ConfigDict(
|
|
625
|
+
extra="forbid",
|
|
626
|
+
populate_by_name=True,
|
|
627
|
+
frozen=True,
|
|
628
|
+
)
|
|
629
|
+
deterministic: bool | None = Field(
|
|
630
|
+
None, description="Whether the query should be evaluated deterministically"
|
|
631
|
+
)
|
|
632
|
+
effort: Effort | None = Field(
|
|
633
|
+
Effort.medium,
|
|
634
|
+
description="Effort the model should spend on the query (low, medium, high)",
|
|
635
|
+
)
|
|
636
|
+
temperature: confloat(ge=0.0, le=1.0) | None = Field(
|
|
637
|
+
None, description="Sampling temperature for the query, between 0 and 1"
|
|
638
|
+
)
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
class CapabilityAiQueryNode(BaseModel):
|
|
642
|
+
model_config = ConfigDict(
|
|
643
|
+
extra="forbid",
|
|
644
|
+
populate_by_name=True,
|
|
645
|
+
frozen=True,
|
|
646
|
+
)
|
|
647
|
+
model: constr(min_length=1) = Field(
|
|
648
|
+
...,
|
|
649
|
+
description="Symbolic reference to the AI model, resolved by the tool at runtime",
|
|
650
|
+
)
|
|
651
|
+
prompt: str | None = Field(None, description="Prompt evaluated for this node")
|
|
652
|
+
description: str | None = Field(
|
|
653
|
+
None, description="Description of what the query determines"
|
|
654
|
+
)
|
|
655
|
+
inputs: Inputs | None = Field(
|
|
656
|
+
None, description="Inputs (context, datapoints, texts) supplied to the query"
|
|
657
|
+
)
|
|
658
|
+
config: Config | None = Field(
|
|
659
|
+
None, description="Node-level configuration for the query"
|
|
660
|
+
)
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
class TextRefs(BaseModel):
|
|
664
|
+
model_config = ConfigDict(
|
|
665
|
+
extra="forbid",
|
|
666
|
+
populate_by_name=True,
|
|
667
|
+
frozen=True,
|
|
668
|
+
)
|
|
669
|
+
refs: Sequence[TextAnchor] = Field(
|
|
670
|
+
...,
|
|
671
|
+
description="Anchors into this RUML's own texts; at most one of type represents",
|
|
672
|
+
min_length=1,
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
type NodeAnchor = Annotated[
|
|
677
|
+
constr(
|
|
678
|
+
pattern=r"^[A-Za-z][A-Za-z0-9+.-]*:[^#\s]+#node/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
679
|
+
),
|
|
680
|
+
Field(
|
|
681
|
+
...,
|
|
682
|
+
description="Absolute anchor to a node of one version of another RUML file (§4.15): `<ruml-version-uri>#node/<id>`. Same-document anchors (`#node/…`) are not node anchors.",
|
|
683
|
+
),
|
|
684
|
+
]
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
class NodeRef(BaseModel):
|
|
688
|
+
model_config = ConfigDict(
|
|
689
|
+
extra="forbid",
|
|
690
|
+
populate_by_name=True,
|
|
691
|
+
frozen=True,
|
|
692
|
+
)
|
|
693
|
+
uri: NodeAnchor
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
class TreeRefs(BaseModel):
|
|
697
|
+
model_config = ConfigDict(
|
|
698
|
+
extra="forbid",
|
|
699
|
+
populate_by_name=True,
|
|
700
|
+
frozen=True,
|
|
701
|
+
)
|
|
702
|
+
represents: NodeRef | None = Field(
|
|
703
|
+
None, description="The node of another RUML file this node stands for."
|
|
704
|
+
)
|
|
705
|
+
refersTo: Sequence[NodeRef] | None = Field(
|
|
706
|
+
None, description="Nodes of other RUML files this node refers to.", min_length=1
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
class TreeInclude(BaseModel):
|
|
711
|
+
model_config = ConfigDict(
|
|
712
|
+
extra="forbid",
|
|
713
|
+
populate_by_name=True,
|
|
714
|
+
frozen=True,
|
|
715
|
+
)
|
|
716
|
+
uri: NodeAnchor
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
type SetId = constr(pattern=r"^[a-z_][a-z0-9_]*$")
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
class ContextPayload(BaseModel):
|
|
723
|
+
model_config = ConfigDict(
|
|
724
|
+
extra="forbid",
|
|
725
|
+
populate_by_name=True,
|
|
726
|
+
frozen=True,
|
|
727
|
+
)
|
|
728
|
+
data: Mapping[ContextId, Context] | None = Field(
|
|
729
|
+
None, description="Context entries, keyed by context id (ctx_…)"
|
|
730
|
+
)
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
class Config1(BaseModel):
|
|
734
|
+
model_config = ConfigDict(
|
|
735
|
+
extra="forbid",
|
|
736
|
+
populate_by_name=True,
|
|
737
|
+
frozen=True,
|
|
738
|
+
)
|
|
739
|
+
systemPrompt: constr(min_length=1) | None = Field(
|
|
740
|
+
None, description="System prompt applied to all AI queries in the document"
|
|
741
|
+
)
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
class AiQueryPayload(BaseModel):
|
|
745
|
+
model_config = ConfigDict(
|
|
746
|
+
extra="forbid",
|
|
747
|
+
populate_by_name=True,
|
|
748
|
+
frozen=True,
|
|
749
|
+
)
|
|
750
|
+
config: Config1 | None = Field(
|
|
751
|
+
None, description="Root-level configuration for the AI query capability"
|
|
752
|
+
)
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
class Level(StrEnum):
|
|
756
|
+
standard = "standard"
|
|
757
|
+
verbose = "verbose"
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
class Config2(BaseModel):
|
|
761
|
+
model_config = ConfigDict(
|
|
762
|
+
extra="forbid",
|
|
763
|
+
populate_by_name=True,
|
|
764
|
+
frozen=True,
|
|
765
|
+
)
|
|
766
|
+
level: Level | None = Field(
|
|
767
|
+
Level.standard, description="Verbosity of the recorded protocol"
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
class ProtocolPayload(BaseModel):
|
|
772
|
+
model_config = ConfigDict(
|
|
773
|
+
extra="forbid",
|
|
774
|
+
populate_by_name=True,
|
|
775
|
+
frozen=True,
|
|
776
|
+
)
|
|
777
|
+
config: Config2 | None = None
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
class PlainPayload(BaseModel):
|
|
781
|
+
model_config = ConfigDict(
|
|
782
|
+
extra="forbid",
|
|
783
|
+
populate_by_name=True,
|
|
784
|
+
frozen=True,
|
|
785
|
+
)
|
|
786
|
+
config: Mapping[str, Any] | None = Field(
|
|
787
|
+
None, description="Capability-specific configuration"
|
|
788
|
+
)
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
class Role1(StrEnum):
|
|
792
|
+
data = "data"
|
|
793
|
+
decision = "decision"
|
|
794
|
+
combiner = "combiner"
|
|
795
|
+
reaction = "reaction"
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
class UniqueNodeDataCapabilityIds(BaseModel):
|
|
799
|
+
model_config = ConfigDict(
|
|
800
|
+
populate_by_name=True,
|
|
801
|
+
frozen=True,
|
|
802
|
+
)
|
|
803
|
+
|
|
804
|
+
|
|
805
|
+
type CapabilityId = OfficialCapabilityId | DraftCapabilityId | ReverseDomainCapabilityId
|
|
806
|
+
|
|
807
|
+
|
|
808
|
+
class Datapoint(BaseModel):
|
|
809
|
+
model_config = ConfigDict(
|
|
810
|
+
extra="forbid",
|
|
811
|
+
populate_by_name=True,
|
|
812
|
+
frozen=True,
|
|
813
|
+
)
|
|
814
|
+
name: str = Field(..., description="Human-readable name of the datapoint")
|
|
815
|
+
type: Type = Field(..., description="Data type of the datapoint")
|
|
816
|
+
description: str | None = Field(
|
|
817
|
+
None, description="Description of what the datapoint represents"
|
|
818
|
+
)
|
|
819
|
+
unit: str | None = Field(
|
|
820
|
+
None,
|
|
821
|
+
description="Unit of the value; required for type 'currency', otherwise only applicable to types 'number' and 'percentage'",
|
|
822
|
+
)
|
|
823
|
+
sensitive: bool | None = Field(
|
|
824
|
+
False, description="Whether the datapoint holds sensitive/personal data"
|
|
825
|
+
)
|
|
826
|
+
format: str | None = Field(
|
|
827
|
+
None, description="Format refining the type (e.g. taxId for identifier)"
|
|
828
|
+
)
|
|
829
|
+
options: Sequence[Option] | None = Field(
|
|
830
|
+
None, description="Allowed options; required and non-empty for type 'enum'"
|
|
831
|
+
)
|
|
832
|
+
binding: Binding = Field(
|
|
833
|
+
...,
|
|
834
|
+
description="How the datapoint value is sourced (input, external or computed). `type` selects the kind; each kind's own properties are listed under `allOf`, as capability entries do (§4.2).",
|
|
835
|
+
)
|
|
836
|
+
validation: Validation | None = Field(
|
|
837
|
+
None, description="Validation rules applied to the datapoint value"
|
|
838
|
+
)
|
|
839
|
+
set: SetId | None = Field(
|
|
840
|
+
None,
|
|
841
|
+
description="The set this datapoint instantiates; required when type is object, not applicable to other types",
|
|
842
|
+
)
|
|
843
|
+
cardinality: Cardinality | None = Field(
|
|
844
|
+
None,
|
|
845
|
+
description="Repetition of the object; absent means a single object. Only applicable to type 'object'",
|
|
846
|
+
)
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
class Actions1(BaseModel):
|
|
850
|
+
model_config = ConfigDict(
|
|
851
|
+
extra="forbid",
|
|
852
|
+
populate_by_name=True,
|
|
853
|
+
frozen=True,
|
|
854
|
+
)
|
|
855
|
+
description: str | None = Field(
|
|
856
|
+
None, description="Description of the actions declared for the node"
|
|
857
|
+
)
|
|
858
|
+
onTrue: Action = Field(
|
|
859
|
+
..., description="Action to run when the node evaluates to true"
|
|
860
|
+
)
|
|
861
|
+
onFalse: Action | None = Field(
|
|
862
|
+
None, description="Action to run when the node evaluates to false"
|
|
863
|
+
)
|
|
864
|
+
onUndefined: Action | None = Field(
|
|
865
|
+
None, description="Action to run when the node evaluates to undefined"
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
class Actions2(BaseModel):
|
|
870
|
+
model_config = ConfigDict(
|
|
871
|
+
extra="forbid",
|
|
872
|
+
populate_by_name=True,
|
|
873
|
+
frozen=True,
|
|
874
|
+
)
|
|
875
|
+
description: str | None = Field(
|
|
876
|
+
None, description="Description of the actions declared for the node"
|
|
877
|
+
)
|
|
878
|
+
onTrue: Action | None = Field(
|
|
879
|
+
None, description="Action to run when the node evaluates to true"
|
|
880
|
+
)
|
|
881
|
+
onFalse: Action = Field(
|
|
882
|
+
..., description="Action to run when the node evaluates to false"
|
|
883
|
+
)
|
|
884
|
+
onUndefined: Action | None = Field(
|
|
885
|
+
None, description="Action to run when the node evaluates to undefined"
|
|
886
|
+
)
|
|
887
|
+
|
|
888
|
+
|
|
889
|
+
class Actions3(BaseModel):
|
|
890
|
+
model_config = ConfigDict(
|
|
891
|
+
extra="forbid",
|
|
892
|
+
populate_by_name=True,
|
|
893
|
+
frozen=True,
|
|
894
|
+
)
|
|
895
|
+
description: str | None = Field(
|
|
896
|
+
None, description="Description of the actions declared for the node"
|
|
897
|
+
)
|
|
898
|
+
onTrue: Action | None = Field(
|
|
899
|
+
None, description="Action to run when the node evaluates to true"
|
|
900
|
+
)
|
|
901
|
+
onFalse: Action | None = Field(
|
|
902
|
+
None, description="Action to run when the node evaluates to false"
|
|
903
|
+
)
|
|
904
|
+
onUndefined: Action = Field(
|
|
905
|
+
..., description="Action to run when the node evaluates to undefined"
|
|
906
|
+
)
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
type Actions = Actions1 | Actions2 | Actions3
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
class DatapointSet(BaseModel):
|
|
913
|
+
model_config = ConfigDict(
|
|
914
|
+
extra="forbid",
|
|
915
|
+
populate_by_name=True,
|
|
916
|
+
frozen=True,
|
|
917
|
+
)
|
|
918
|
+
name: constr(min_length=1) = Field(..., description="Display name of the set")
|
|
919
|
+
description: str | None = Field(None, description="What the set represents")
|
|
920
|
+
fields: Mapping[DatapointId, Datapoint] = Field(
|
|
921
|
+
...,
|
|
922
|
+
description="Member datapoints, keyed by datapoint id; a field may itself be type: object (nesting)",
|
|
923
|
+
min_length=1,
|
|
924
|
+
)
|
|
925
|
+
|
|
926
|
+
|
|
927
|
+
class DatapointsPayload(BaseModel):
|
|
928
|
+
model_config = ConfigDict(
|
|
929
|
+
extra="forbid",
|
|
930
|
+
populate_by_name=True,
|
|
931
|
+
frozen=True,
|
|
932
|
+
)
|
|
933
|
+
data: Mapping[DatapointId, Datapoint] | None = Field(
|
|
934
|
+
None, description="Datapoint definitions, keyed by datapoint id"
|
|
935
|
+
)
|
|
936
|
+
sets: Mapping[SetId, DatapointSet] | None = Field(
|
|
937
|
+
None, description="Reusable structured types, keyed by set id"
|
|
938
|
+
)
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
class CapabilityEntry(BaseModel):
|
|
942
|
+
model_config = ConfigDict(
|
|
943
|
+
extra="forbid",
|
|
944
|
+
populate_by_name=True,
|
|
945
|
+
frozen=True,
|
|
946
|
+
)
|
|
947
|
+
id: CapabilityId = Field(..., description="The capability this entry configures")
|
|
948
|
+
payload: Mapping[str, Any] | None = Field(
|
|
949
|
+
None,
|
|
950
|
+
description="Capability-defined content; everything here belongs to the capability",
|
|
951
|
+
)
|
|
952
|
+
required: bool | None = Field(
|
|
953
|
+
False,
|
|
954
|
+
description="Whether the capability must be resolved to evaluate the file",
|
|
955
|
+
)
|
|
956
|
+
role: Role1 | None = Field(
|
|
957
|
+
None,
|
|
958
|
+
description="The role the rulemap expects a non-official capability to play (§4.1). Official `ruml:` ids have a fixed role and MUST NOT declare one; every other id MUST declare it. A parser that implements the capability MUST reject a role that differs from its implementation. `decision` decides a leaf, `combiner` decides a node from its children.",
|
|
959
|
+
)
|
|
960
|
+
|
|
961
|
+
|
|
962
|
+
class NodeCapabilityEntry(BaseModel):
|
|
963
|
+
model_config = ConfigDict(
|
|
964
|
+
extra="forbid",
|
|
965
|
+
populate_by_name=True,
|
|
966
|
+
frozen=True,
|
|
967
|
+
)
|
|
968
|
+
id: CapabilityId = Field(..., description="The capability this entry configures")
|
|
969
|
+
payload: Mapping[str, Any] = Field(
|
|
970
|
+
...,
|
|
971
|
+
description="Capability-defined content; everything here belongs to the capability",
|
|
972
|
+
)
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
type Capabilities = Annotated[
|
|
976
|
+
Sequence[CapabilityEntry],
|
|
977
|
+
Field(
|
|
978
|
+
...,
|
|
979
|
+
description="Declared capabilities, in order (§4.2); the order is significant",
|
|
980
|
+
),
|
|
981
|
+
]
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
type NodeCapabilities = Annotated[
|
|
985
|
+
Sequence[NodeCapabilityEntry],
|
|
986
|
+
Field(
|
|
987
|
+
...,
|
|
988
|
+
description="Node-level capabilities, in order (§4.3); the order is significant",
|
|
989
|
+
),
|
|
990
|
+
]
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
class Node(BaseModel):
|
|
994
|
+
model_config = ConfigDict(
|
|
995
|
+
extra="forbid",
|
|
996
|
+
populate_by_name=True,
|
|
997
|
+
frozen=True,
|
|
998
|
+
)
|
|
999
|
+
id: Uuid = Field(..., description="Unique identifier of the node")
|
|
1000
|
+
operator: Operator | None = Field(
|
|
1001
|
+
None, description="Logical operator combining the outcomes of the child nodes"
|
|
1002
|
+
)
|
|
1003
|
+
label: constr(min_length=1) = Field(
|
|
1004
|
+
..., description="Human-readable label for the node"
|
|
1005
|
+
)
|
|
1006
|
+
altText: str | None = Field(
|
|
1007
|
+
None, description="Alternative short-form label or text for the node"
|
|
1008
|
+
)
|
|
1009
|
+
description: constr(max_length=10000) | None = Field(
|
|
1010
|
+
None, description="Longer explanation of what the node represents"
|
|
1011
|
+
)
|
|
1012
|
+
children: Sequence[LexId] | None = Field(
|
|
1013
|
+
None, description="Ordered lexIds of the child nodes", min_length=1
|
|
1014
|
+
)
|
|
1015
|
+
capabilities: NodeCapabilities | None = Field(
|
|
1016
|
+
None, description="Node-level capability values, keyed by capability id"
|
|
1017
|
+
)
|
|
1018
|
+
metadata: Mapping[str, Any] | None = Field(
|
|
1019
|
+
None, description="Free-form, implementation-defined node metadata"
|
|
1020
|
+
)
|
|
1021
|
+
decisionMode: DecisionMode | None = Field(
|
|
1022
|
+
DecisionMode.fallback,
|
|
1023
|
+
description="Combination mode for a leaf node with multiple decision capabilities",
|
|
1024
|
+
)
|
|
1025
|
+
modular: bool | None = Field(
|
|
1026
|
+
None, description="Whether the node is a reusable, self-contained module"
|
|
1027
|
+
)
|
|
1028
|
+
|
|
1029
|
+
|
|
1030
|
+
class Rulemap(BaseModel):
|
|
1031
|
+
model_config = ConfigDict(
|
|
1032
|
+
extra="forbid",
|
|
1033
|
+
populate_by_name=True,
|
|
1034
|
+
frozen=True,
|
|
1035
|
+
)
|
|
1036
|
+
nodes: Mapping[LexId, Node] = Field(
|
|
1037
|
+
...,
|
|
1038
|
+
description='The rulemap nodes, keyed by lexId. §3.4 — MUST contain an entry with key "1" (the root node, LexID 1).',
|
|
1039
|
+
)
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
class RumlRulemappingLogicFormat(BaseModel):
|
|
1043
|
+
model_config = ConfigDict(
|
|
1044
|
+
extra="forbid",
|
|
1045
|
+
populate_by_name=True,
|
|
1046
|
+
frozen=True,
|
|
1047
|
+
)
|
|
1048
|
+
field_format: Literal["RUML"] = Field(
|
|
1049
|
+
...,
|
|
1050
|
+
alias="$format",
|
|
1051
|
+
description="Format discriminator identifying this as a RUML file",
|
|
1052
|
+
)
|
|
1053
|
+
field_specVersion: FieldSpecVersion = Field(
|
|
1054
|
+
..., alias="$specVersion", description="RUML spec version this file conforms to"
|
|
1055
|
+
)
|
|
1056
|
+
metadata: Metadata = Field(..., description="Metadata about the RUML file itself")
|
|
1057
|
+
capabilities: Capabilities | None = Field(
|
|
1058
|
+
None, description="Root-level capability declarations, keyed by capability id"
|
|
1059
|
+
)
|
|
1060
|
+
rulemap: Rulemap = Field(..., description="The decision logic tree")
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
class Text(BaseModel):
|
|
1064
|
+
model_config = ConfigDict(
|
|
1065
|
+
extra="forbid",
|
|
1066
|
+
populate_by_name=True,
|
|
1067
|
+
frozen=True,
|
|
1068
|
+
)
|
|
1069
|
+
title: constr(min_length=1) = Field(
|
|
1070
|
+
..., description="Human-readable title of the text"
|
|
1071
|
+
)
|
|
1072
|
+
uri: constr(min_length=1) | None = Field(
|
|
1073
|
+
None,
|
|
1074
|
+
description="URI of the text as published by its source (see the URI convention in §4.12); omitted for texts written in the RUML file itself",
|
|
1075
|
+
)
|
|
1076
|
+
timestamp: Timestamp = Field(
|
|
1077
|
+
..., description="When the author retrieved and recorded this text"
|
|
1078
|
+
)
|
|
1079
|
+
status: Status | None = Field(None, description="Legislative status of the text")
|
|
1080
|
+
type: Type2 | None = Field(
|
|
1081
|
+
Type2.embedded,
|
|
1082
|
+
description="How the text content is carried; 'external' is deprecated",
|
|
1083
|
+
)
|
|
1084
|
+
text: str | None = Field(
|
|
1085
|
+
None,
|
|
1086
|
+
description="Plain text; for embedded texts with status 'inForce', exactly one of text and content is required",
|
|
1087
|
+
)
|
|
1088
|
+
content: RumlTextDocument | None = Field(
|
|
1089
|
+
None, description="Structured text in RUML Text form (§4.12)"
|
|
1090
|
+
)
|
|
1091
|
+
digest: Sha3Digest | None = Field(
|
|
1092
|
+
None,
|
|
1093
|
+
description="SHA3-256 over the RFC 8785 form of content; required with content",
|
|
1094
|
+
)
|
|
1095
|
+
source: TextSource | None = Field(
|
|
1096
|
+
None,
|
|
1097
|
+
description="Provenance of content: the source document it was imported from",
|
|
1098
|
+
)
|
|
1099
|
+
url: AnyUrl | None = Field(
|
|
1100
|
+
None, description="URL of the text; required for type 'url'"
|
|
1101
|
+
)
|
|
1102
|
+
containerPath: constr(pattern=r"^\.texts\/") | None = Field(
|
|
1103
|
+
None,
|
|
1104
|
+
description="Path to the text inside the RUML container; required for type 'container'",
|
|
1105
|
+
)
|
|
1106
|
+
ref: str | None = Field(
|
|
1107
|
+
None, description="Symbolic reference; required for type 'external'"
|
|
1108
|
+
)
|
|
1109
|
+
version: str | None = Field(None, description="Version of the text")
|
|
1110
|
+
validFrom: Timestamp | None = Field(None, description="Validity start date")
|
|
1111
|
+
validUntil: Timestamp | None = Field(None, description="Validity end date")
|
|
1112
|
+
language: constr(pattern=r"^[a-z]{2}$") | None = Field(
|
|
1113
|
+
None, description="ISO 639-1 language code"
|
|
1114
|
+
)
|
|
1115
|
+
isReferenced: bool | None = Field(
|
|
1116
|
+
True, description="Whether the text is referenced by at least one node"
|
|
1117
|
+
)
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
type RumlTextContent = str | RumlTextNode
|
|
1121
|
+
|
|
1122
|
+
|
|
1123
|
+
class RumlTextNode(BaseModel):
|
|
1124
|
+
model_config = ConfigDict(
|
|
1125
|
+
extra="forbid",
|
|
1126
|
+
populate_by_name=True,
|
|
1127
|
+
frozen=True,
|
|
1128
|
+
)
|
|
1129
|
+
type: RumlTextName
|
|
1130
|
+
attrs: RumlTextAttrs | None = None
|
|
1131
|
+
content: Sequence[RumlTextContent] | None = None
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
class RumlTextDocument(BaseModel):
|
|
1135
|
+
model_config = ConfigDict(
|
|
1136
|
+
extra="forbid",
|
|
1137
|
+
populate_by_name=True,
|
|
1138
|
+
frozen=True,
|
|
1139
|
+
)
|
|
1140
|
+
type: RumlTextName
|
|
1141
|
+
attrs: RumlTextRootAttrs
|
|
1142
|
+
content: Sequence[RumlTextContent]
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
class TextReferencePayload(BaseModel):
|
|
1146
|
+
model_config = ConfigDict(
|
|
1147
|
+
extra="forbid",
|
|
1148
|
+
populate_by_name=True,
|
|
1149
|
+
frozen=True,
|
|
1150
|
+
)
|
|
1151
|
+
data: Mapping[TextId, Text] | None = Field(
|
|
1152
|
+
None, description="Text definitions, keyed by text id (text_…)"
|
|
1153
|
+
)
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
Text.model_rebuild()
|