Validation Scheme¶
A Validation Scheme holds a set of Validation Rules which are applied to the data of one Dataflow or Provision
Agreement. Each rule is either an arithmetic expression over series (for example "Europe equals the sum of its
parts"), or a reference to a Hierarchy that describes the expected aggregation of a Dimension. Documents start
ref: "ValidationScheme=AGENCY:ID(1.0)".
Validation Schemes are not VTL schemes: there is no vtlVersion field.
Simple form¶
The smallest complete Validation Scheme has its attachment (the Dataflow or Provision Agreement it validates) and one
rule. A rule is never written in the ID: "name" short form, every rule is written as an object.
format: "fusion-yaml(1.0.0)"
ref: "ValidationScheme=ACY:VS_GDP(1.0.0)"
name: "TEST"
dataflow: "ACY:DF_GDP(1.0.0)"
items:
- RULE_1:
name: "Europe Equals Sum of Parts"
expression: "[::FR]+[::DE]+[::UK]+[::ES]"
eq: "="
type: "SERIES"
result: "[::EUR]"
output: "::EUR"
series:
- "::FR"
- "::DE"
- "::UK"
- "::ES"
The document starts with the common header. The body fields are:
dataflow– the attachment, a reference keyed by the lower case class of the referenced structure with a short URN value. Required. A scheme attached to a Provision Agreement writesprovisionagreement: "…"instead.items– the Validation Rules, in scheme order, each keyed by its id (see items).name– the localised name of the rule.expression– the left hand side of the rule. Each series is a key in square brackets, with:between dimension values and an empty value as a wildcard.eq– the equality operator, one of=,<>,>,>=,<,<=.type– the type of the result,SERIESorNUMBER. Derived fromresult.result– the right hand side of the rule, either a series in square brackets or a number. Always a quoted string, even when it is a number.output– the result series key without its brackets. Derived fromresult.series– the series keys used in the expression, without their brackets, in the order they appear. Derived fromexpression. A value or array: one key is written as a string.
Complex form¶
Numeric result¶
When result is a number, type is NUMBER and there is no output series, so output is not written.
- RULE_2:
name: "France at least Germany"
expression: "[::FR]-[::DE]"
eq: ">="
type: "NUMBER"
result: "0"
series:
- "::FR"
- "::DE"
Hierarchy rule¶
A rule that references a Hierarchy has no expression. Instead it is written with two references: the Dimension the Hierarchy applies to, followed by the Hierarchy. Both are references keyed by the lower case class of the referenced structure.
- RULE_3:
name: "Regions add up"
dimension: "ACY:DSD_GDP(1.0.0).REF_AREA"
hierarchy: "ACY:H_REF_AREA(1.0.0)"
A rule may also carry a description, a URI, annotations and links, written in the positions given in the field reference below.
Field reference¶
Scheme fields, written after the common header:
| Field | Value | Written when |
|---|---|---|
partial |
true |
The scheme is a partial item scheme |
dataflow / provisionagreement |
Short URN of the attachment | Always (required) |
items |
Array of Validation Rules | The scheme has at least one rule |
Validation Rule fields (items[].<ID>):
| Field | Value | Written when |
|---|---|---|
name, name-<lang> |
String | Always (en as name, other locales as name-<lang>) |
description, description-<lang> |
String | The rule has a description |
uri |
String | The rule has a URI |
expression |
String | Expression rule |
eq |
=, <>, >, >=, <, <= |
Expression rule |
type |
SERIES or NUMBER |
Expression rule without a Hierarchy (derived) |
result |
String | Expression rule |
output |
String, series key | Expression rule with a series result (derived) |
series |
Series key(s), value or array | Expression rule without a Hierarchy whose expression contains series (derived) |
dimension |
Short URN of a Dimension | Hierarchy rule |
hierarchy |
Short URN of a Hierarchy | Hierarchy rule |
annotations |
Array, see annotations | The rule has annotations |
links |
Array, see links | The rule has links |
Validation Rules never use the - ID: "name" simple item form, as the Validation Rule bean
reports itself as never simple.
Reading notes¶
type,outputandseriesare written so the document is self-describing, but they are derived fromexpressionandresultwhen the rule is built, so the reader skips them.eqmust be one of the six operators listed above; any other value is an error.- The scheme's attachment is read from whichever reference field appears among the scheme fields. Inside a rule, a
dimensionreference is read as the Dimension of the rule's Hierarchy, and any other reference field as the Hierarchy itself.