Check hierarchy · check_hierarchy
---
config:
flowchart:
useMaxWidth: false
---
flowchart LR
classDef ok fill:#d4edda,stroke:#28a745,color:#000
classDef partial fill:#fff3cd,stroke:#ffc107,color:#000
classDef refused fill:#d4edda,stroke:#28a745,stroke-width:3px,stroke-dasharray: 2 2,color:#000
classDef missing fill:#f8d7da,stroke:#dc3545,color:#000
classDef diverge fill:#cce5ff,stroke:#007bff,color:#000
classDef block fill:#2b3a4a,stroke:#2b3a4a,color:#fff,font-weight:bold
classDef ext fill:#fff,stroke:#666,color:#000,stroke-dasharray: 5 5
O["Check hierarchy · check_hierarchy<br/>🟢40"]:::ok
v_non_null_dataset_invalid["check_hierarchy(DS, HR non_null dataset invalid)"]:::ok
v_non_null_dataset_all["check_hierarchy(DS, HR non_null dataset all)"]:::ok
v_non_null_dataset_all_measures["check_hierarchy(DS, HR non_null dataset all_measures)"]:::ok
v_non_null_dataset_priority_invalid["check_hierarchy(DS, HR non_null dataset_priority invalid)"]:::ok
v_non_null_dataset_priority_all["check_hierarchy(DS, HR non_null dataset_priority all)"]:::ok
v_non_null_dataset_priority_all_measures["check_hierarchy(DS, HR non_null dataset_priority all_measures)"]:::ok
v_non_zero_dataset_invalid["check_hierarchy(DS, HR non_zero dataset invalid)"]:::ok
v_non_zero_dataset_all["check_hierarchy(DS, HR non_zero dataset all)"]:::ok
v_non_zero_dataset_all_measures["check_hierarchy(DS, HR non_zero dataset all_measures)"]:::ok
v_non_zero_dataset_priority_invalid["check_hierarchy(DS, HR non_zero dataset_priority invalid)"]:::ok
v_non_zero_dataset_priority_all["check_hierarchy(DS, HR non_zero dataset_priority all)"]:::ok
v_non_zero_dataset_priority_all_measures["check_hierarchy(DS, HR non_zero dataset_priority all_measures)"]:::ok
v_partial_null_dataset_invalid["check_hierarchy(DS, HR partial_null dataset invalid)"]:::ok
v_partial_null_dataset_all["check_hierarchy(DS, HR partial_null dataset all)"]:::ok
v_partial_null_dataset_all_measures["check_hierarchy(DS, HR partial_null dataset all_measures)"]:::ok
v_partial_null_dataset_priority_invalid["check_hierarchy(DS, HR partial_null dataset_priority invalid)"]:::ok
v_partial_null_dataset_priority_all["check_hierarchy(DS, HR partial_null dataset_priority all)"]:::ok
v_partial_null_dataset_priority_all_measures["check_hierarchy(DS, HR partial_null dataset_priority all_measures)"]:::ok
v_partial_zero_dataset_invalid["check_hierarchy(DS, HR partial_zero dataset invalid)"]:::ok
v_partial_zero_dataset_all["check_hierarchy(DS, HR partial_zero dataset all)"]:::ok
v_partial_zero_dataset_all_measures["check_hierarchy(DS, HR partial_zero dataset all_measures)"]:::ok
v_partial_zero_dataset_priority_invalid["check_hierarchy(DS, HR partial_zero dataset_priority invalid)"]:::ok
v_partial_zero_dataset_priority_all["check_hierarchy(DS, HR partial_zero dataset_priority all)"]:::ok
v_partial_zero_dataset_priority_all_measures["check_hierarchy(DS, HR partial_zero dataset_priority all_measures)"]:::ok
v_always_null_dataset_invalid["check_hierarchy(DS, HR always_null dataset invalid)"]:::ok
v_always_null_dataset_all["check_hierarchy(DS, HR always_null dataset all)"]:::ok
v_always_null_dataset_all_measures["check_hierarchy(DS, HR always_null dataset all_measures)"]:::ok
v_always_null_dataset_priority_invalid["check_hierarchy(DS, HR always_null dataset_priority invalid)"]:::ok
v_always_null_dataset_priority_all["check_hierarchy(DS, HR always_null dataset_priority all)"]:::ok
v_always_null_dataset_priority_all_measures["check_hierarchy(DS, HR always_null dataset_priority all_measures)"]:::ok
v_always_zero_dataset_invalid["check_hierarchy(DS, HR always_zero dataset invalid)"]:::ok
v_always_zero_dataset_all["check_hierarchy(DS, HR always_zero dataset all)"]:::ok
v_always_zero_dataset_all_measures["check_hierarchy(DS, HR always_zero dataset all_measures)"]:::ok
v_always_zero_dataset_priority_invalid["check_hierarchy(DS, HR always_zero dataset_priority invalid)"]:::ok
v_always_zero_dataset_priority_all["check_hierarchy(DS, HR always_zero dataset_priority all)"]:::ok
v_always_zero_dataset_priority_all_measures["check_hierarchy(DS, HR always_zero dataset_priority all_measures)"]:::ok
v_condition["check_hierarchy(DS, HR condition C)"]:::ok
v_rule["check_hierarchy(DS, HR rule C)"]:::ok
v_errorcode["check_hierarchy(DS, HR partial_zero dataset all), rules with errorcode"]:::ok
v_errorlevel["check_hierarchy(DS, HR partial_zero dataset all), rules with errorlevel"]:::ok
v_non_null_dataset_invalid --- O
v_non_null_dataset_all --- O
v_non_null_dataset_all_measures --- O
v_non_null_dataset_priority_invalid --- O
v_non_null_dataset_priority_all --- O
v_non_null_dataset_priority_all_measures --- O
v_non_zero_dataset_invalid --- O
v_non_zero_dataset_all --- O
v_non_zero_dataset_all_measures --- O
v_non_zero_dataset_priority_invalid --- O
v_non_zero_dataset_priority_all --- O
v_non_zero_dataset_priority_all_measures --- O
v_partial_null_dataset_invalid --- O
v_partial_null_dataset_all --- O
v_partial_null_dataset_all_measures --- O
v_partial_null_dataset_priority_invalid --- O
v_partial_null_dataset_priority_all --- O
v_partial_null_dataset_priority_all_measures --- O
v_partial_zero_dataset_invalid --- O
v_partial_zero_dataset_all --- O
O --- v_partial_zero_dataset_all_measures
O --- v_partial_zero_dataset_priority_invalid
O --- v_partial_zero_dataset_priority_all
O --- v_partial_zero_dataset_priority_all_measures
O --- v_always_null_dataset_invalid
O --- v_always_null_dataset_all
O --- v_always_null_dataset_all_measures
O --- v_always_null_dataset_priority_invalid
O --- v_always_null_dataset_priority_all
O --- v_always_null_dataset_priority_all_measures
O --- v_always_zero_dataset_invalid
O --- v_always_zero_dataset_all
O --- v_always_zero_dataset_all_measures
O --- v_always_zero_dataset_priority_invalid
O --- v_always_zero_dataset_priority_all
O --- v_always_zero_dataset_priority_all_measures
O --- v_condition
O --- v_rule
O --- v_errorcode
O --- v_errorlevel
click v_non_null_dataset_invalid href "#form-non-null-dataset-invalid"
click v_non_null_dataset_all href "#form-non-null-dataset-all"
click v_non_null_dataset_all_measures href "#form-non-null-dataset-all-measures"
click v_non_null_dataset_priority_invalid href "#form-non-null-dataset-priority-invalid"
click v_non_null_dataset_priority_all href "#form-non-null-dataset-priority-all"
click v_non_null_dataset_priority_all_measures href "#form-non-null-dataset-priority-all-measures"
click v_non_zero_dataset_invalid href "#form-non-zero-dataset-invalid"
click v_non_zero_dataset_all href "#form-non-zero-dataset-all"
click v_non_zero_dataset_all_measures href "#form-non-zero-dataset-all-measures"
click v_non_zero_dataset_priority_invalid href "#form-non-zero-dataset-priority-invalid"
click v_non_zero_dataset_priority_all href "#form-non-zero-dataset-priority-all"
click v_non_zero_dataset_priority_all_measures href "#form-non-zero-dataset-priority-all-measures"
click v_partial_null_dataset_invalid href "#form-partial-null-dataset-invalid"
click v_partial_null_dataset_all href "#form-partial-null-dataset-all"
click v_partial_null_dataset_all_measures href "#form-partial-null-dataset-all-measures"
click v_partial_null_dataset_priority_invalid href "#form-partial-null-dataset-priority-invalid"
click v_partial_null_dataset_priority_all href "#form-partial-null-dataset-priority-all"
click v_partial_null_dataset_priority_all_measures href "#form-partial-null-dataset-priority-all-measures"
click v_partial_zero_dataset_invalid href "#form-partial-zero-dataset-invalid"
click v_partial_zero_dataset_all href "#form-partial-zero-dataset-all"
click v_partial_zero_dataset_all_measures href "#form-partial-zero-dataset-all-measures"
click v_partial_zero_dataset_priority_invalid href "#form-partial-zero-dataset-priority-invalid"
click v_partial_zero_dataset_priority_all href "#form-partial-zero-dataset-priority-all"
click v_partial_zero_dataset_priority_all_measures href "#form-partial-zero-dataset-priority-all-measures"
click v_always_null_dataset_invalid href "#form-always-null-dataset-invalid"
click v_always_null_dataset_all href "#form-always-null-dataset-all"
click v_always_null_dataset_all_measures href "#form-always-null-dataset-all-measures"
click v_always_null_dataset_priority_invalid href "#form-always-null-dataset-priority-invalid"
click v_always_null_dataset_priority_all href "#form-always-null-dataset-priority-all"
click v_always_null_dataset_priority_all_measures href "#form-always-null-dataset-priority-all-measures"
click v_always_zero_dataset_invalid href "#form-always-zero-dataset-invalid"
click v_always_zero_dataset_all href "#form-always-zero-dataset-all"
click v_always_zero_dataset_all_measures href "#form-always-zero-dataset-all-measures"
click v_always_zero_dataset_priority_invalid href "#form-always-zero-dataset-priority-invalid"
click v_always_zero_dataset_priority_all href "#form-always-zero-dataset-priority-all"
click v_always_zero_dataset_priority_all_measures href "#form-always-zero-dataset-priority-all-measures"
click v_condition href "#form-condition"
click v_rule href "#form-rule"
click v_errorcode href "#form-errorcode"
click v_errorlevel href "#form-errorlevel"
Types
Takes number, hierarchical ruleset · Gives number, integer, string, boolean
Comes from · number — 44 operators in 6 blocks 🟢44
General purpose operators (2) 🟢2
String operators (3) 🟢3
Numeric operators (18) 🟢18
Time operators (9) 🟢9
Aggregate and Analytic operators (10) 🟢10
Data validation operators (2) 🟢2
Comes from · operators that return any type (their input's) — 37 operators in 8 blocks 🟢37
General purpose operators (5) 🟢5
Join operators (4) 🟢4
Time operators (3) 🟢3
Set operators (4) 🟢4
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (8) 🟢8
Conditional operators (3) 🟢3
Comes from · hierarchical ruleset — 1 operator in 1 block 🟢1
Definitions (VTL-DL) (1) 🟢1
Goes to · number, integer, string, boolean — 68 operators in 13 blocks 🟢68
General purpose operators (1) 🟢1
Join operators (4) 🟢4
String operators (11) 🟢11
||Whitespace removal trimLeading whitespace removal ltrimTrailing whitespace removal rtrimUpper case conversion upperLower case conversion lowerSub-string extraction substrString pattern replacement replaceString pattern location instrString length lengthString distances string_distanceNumeric operators (18) 🟢18
Comparison operators (1) 🟢1
Boolean operators (4) 🟢4
Time operators (6) 🟢6
Hierarchical aggregation (1) 🟢1
Aggregate and Analytic operators (13) 🟢13
Data validation operators (1) 🟢1
Conditional operators (2) 🟢2
Clause operators (2) 🟢2
Definitions (VTL-DL) (4) 🟢4
Goes to · operators that take any scalar — 35 operators in 7 blocks 🟢35
General purpose operators (6) 🟢6
Comparison operators (11) 🟢11
Set operators (4) 🟢4
Aggregate and Analytic operators (5) 🟢5
Data validation operators (1) 🟢1
Conditional operators (1) 🟢1
Forms
check_hierarchy(DS, HR non_null dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null or missing item drops the rule 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
non_nulla data point is produced “when all the items involved in the comparison exist and have not null Measure value”; the mode table has null for “Null Data Points are considered”.- Expected:
the false results only, keyed by the left item and the rule, with
Me_1, the value of the left item, and nobool_var: R3B >= D(Me_13,imbalance-3) only; R7F > Bis true, and the other rules have a null or missing item.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | 3 | -3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_null dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null or missing item drops the rule 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
non_nulla data point is produced “when all the items involved in the comparison exist and have not null Measure value”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varand noMe_1: R3B >= Dfalse (imbalance-3) and R7F > Btrue (2) only, as the other rules have a null or missing item.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | false | -3 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_null dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null or missing item drops the rule 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
non_nulla data point is produced “when all the items involved in the comparison exist and have not null Measure value”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varandMe_1, the value of the left item: R3B >= Dfalse (imbalance-3) and R7F > Btrue (2) only, as the other rules have a null or missing item.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_null dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;non_nullproduces a data point “when all the items involved in the comparison exist and have not null Measure value”.- Expected:
as for the form
non_null_dataset_invalid, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset_priority invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 | ||
| 1 | B | R3 | 3 | -3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_null dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;non_nullproduces a data point “when all the items involved in the comparison exist and have not null Measure value”.- Expected:
as for the form
non_null_dataset_all, but R110 = 3 + 6is false (imbalance1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 1 | ||
| 1 | B | R3 | false | -3 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_null dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;non_nullproduces a data point “when all the items involved in the comparison exist and have not null Measure value”.- Expected:
as for the form
non_null_dataset_all_measures, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_null dataset_priority all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 10 | 1 | ||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_zero dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Rule with no nonzero item dropped 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
non_zeroa data point is produced “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”, the missing ones “having a Measure value equal to 0”; only those count as 0, and this page’s mode table lacks the Non_zero cell of “Null Data Points are considered”, which the Hierarchical roll-up page’s has as null.- Expected:
the false results only, keyed by the left item and the rule, with
Me_1, the value of the left item, and nobool_var: R3B >= D(Me_13,imbalance-3) and R6D <= X(6, 6), X counting as 0; R7 is true, R1 and R2 null, as C stays null, and R4, with E 0 and X missing, and R5, with no item, give none.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | 3 | -3 | ||
| 1 | D | R6 | 6 | 6 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_zero dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Rule with no nonzero item dropped 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
non_zeroa data point is produced “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”, the missing ones “having a Measure value equal to 0”; only those count as 0, and this page’s mode table lacks the Non_zero cell of “Null Data Points are considered”, which the Hierarchical roll-up page’s has as null.- Expected:
every result, keyed by the left item and the rule, with
bool_varand noMe_1: R3 false (imbalance-3), R6D <= Xfalse (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R4, with E 0 and X missing, and R5, with no item.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | D | R6 | false | 6 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_zero dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Rule with no nonzero item dropped 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
non_zeroa data point is produced “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”, the missing ones “having a Measure value equal to 0”; only those count as 0, and this page’s mode table lacks the Non_zero cell of “Null Data Points are considered”, which the Hierarchical roll-up page’s has as null.- Expected:
every result, keyed by the left item and the rule, with
bool_varandMe_1, the value of the left item: R3 false (imbalance-3), R6D <= Xfalse (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R4, with E 0 and X missing, and R5, with no item.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | ||||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | D | R6 | false | 6 | 6 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_zero dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;non_zeroproduces a data point “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”.- Expected:
as for the form
non_zero_dataset_invalid, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset_priority invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 | ||
| 1 | B | R3 | 3 | -3 | ||
| 1 | D | R6 | 6 | 6 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_zero dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;non_zeroproduces a data point “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”.- Expected:
as for the form
non_zero_dataset_all, but R110 = 3 + 6is false (imbalance1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 1 | ||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | D | R6 | false | 6 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR non_zero dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;non_zeroproduces a data point “when at least one of the items involved in the comparison exist and have Measure not equal to 0 (zero)”.- Expected:
as for the form
non_zero_dataset_all_measures, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 non_zero dataset_priority all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 10 | 1 | ||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | D | R6 | false | 6 | 6 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_null dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Missing items count as null 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
partial_nulla data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a null Measure value”; the mode table has null for “Null Data Points are considered”.- Expected:
the false results only, keyed by the left item and the rule, with
Me_1, the value of the left item, and nobool_var: R3B >= D(Me_13,imbalance-3) only; R7 is true, R1, R2, R4 and R6 null, with C null or X missing, and R5, with no item found, gives none.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | 3 | -3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_null dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Missing items count as null 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
partial_nulla data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a null Measure value”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varand noMe_1: R3 false (imbalance-3), R7 true (2), R1, R2, R4 and R6 null, with C null or X missing, and none for R5, with no item found.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | ||||
| 1 | D | R6 | ||||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_null dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Missing items count as null 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
partial_nulla data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a null Measure value”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varandMe_1, the value of the left item: R3 false (imbalance-3), R7 true (2), R1, R2, R4 and R6 null, with C null or X missing, and none for R5, with no item found.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | ||||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | 0 | ||||
| 1 | D | R6 | 6 | ||||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_null dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;partial_nullproduces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.- Expected:
as for the form
partial_null_dataset_invalid, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset_priority invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 | ||
| 1 | B | R3 | 3 | -3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_null dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;partial_nullproduces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.- Expected:
as for the form
partial_null_dataset_all, but R110 = 3 + 6is false (imbalance1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 1 | ||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | ||||
| 1 | D | R6 | ||||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_null dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;partial_nullproduces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.- Expected:
as for the form
partial_null_dataset_all_measures, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_null dataset_priority all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 10 | 1 | ||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | 0 | ||||
| 1 | D | R6 | 6 | ||||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Missing items count as zero 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
partial_zeroa data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.- Expected:
the false results only, keyed by the left item and the rule, with
Me_1, the value of the left item, and nobool_var: R3B >= D(Me_13,imbalance-3), R4E > X(0, 0) and R6D <= X(6, 6), X counting as 0; R7 is true, R1 and R2 null, as C stays null, and R5, with no item found, gives none.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | 3 | -3 | ||
| 1 | E | R4 | 0 | 0 | ||
| 1 | D | R6 | 6 | 6 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Missing items count as zero 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
partial_zeroa data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varand noMe_1: R3 false (imbalance-3), R4E > Xfalse (0) and R6D <= Xfalse (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R5, with no item found.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | false | 0 | ||
| 1 | D | R6 | false | 6 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Missing items count as zero 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
partial_zeroa data point is produced “if at least one Data Point corresponding to the Code Items of the left and right sides of the rule is found (whichever is its Measure value)”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varandMe_1, the value of the left item: R3 false (imbalance-3), R4E > Xfalse (0) and R6D <= Xfalse (6), X counting as 0, R7 true (2), R1 and R2 null, as C stays null, and none for R5, with no item found.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | ||||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | false | 0 | 0 | ||
| 1 | D | R6 | false | 6 | 6 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;partial_zeroproduces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.- Expected:
as for the form
partial_zero_dataset_invalid, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset_priority invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 | ||
| 1 | B | R3 | 3 | -3 | ||
| 1 | E | R4 | 0 | 0 | ||
| 1 | D | R6 | 6 | 6 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;partial_zeroproduces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.- Expected:
as for the form
partial_zero_dataset_all, but R110 = 3 + 6is false (imbalance1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 1 | ||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | false | 0 | ||
| 1 | D | R6 | false | 6 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;partial_zeroproduces a data point “if at least one Data Point corresponding to the Code Items … of the rule is found”.- Expected:
as for the form
partial_zero_dataset_all_measures, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset_priority all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 10 | 1 | ||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | false | 0 | 0 | ||
| 1 | D | R6 | false | 6 | 6 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_null dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Rule with no item found is null 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
always_nulla data point “is produced in any case”, the missing ones “having a Measure value equal to null”; the mode table has null for “Null Data Points are considered”.- Expected:
the false results only, keyed by the left item and the rule, with
Me_1, the value of the left item, and nobool_var: R3B >= D(Me_13,imbalance-3) only; R7 is true, and R1, R2, R4, R5 and R6 null, with C null or X, Y and Z missing.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | 3 | -3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_null dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Rule with no item found is null 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
always_nulla data point “is produced in any case”, the missing ones “having a Measure value equal to null”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varand noMe_1: R3 false (imbalance-3), R7 true (2), and R1, R2, R4, R5 and R6 null, with C null or X, Y and Z missing.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | ||||
| 1 | Y | R5 | ||||
| 1 | D | R6 | ||||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_null dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Rule with no item found is null 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
always_nulla data point “is produced in any case”, the missing ones “having a Measure value equal to null”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varandMe_1, the value of the left item: R3 false (imbalance-3), R7 true (2), and R1, R2, R4, R5 and R6 null, with C null or X, Y and Z missing.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | ||||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | 0 | ||||
| 1 | Y | R5 | |||||
| 1 | D | R6 | 6 | ||||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_null dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;always_nullproduces a data point “in any case”.- Expected:
as for the form
always_null_dataset_invalid, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset_priority invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 | ||
| 1 | B | R3 | 3 | -3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_null dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;always_nullproduces a data point “in any case”.- Expected:
as for the form
always_null_dataset_all, but R110 = 3 + 6is false (imbalance1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 1 | ||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | ||||
| 1 | Y | R5 | ||||
| 1 | D | R6 | ||||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_null dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;always_nullproduces a data point “in any case”.- Expected:
as for the form
always_null_dataset_all_measures, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_null dataset_priority all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 10 | 1 | ||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | 0 | ||||
| 1 | Y | R5 | |||||
| 1 | D | R6 | 6 | ||||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_zero dataset invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Rule with no item found is false 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
always_zeroa data point “is produced in any case”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.- Expected:
the false results only, keyed by the left item and the rule, with
Me_1, the value of the left item, and nobool_var: R3B >= D(Me_13,imbalance-3), R4E > X(0, 0), R5Y < Z(0, 0) and R6D <= X(6, 6), X, Y and Z counting as 0; R7 is true, and R1 and R2 null, as C stays null; R5’sMe_1is 0, its missing left item counted as 0, a reading of the manual.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | B | R3 | 3 | -3 | ||
| 1 | E | R4 | 0 | 0 | ||
| 1 | Y | R5 | 0 | 0 | ||
| 1 | D | R6 | 6 | 6 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_zero dataset all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Rule with no item found is false 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
always_zeroa data point “is produced in any case”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varand noMe_1: R3 false (imbalance-3), R4E > X, R5Y < Zand R6D <= Xfalse (0, 0 and 6), X, Y and Z counting as 0, R7 true (2), and R1 and R2 null, as C stays null.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | false | 0 | ||
| 1 | Y | R5 | false | 0 | ||
| 1 | D | R6 | false | 6 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_zero dataset all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Rule with no item found is false 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1, a rule per relation, on A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing, every item taken fromDS_1.- Manual:
Check hierarchy: in
always_zeroa data point “is produced in any case”, the missing ones “having a Measure value equal to 0 (zero)”; the mode table has null for “Null Data Points are considered”.- Expected:
every result, keyed by the left item and the rule, with
bool_varandMe_1, the value of the left item: R3 false (imbalance-3), R4E > X, R5Y < Zand R6D <= Xfalse (0, 0 and 6), X, Y and Z counting as 0, R7 true (2), and R1 and R2 null, as C stays null; R5’sMe_1is 0, its missing left item counted as 0, a reading of the manual.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | ||||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | false | 0 | 0 | ||
| 1 | Y | R5 | false | 0 | 0 | ||
| 1 | D | R6 | false | 6 | 6 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_zero dataset_priority invalid) 🟢 · number, hierarchical ruleset → number, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;always_zeroproduces a data point “in any case”.- Expected:
as for the form
always_zero_dataset_invalid, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy; R5’sMe_1is 0, its missing left item counted as 0, a reading of the manual. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset_priority invalid );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 | ||
| 1 | B | R3 | 3 | -3 | ||
| 1 | E | R4 | 0 | 0 | ||
| 1 | Y | R5 | 0 | 0 | ||
| 1 | D | R6 | 6 | 6 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_zero dataset_priority all) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;always_zeroproduces a data point “in any case”.- Expected:
as for the form
always_zero_dataset_all, but R110 = 3 + 6is false (imbalance1): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 1 | ||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | ||
| 1 | E | R4 | false | 0 | ||
| 1 | Y | R5 | false | 0 | ||
| 1 | D | R6 | false | 6 | ||
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR always_zero dataset_priority all_measures) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Null item from the rule computing it 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1on A 10, B 3, C null, D 6, E 0 and F 5, where the=rules define only A, in R1A = B + C, and the null C, in R2C = D + E: every other item comes fromDS_1.- Manual:
Check hierarchy: with
dataset_priority, “if an expected input Data Point does not exist in op or its measure is null, then the current Rule takes the Data Point … from the computed output of the other Rule R”;always_zeroproduces a data point “in any case”.- Expected:
as for the form
always_zero_dataset_all_measures, but R110 = 3 + 6is false (imbalance1,Me_110): C is R2’s computed output, D + E = 6, which every mode computes, read as the value a rule computes for its left item, as inhierarchy; R5’sMe_1is 0, its missing left item counted as 0, a reading of the manual. The types are those of that form.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C
; R2 : C = D + E
; R3 : B >= D
; R4 : E > X
; R5 : Y < Z
; R6 : D <= X
; R7 : F > B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 always_zero dataset_priority all_measures );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|---|
| 1 | A | R1 | false | 10 | 1 | ||
| 1 | C | R2 | |||||
| 1 | B | R3 | false | 3 | -3 | ||
| 1 | E | R4 | false | 0 | 0 | ||
| 1 | Y | R5 | false | 0 | 0 | ||
| 1 | D | R6 | false | 6 | 6 | ||
| 1 | F | R7 | true | 5 | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR condition C) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Conditioning variable named 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_2onId_2conditioned by the variableId_1,R1 : when Id_1 = 2 then A = B, called withcondition Id_1and the defaultnon_null,datasetandinvalid.- Manual:
Check hierarchy: on Variables, condComp “can be specified all the same if it is desired to show explicitly in the invocation which are the involved Components”; the leftCondition “defines the pre-condition for evaluating the left member Code Item (i.e., it is evaluated only when the leftCondition is true)” (define hierarchical ruleset).
- Expected:
(2, A, R1) only, 7 = 4 being false, with
Me_17 andimbalance3: forId_11 the rule is not evaluated, though 5 = 2 would be false, andinvalidleaves such a rule out whatever it returns.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_2 ( variable condition Id_1 rule Id_2 ) is
R1 : when Id_1 = 2 then A = B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_2 condition Id_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 5 |
| 1 | B | 2 |
| 2 | A | 7 |
| 2 | B | 4 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 2 | A | R1 | 7 | 3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Conditioning value domain bound 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_3, the rule ofHR_2on the value domainsVD_CandVD_1,R1 : when VD_C = 2 then A = B, bound withcondition Id_1 rule Id_2, with the default mode, input and output.- Manual:
Check hierarchy: “If hr is defined on Value Domains then it is mandatory to specify the condition (if any in the ruleset hr) and the rule parameters”, whose Components “must take values on the Value Domains corresponding, in positional order, to the ones specified in the condition and rule parameter of hr”.
- Expected:
the output of Conditioning variable named: (2, A, R1), 7 = 4 being false, with
Me_17 andimbalance3, asId_11 fails the condition.VD_1holds the 26 uppercase letters of the manual’s Example 1 andVD_Cthe values 1 and 2 ofId_1;imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_3 ( valuedomain condition VD_C rule VD_1 ) is
R1 : when VD_C = 2 then A = B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_3 condition Id_1 rule Id_2 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 5 |
| 1 | B | 2 |
| 2 | A | 7 |
| 2 | B | 4 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 2 | A | R1 | 7 | 3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/VD_1.json · value_domains/VD_C.json · example page ↗
check_hierarchy(DS, HR rule C) 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Manual example 1 🟢 pandas ✅ · DuckDB ✅
- Tests:
the manual’s
HR_1, eleven rules onVD_1, “the 26 uppercase letters of the English language”, withrule Id_2 partial_null all.- Manual:
Check hierarchy, Example 1, with the erratum below:
partial_nullproduces a data point “if at least one Data Point … of the rule is found (whichever is its Measure value)”; R080, with H found but null, follows this, not the mode table’s “If at least the involved Data Points is not null”.- Expected:
the error
1-3-2-3, “At op {op}: Vtl Script contains Cycles, no DAG established. Nodes involved: {nodes}”: R020B = M + N + O, R070G = B + Cand R110M <= Gform a cycle, as a rule with<=or>=links its items as=does (team decision). The manual’s example is to be fixed.
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
R010 : A = J + K + L errorlevel 5
; R020 : B = M + N + O errorlevel 5
; R030 : C = P + Q errorcode "XX" errorlevel 5
; R040 : D = R + S errorlevel 1
; R050 : E = T + U + V errorlevel 0
; R060 : F = Y + W + Z errorlevel 7
; R070 : G = B + C
; R080 : H = D + E errorlevel 0
; R090 : I = D + G errorcode "YY" errorlevel 0
; R100 : M >= N errorlevel 5
; R110 : M <= G errorlevel 5
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 rule Id_2 partial_null all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2010 | A | 5 |
| 2010 | B | 11 |
| 2010 | C | 0 |
| 2010 | G | 19 |
| 2010 | H | |
| 2010 | I | 14 |
| 2010 | M | 2 |
| 2010 | N | 5 |
| 2010 | O | 4 |
| 2010 | P | 7 |
| 2010 | Q | -7 |
| 2010 | S | 3 |
| 2010 | T | 9 |
| 2010 | U | |
| 2010 | V | 6 |
Expected error 1-3-2-3: At op {op}: Vtl Script contains Cycles, no DAG established. Nodes involved: {nodes}.
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/error.json · value_domains/VD_1.json · example page ↗
Value domain bound to identifier 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_2on the value domainVD_1,R1 : A = B + CandR2 : C >= B, bound withrule Id_2and the defaultnon_null,datasetandinvalid.- Manual:
Check hierarchy: ruleComp “is the Identifier Component of op to be associated to the rule Value Domain or Variable defined in hr”, and “If hr is defined on Value Domains then it is mandatory to specify the condition (if any in the ruleset hr) and the rule parameters”.
- Expected:
(1, A, R1) only: 10 = 3 + 6 is false, with
imbalance1, while R2, 6 >= 3, holds.VD_1holds the 26 uppercase letters of the manual’s Example 1;imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_2 ( valuedomain rule VD_1 ) is
R1 : A = B + C
; R2 : C >= B
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_2 rule Id_2 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | 6 |
| Id_1 | Id_2 | ruleid | Me_1 | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | 10 | 1 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · value_domains/VD_1.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset all), rules with errorcode 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Code only on false results 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1andDS_1of the<mode>_<input>_<output>forms (A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing), witherrorcode "E<n>"on each rule R<n>, inpartial_zero dataset all: three false results, a true one, two null ones, and none for R5, which has no item, so the question that separatesalways_*frompartial_*stays in the grid.- Manual:
Check hierarchy: “the Measure errorcode, which contains the errorcode value specified in the Rule; if the Measure bool_var is true or null then errorcode is null”.
- Expected:
E3,E4andE6on the false R33 >= 6, R40 > 0and R66 <= 0, X counting as 0, and null on R1 and R2, null as C is null, and on R7, true.imbalance, left minus right, is a Number likeMe_1, and the nullerrorlevelInteger, the manual’s default without errorlevel_vd (#1256).
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C errorcode "E1"
; R2 : C = D + E errorcode "E2"
; R3 : B >= D errorcode "E3"
; R4 : E > X errorcode "E4"
; R5 : Y < Z errorcode "E5"
; R6 : D <= X errorcode "E6"
; R7 : F > B errorcode "E7"
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | E3 | |
| 1 | E | R4 | false | 0 | E4 | |
| 1 | D | R6 | false | 6 | E6 | |
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
check_hierarchy(DS, HR partial_zero dataset all), rules with errorlevel 🟢 · number, hierarchical ruleset → number, boolean, string, integer
Integer level on false results 🟢 pandas ✅ · DuckDB ✅
- Tests:
HR_1andDS_1of the<mode>_<input>_<output>forms (A 10, B 3, C null, D 6, E 0 and F 5, with X, Y and Z missing), witherrorlevel <n>on each rule R<n>, inpartial_zero dataset all, andMe_1Integer, as in the manual’s Example 1.- Manual:
Check hierarchy: “the Measure errorlevel, which contains the errorlevel value specified in the Rule; if the Measure bool_var is true or null then errorlevel is null”; Subtraction: “If the type of both operands is integer then the result has type integer”.
- Expected:
3, 4 and 6 on the false R3, R4 and R6, and null on R1, R2 and R7, typed Integer as in the manual’s example structures and the manual’s default without errorlevel_vd (#1256).
imbalance, left minus right, is an Integer likeMe_1.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
R1 : A = B + C errorlevel 1
; R2 : C = D + E errorlevel 2
; R3 : B >= D errorlevel 3
; R4 : E > X errorlevel 4
; R5 : Y < Z errorlevel 5
; R6 : D <= X errorlevel 6
; R7 : F > B errorlevel 7
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 partial_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 10 |
| 1 | B | 3 |
| 1 | C | |
| 1 | D | 6 |
| 1 | E | 0 |
| 1 | F | 5 |
| Id_1 | Id_2 | ruleid | bool_var | imbalance | errorcode | errorlevel |
|---|---|---|---|---|---|---|
| 1 | A | R1 | ||||
| 1 | C | R2 | ||||
| 1 | B | R3 | false | -3 | 3 | |
| 1 | E | R4 | false | 0 | 4 | |
| 1 | D | R6 | false | 6 | 6 | |
| 1 | F | R7 | true | 2 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗