Hierarchical roll-up · 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["Hierarchical roll-up · hierarchy 📌<br/>🟢38"]:::ok
v_non_null_dataset_computed["hierarchy(DS, HR non_null dataset computed)"]:::ok
v_non_null_dataset_all["hierarchy(DS, HR non_null dataset all)"]:::ok
v_non_null_rule_computed["hierarchy(DS, HR non_null rule computed)"]:::ok
v_non_null_rule_all["hierarchy(DS, HR non_null rule all)"]:::ok
v_non_null_rule_priority_computed["hierarchy(DS, HR non_null rule_priority computed)"]:::ok
v_non_null_rule_priority_all["hierarchy(DS, HR non_null rule_priority all)"]:::ok
v_non_zero_dataset_computed["hierarchy(DS, HR non_zero dataset computed)"]:::ok
v_non_zero_dataset_all["hierarchy(DS, HR non_zero dataset all)"]:::ok
v_non_zero_rule_computed["hierarchy(DS, HR non_zero rule computed)"]:::ok
v_non_zero_rule_all["hierarchy(DS, HR non_zero rule all)"]:::ok
v_non_zero_rule_priority_computed["hierarchy(DS, HR non_zero rule_priority computed)"]:::ok
v_non_zero_rule_priority_all["hierarchy(DS, HR non_zero rule_priority all)"]:::ok
v_partial_null_dataset_computed["hierarchy(DS, HR partial_null dataset computed)"]:::ok
v_partial_null_dataset_all["hierarchy(DS, HR partial_null dataset all)"]:::ok
v_partial_null_rule_computed["hierarchy(DS, HR partial_null rule computed)"]:::ok
v_partial_null_rule_all["hierarchy(DS, HR partial_null rule all)"]:::ok
v_partial_null_rule_priority_computed["hierarchy(DS, HR partial_null rule_priority computed)"]:::ok
v_partial_null_rule_priority_all["hierarchy(DS, HR partial_null rule_priority all)"]:::ok
v_partial_zero_dataset_computed["hierarchy(DS, HR partial_zero dataset computed)"]:::ok
v_partial_zero_dataset_all["hierarchy(DS, HR partial_zero dataset all)"]:::ok
v_partial_zero_rule_computed["hierarchy(DS, HR partial_zero rule computed)"]:::ok
v_partial_zero_rule_all["hierarchy(DS, HR partial_zero rule all)"]:::ok
v_partial_zero_rule_priority_computed["hierarchy(DS, HR partial_zero rule_priority computed)"]:::ok
v_partial_zero_rule_priority_all["hierarchy(DS, HR partial_zero rule_priority all)"]:::ok
v_always_null_dataset_computed["hierarchy(DS, HR always_null dataset computed)"]:::ok
v_always_null_dataset_all["hierarchy(DS, HR always_null dataset all)"]:::ok
v_always_null_rule_computed["hierarchy(DS, HR always_null rule computed)"]:::ok
v_always_null_rule_all["hierarchy(DS, HR always_null rule all)"]:::ok
v_always_null_rule_priority_computed["hierarchy(DS, HR always_null rule_priority computed)"]:::ok
v_always_null_rule_priority_all["hierarchy(DS, HR always_null rule_priority all)"]:::ok
v_always_zero_dataset_computed["hierarchy(DS, HR always_zero dataset computed)"]:::ok
v_always_zero_dataset_all["hierarchy(DS, HR always_zero dataset all)"]:::ok
v_always_zero_rule_computed["hierarchy(DS, HR always_zero rule computed)"]:::ok
v_always_zero_rule_all["hierarchy(DS, HR always_zero rule all)"]:::ok
v_always_zero_rule_priority_computed["hierarchy(DS, HR always_zero rule_priority computed)"]:::ok
v_always_zero_rule_priority_all["hierarchy(DS, HR always_zero rule_priority all)"]:::ok
v_condition["hierarchy(DS, HR condition C) 📌"]:::ok
v_valuedomain_rule["hierarchy(DS, HR rule R)"]:::ok
v_non_null_dataset_computed --- O
v_non_null_dataset_all --- O
v_non_null_rule_computed --- O
v_non_null_rule_all --- O
v_non_null_rule_priority_computed --- O
v_non_null_rule_priority_all --- O
v_non_zero_dataset_computed --- O
v_non_zero_dataset_all --- O
v_non_zero_rule_computed --- O
v_non_zero_rule_all --- O
v_non_zero_rule_priority_computed --- O
v_non_zero_rule_priority_all --- O
v_partial_null_dataset_computed --- O
v_partial_null_dataset_all --- O
v_partial_null_rule_computed --- O
v_partial_null_rule_all --- O
v_partial_null_rule_priority_computed --- O
v_partial_null_rule_priority_all --- O
v_partial_zero_dataset_computed --- O
O --- v_partial_zero_dataset_all
O --- v_partial_zero_rule_computed
O --- v_partial_zero_rule_all
O --- v_partial_zero_rule_priority_computed
O --- v_partial_zero_rule_priority_all
O --- v_always_null_dataset_computed
O --- v_always_null_dataset_all
O --- v_always_null_rule_computed
O --- v_always_null_rule_all
O --- v_always_null_rule_priority_computed
O --- v_always_null_rule_priority_all
O --- v_always_zero_dataset_computed
O --- v_always_zero_dataset_all
O --- v_always_zero_rule_computed
O --- v_always_zero_rule_all
O --- v_always_zero_rule_priority_computed
O --- v_always_zero_rule_priority_all
O --- v_condition
O --- v_valuedomain_rule
click v_non_null_dataset_computed href "#form-non-null-dataset-computed"
click v_non_null_dataset_all href "#form-non-null-dataset-all"
click v_non_null_rule_computed href "#form-non-null-rule-computed"
click v_non_null_rule_all href "#form-non-null-rule-all"
click v_non_null_rule_priority_computed href "#form-non-null-rule-priority-computed"
click v_non_null_rule_priority_all href "#form-non-null-rule-priority-all"
click v_non_zero_dataset_computed href "#form-non-zero-dataset-computed"
click v_non_zero_dataset_all href "#form-non-zero-dataset-all"
click v_non_zero_rule_computed href "#form-non-zero-rule-computed"
click v_non_zero_rule_all href "#form-non-zero-rule-all"
click v_non_zero_rule_priority_computed href "#form-non-zero-rule-priority-computed"
click v_non_zero_rule_priority_all href "#form-non-zero-rule-priority-all"
click v_partial_null_dataset_computed href "#form-partial-null-dataset-computed"
click v_partial_null_dataset_all href "#form-partial-null-dataset-all"
click v_partial_null_rule_computed href "#form-partial-null-rule-computed"
click v_partial_null_rule_all href "#form-partial-null-rule-all"
click v_partial_null_rule_priority_computed href "#form-partial-null-rule-priority-computed"
click v_partial_null_rule_priority_all href "#form-partial-null-rule-priority-all"
click v_partial_zero_dataset_computed href "#form-partial-zero-dataset-computed"
click v_partial_zero_dataset_all href "#form-partial-zero-dataset-all"
click v_partial_zero_rule_computed href "#form-partial-zero-rule-computed"
click v_partial_zero_rule_all href "#form-partial-zero-rule-all"
click v_partial_zero_rule_priority_computed href "#form-partial-zero-rule-priority-computed"
click v_partial_zero_rule_priority_all href "#form-partial-zero-rule-priority-all"
click v_always_null_dataset_computed href "#form-always-null-dataset-computed"
click v_always_null_dataset_all href "#form-always-null-dataset-all"
click v_always_null_rule_computed href "#form-always-null-rule-computed"
click v_always_null_rule_all href "#form-always-null-rule-all"
click v_always_null_rule_priority_computed href "#form-always-null-rule-priority-computed"
click v_always_null_rule_priority_all href "#form-always-null-rule-priority-all"
click v_always_zero_dataset_computed href "#form-always-zero-dataset-computed"
click v_always_zero_dataset_all href "#form-always-zero-dataset-all"
click v_always_zero_rule_computed href "#form-always-zero-rule-computed"
click v_always_zero_rule_all href "#form-always-zero-rule-all"
click v_always_zero_rule_priority_computed href "#form-always-zero-rule-priority-computed"
click v_always_zero_rule_priority_all href "#form-always-zero-rule-priority-all"
click v_condition href "#form-condition"
click v_valuedomain_rule href "#form-valuedomain-rule"
Types
Takes number, hierarchical ruleset · Gives any type
Comes from · number — 45 operators in 6 blocks 🟢45
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 (3) 🟢3
Comes from · operators that return any type (their input's) — 36 operators in 7 blocks 🟢36
General purpose operators (5) 🟢5
Join operators (4) 🟢4
Time operators (3) 🟢3
Set operators (4) 🟢4
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: whatever takes its input's type
Forms
hierarchy(DS, HR non_null dataset computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null dataset computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_null: “the result Data Point is produced when its computed Measure value is not null”, missing Data Points “having a Measure value equal to null”;dataset“takes the input Data Points exclusively from the operand op”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads C from
DS_1: the result is (1, C) = 2 + 3 = 5 and (2, A) = 4 + 20 = 24; (1, A) = 1 + null, (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null dataset computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | C | 5 |
| 2 | A | 24 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_null dataset all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null dataset allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_null: “the result Data Point is produced when its computed Measure value is not null”, missing Data Points “having a Measure value equal to null”;dataset“takes the input Data Points exclusively from the operand op”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads C from
DS_1: R is (1, C) = 2 + 3 = 5 and (2, A) = 4 + 20 = 24; (1, A) = 1 + null, (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.alladds the 8 data points ofDS_1, (2, C, 20) among them, as R has none of their identifiers.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_null rule computed) 🟢 · number, hierarchical ruleset → any type
Manual example 1 🛡️ pandas 🛡 1-2-22 · DuckDB 🛡 1-2-22
SemanticError 1-2-22: No Value Domains have been defined. Please check transformation with output Dataset DS_r
- Tests:
non_nullwith the default inputruleand outputcomputed, on the page’s nine rules overVD_1and the viralAt_1.- Manual:
Hierarchical roll-up, Example 1, output verbatim:
non_null: “the result Data Point is produced when its computed Measure value is not null”. The script adds the page’sHR_1verbatim and its rule forAt_1, “the alphabetic order prevails the null prevails on the alphabetic characters and the Attribute value for missing Data Points is assumed as null”, as a viral propagation,when null then nullfirst, then each value in alphabetic order;VD_1has no code list on the page, so it has no file.- Expected:
B = 2 + 5 + 4 = 11, C = 7 + (-7) = 0 and G = B + C = 11, with
At_1Dx, Pz and Dx; each other rule has a missing or null item, so its value is null and it gives no data point.
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
A = J + K + L
; B = M + N + O
; C = P + Q
; D = R + S
; E = T + U + V
; F = Y + W + Z
; G = B + C
; H = D + E
; I = D + G
end hierarchical ruleset;
define viral propagation VP_1 ( variable At_1 ) is
when null then null;
when "Ay" then "Ay";
when "Bq" then "Bq";
when "Dx" then "Dx";
when "Ko" then "Ko";
when "Nj" then "Nj";
when "Pz" then "Pz"
end viral propagation;
DS_r := hierarchy ( DS_1, HR_1 rule Id_2 non_null );
| Id_1 | Id_2 | Me_1 | At_1 |
|---|---|---|---|
| 2010 | M | 2 | Dx |
| 2010 | N | 5 | Pz |
| 2010 | O | 4 | Pz |
| 2010 | P | 7 | Pz |
| 2010 | Q | -7 | Pz |
| 2010 | S | 3 | Ay |
| 2010 | T | 9 | Bq |
| 2010 | U | Nj | |
| 2010 | V | 6 | Ko |
| Id_1 | Id_2 | Me_1 | At_1 |
|---|---|---|---|
| 2010 | B | 11 | Dx |
| 2010 | C | 0 | Pz |
| 2010 | G | 11 | Dx |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null rule computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_null: “the result Data Point is produced when its computed Measure value is not null”, missing Data Points “having a Measure value equal to null”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C: the result is (1, A) = 1 + 5 = 6 and (1, C) = 2 + 3 = 5; (2, A) = 4 + null, (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null rule computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_null rule all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null rule allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_null: “the result Data Point is produced when its computed Measure value is not null”, missing Data Points “having a Measure value equal to null”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C: R is (1, A) = 1 + 5 = 6 and (1, C) = 2 + 3 = 5; (2, A) = 4 + null, (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.
alladds the 8 data points ofDS_1, (2, C, 20) among them, as R has none of their identifiers.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null rule all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_null rule_priority computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null rule_priority computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_null: “the result Data Point is produced when its computed Measure value is not null”, missing Data Points “having a Measure value equal to null”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5 and (2, A) = 4 + 20 = 24; (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null rule_priority computedon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;non_null: “the result Data Point is produced when its computed Measure value is not null”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5 and (2, A) = 4 + 20 = 24; (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_null rule_priority all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null rule_priority allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_null: “the result Data Point is produced when its computed Measure value is not null”, missing Data Points “having a Measure value equal to null”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5 and (2, A) = 4 + 20 = 24; (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.alladds the 8 data points ofDS_1, (2, C, 20) among them, as R has none of their identifiers.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_null rule_priority allon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;non_null: “the result Data Point is produced when its computed Measure value is not null”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5 and (2, A) = 4 + 20 = 24; (2, C) = null + 5, (3, A) = 0 + null and (3, C) = null + null are null, so they are not returned.alladds the other 8 data points ofDS_1, its (1, C, 10) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_null rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_zero dataset computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero dataset computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and the mode table evaluates the rule “If at least one the involved Data Points is <> zero”, and “null are returned too”;dataset“takes the input Data Points exclusively from the operand op”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads C from
DS_1: the result is (1, A) = 1 + 0 = 1, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24 and (2, C) = null + 5 = null; forId_13 no involved data point is not zero, so no rule is evaluated.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero dataset computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_zero dataset all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero dataset allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and the mode table evaluates the rule “If at least one the involved Data Points is <> zero”, and “null are returned too”;dataset“takes the input Data Points exclusively from the operand op”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads C from
DS_1: R is (1, A) = 1 + 0 = 1, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24 and (2, C) = null + 5 = null; forId_13 no involved data point is not zero, so no rule is evaluated.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_zero rule computed) 🟢 · number, hierarchical ruleset → any type
Manual example 2 🛡️ pandas 🛡 1-2-22 · DuckDB 🛡 1-2-22
SemanticError 1-2-22: No Value Domains have been defined. Please check transformation with output Dataset DS_r
- Tests:
non_zerowith the default inputruleand outputcomputed, on the page’s nine rules overVD_1and the viralAt_1.- Manual:
Hierarchical roll-up, Example 2, output verbatim:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and “null are returned too” in the mode table. The script adds the page’sHR_1verbatim and its rule forAt_1, “the alphabetic order prevails the null prevails on the alphabetic characters and the Attribute value for missing Data Points is assumed as null”, as a viral propagation,when null then nullfirst, then each value in alphabetic order;VD_1has no code list on the page, so it has no file.- Expected:
B 11, D 0 + 3 = 3, E null, G 11, H null and I 3 + 11 = 14, while A, C and F, all 0, are not returned. D’s
At_1is null, as R is missing, and so are H’s and I’s; G’s Dx shows that G reads the C thatnon_zerodoes not return, as a missing C would bring a null.
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
A = J + K + L
; B = M + N + O
; C = P + Q
; D = R + S
; E = T + U + V
; F = Y + W + Z
; G = B + C
; H = D + E
; I = D + G
end hierarchical ruleset;
define viral propagation VP_1 ( variable At_1 ) is
when null then null;
when "Ay" then "Ay";
when "Bq" then "Bq";
when "Dx" then "Dx";
when "Ko" then "Ko";
when "Nj" then "Nj";
when "Pz" then "Pz"
end viral propagation;
DS_r := hierarchy ( DS_1, HR_1 rule Id_2 non_zero );
| Id_1 | Id_2 | Me_1 | At_1 |
|---|---|---|---|
| 2010 | M | 2 | Dx |
| 2010 | N | 5 | Pz |
| 2010 | O | 4 | Pz |
| 2010 | P | 7 | Pz |
| 2010 | Q | -7 | Pz |
| 2010 | S | 3 | Ay |
| 2010 | T | 9 | Bq |
| 2010 | U | Nj | |
| 2010 | V | 6 | Ko |
| Id_1 | Id_2 | Me_1 | At_1 |
|---|---|---|---|
| 2010 | B | 11 | Dx |
| 2010 | D | 3 | |
| 2010 | E | Bq | |
| 2010 | G | 11 | Dx |
| 2010 | H | ||
| 2010 | I | 14 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero rule computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and the mode table evaluates the rule “If at least one the involved Data Points is <> zero”, and “null are returned too”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null and (2, C) = null + 5 = null; for
Id_13 no involved data point is not zero, so no rule is evaluated.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero rule computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | |
| 2 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_zero rule all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero rule allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and the mode table evaluates the rule “If at least one the involved Data Points is <> zero”, and “null are returned too”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null and (2, C) = null + 5 = null; for
Id_13 no involved data point is not zero, so no rule is evaluated.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero rule all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_zero rule_priority computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero rule_priority computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and the mode table evaluates the rule “If at least one the involved Data Points is <> zero”, and “null are returned too”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24 and (2, C) = null + 5 = null; forId_13 no involved data point is not zero, so no rule is evaluated.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero rule_priority computedon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24 and (2, C) = null + 5 = null; forId_13 no involved data point is not zero, so no rule is evaluated.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR non_zero rule_priority all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero rule_priority allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”, missing Data Points “having a Measure value equal to 0”, and the mode table evaluates the rule “If at least one the involved Data Points is <> zero”, and “null are returned too”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24 and (2, C) = null + 5 = null; forId_13 no involved data point is not zero, so no rule is evaluated.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
non_zero rule_priority allon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;non_zero: “the result Data Point is produced when its computed Measure value is not equal to 0 (zero)”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24 and (2, C) = null + 5 = null; forId_13 no involved data point is not zero, so no rule is evaluated.alladds the other 7 data points ofDS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 non_zero rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_null dataset computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null dataset computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a null Measure value”;dataset“takes the input Data Points exclusively from the operand op”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads C from
DS_1: the result is (1, A) = 1 + null = null, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + null = null; forId_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null dataset computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_null dataset all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null dataset allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a null Measure value”;dataset“takes the input Data Points exclusively from the operand op”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads C from
DS_1: R is (1, A) = 1 + null = null, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + null = null; forId_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_null rule computed) 🟢 · number, hierarchical ruleset → any type
Manual example 3 🛡️ pandas 🛡 1-2-22 · DuckDB 🛡 1-2-22
SemanticError 1-2-22: No Value Domains have been defined. Please check transformation with output Dataset DS_r
- Tests:
partial_nullwith the default inputruleand outputcomputed, on the page’s nine rules overVD_1and the viralAt_1.- Manual:
Hierarchical roll-up, Example 3, output verbatim:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”. The script adds the page’sHR_1verbatim and its rule forAt_1, “the alphabetic order prevails the null prevails on the alphabetic characters and the Attribute value for missing Data Points is assumed as null”, as a viral propagation,when null then nullfirst, then each value in alphabetic order;VD_1has no code list on the page, so it has no file.- Expected:
each rule that finds a right item gives a data point: B 11, C 0, G 11, and D, E, H and I null, D, H and I with a null
At_1as R is missing; A and F find none. H, null + null, follows this text: the mode table’s condition “If at least the involved Data Points is not null” would drop it.
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
A = J + K + L
; B = M + N + O
; C = P + Q
; D = R + S
; E = T + U + V
; F = Y + W + Z
; G = B + C
; H = D + E
; I = D + G
end hierarchical ruleset;
define viral propagation VP_1 ( variable At_1 ) is
when null then null;
when "Ay" then "Ay";
when "Bq" then "Bq";
when "Dx" then "Dx";
when "Ko" then "Ko";
when "Nj" then "Nj";
when "Pz" then "Pz"
end viral propagation;
DS_r := hierarchy ( DS_1, HR_1 rule Id_2 partial_null );
| Id_1 | Id_2 | Me_1 | At_1 |
|---|---|---|---|
| 2010 | M | 2 | Dx |
| 2010 | N | 5 | Pz |
| 2010 | O | 4 | Pz |
| 2010 | P | 7 | Pz |
| 2010 | Q | -7 | Pz |
| 2010 | S | 3 | Ay |
| 2010 | T | 9 | Bq |
| 2010 | U | Nj | |
| 2010 | V | 6 | Ko |
| Id_1 | Id_2 | Me_1 | At_1 |
|---|---|---|---|
| 2010 | B | 11 | Dx |
| 2010 | C | 0 | Pz |
| 2010 | D | ||
| 2010 | E | Bq | |
| 2010 | G | 11 | Dx |
| 2010 | H | ||
| 2010 | I |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null rule computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a null Measure value”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null and (3, A) = 0 + null = null; for
Id_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null rule computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | |
| 2 | C | |
| 3 | A |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_null rule all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null rule allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a null Measure value”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null and (3, A) = 0 + null = null; for
Id_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null rule all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_null rule_priority computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null rule_priority computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a null Measure value”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + null = null; forId_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null rule_priority computedon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + null = null; forId_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_null rule_priority all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null rule_priority allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a null Measure value”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + null = null; forId_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_null rule_priority allon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;partial_null: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + null = null; forId_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_null rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_zero dataset computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero dataset computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a Measure value equal to 0 (zero)”;dataset“takes the input Data Points exclusively from the operand op”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads C from
DS_1: the result is (1, A) = 1 + 0 = 1, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; forId_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero dataset computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_zero dataset all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero dataset allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a Measure value equal to 0 (zero)”;dataset“takes the input Data Points exclusively from the operand op”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads C from
DS_1: R is (1, A) = 1 + 0 = 1, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; forId_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_zero rule computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero rule computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a Measure value equal to 0 (zero)”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; for
Id_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero rule computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | |
| 2 | C | |
| 3 | A | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_zero rule all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero rule allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a Measure value equal to 0 (zero)”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; for
Id_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero rule all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_zero rule_priority computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero rule_priority computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a Measure value equal to 0 (zero)”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; forId_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero rule_priority computedon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; forId_13 C = D + E finds neither D nor E, so it gives nothing.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR partial_zero rule_priority all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero rule_priority allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”, missing Data Points “having a Measure value equal to 0 (zero)”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; forId_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
partial_zero rule_priority allon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;partial_zero: “the result Data Point is produced if at least one Data Point corresponding to the Code Items of the right side of the rule is found (whichever is its Measure value)”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null and (3, A) = 0 + 0 = 0; forId_13 C = D + E finds neither D nor E, so it gives nothing.alladds the other 7 data points ofDS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 partial_zero rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_null dataset computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null dataset computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_null: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to null”;dataset“takes the input Data Points exclusively from the operand op”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads C from
DS_1: the result is (1, A) = 1 + null = null, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” coversId_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null dataset computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_null dataset all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null dataset allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_null: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to null”;dataset“takes the input Data Points exclusively from the operand op”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads C from
DS_1: R is (1, A) = 1 + null = null, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” coversId_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_null rule computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null rule computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_null: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to null”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” covers
Id_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null rule computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | |
| 2 | C | |
| 3 | A | |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_null rule all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null rule allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_null: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to null”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” covers
Id_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null rule all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_null rule_priority computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null rule_priority computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_null: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to null”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” coversId_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null rule_priority computedon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;always_null: “the result Data Point is produced in any case”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” coversId_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_null rule_priority all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null rule_priority allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_null: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to null”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” coversId_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_null rule_priority allon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;always_null: “the result Data Point is produced in any case”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + null = null and (3, C) = null + null = null, as “in any case” coversId_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_null rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | |
| 3 | B | 0 |
| 3 | C |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_zero dataset computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero dataset computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_zero: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to 0 (zero)”;dataset“takes the input Data Points exclusively from the operand op”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads C from
DS_1: the result is (1, A) = 1 + 0 = 1, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” coversId_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero dataset computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_zero dataset all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero dataset allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_zero: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to 0 (zero)”;dataset“takes the input Data Points exclusively from the operand op”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads C from
DS_1: R is (1, A) = 1 + 0 = 1, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” coversId_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero dataset all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 1 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_zero rule computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero rule computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_zero: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to 0 (zero)”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” covers
Id_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero rule computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | |
| 2 | C | |
| 3 | A | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_zero rule all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero rule allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_zero: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to 0 (zero)”;rule: “if the item is defined as the result of another Rule, the current Rule takes the input Data Points from the computed output of such other Rule”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + null = null, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” covers
Id_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero rule all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_zero rule_priority computed) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero rule_priority computedon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_zero: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to 0 (zero)”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” coversId_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero rule_priority computedon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;always_zero: “the result Data Point is produced in any case”;computed: “only the set of Data Points computed according to the Ruleset”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: the result is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” coversId_13, where neither D nor E is found.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero rule_priority computed );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
| 2 | A | 24 |
| 2 | C | |
| 3 | A | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR always_zero rule_priority all) 🟢 · number, hierarchical ruleset → any type
Missing null and zero items 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero rule_priority allon the grid input,A = B + C; C = D + EonId_2:Id_11 has no C, 2 a null D beside C = 20, and 3 only B = 0.- Manual:
Hierarchical roll-up:
always_zero: “the result Data Point is produced in any case”, missing Data Points “having a Measure value equal to 0 (zero)”;rule_priority: if a computed Data Point “does not exist […] or its measure is null, then the current Rule takes the Data Point from op (if any) having the same values of the Identifiers”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C reads the computed C, else the C of
DS_1: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” coversId_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (2, C, 20) giving way to the computed one.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Computed item takes precedence 🟢 pandas ✅ · DuckDB ✅
- Tests:
always_zero rule_priority allon the grid input plus (1, C, 10), a C ofDS_1beside the C = D + E = 5 that the ruleset computes forId_11.- Manual:
Hierarchical roll-up:
rule_priority: “if an expected input Data Point exists in the computed output of such other Rule and its Measure is not null, then the current Rule takes such Data Point”;always_zero: “the result Data Point is produced in any case”;all: “union ( setdiff (op , R) , R )”.- Expected:
A = B + C takes the computed C for
Id_11, not the 10 ofDS_1(1 + 10 = 11), and the 20 ofDS_1for 2, as the computed C is null: R is (1, A) = 1 + 5 = 6, (1, C) = 2 + 3 = 5, (2, A) = 4 + 20 = 24, (2, C) = null + 5 = null, (3, A) = 0 + 0 = 0 and (3, C) = 0 + 0 = 0, as “in any case” coversId_13, where neither D nor E is found.alladds the other 7 data points ofDS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.
define hierarchical ruleset HR_1 ( variable rule Id_2 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 always_zero rule_priority all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 10 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | B | 4 |
| 2 | C | 20 |
| 2 | D | |
| 2 | E | 5 |
| 3 | B | 0 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | B | 1 |
| 1 | C | 5 |
| 1 | D | 2 |
| 1 | E | 3 |
| 2 | A | 24 |
| 2 | B | 4 |
| 2 | C | |
| 2 | D | |
| 2 | E | 5 |
| 3 | A | 0 |
| 3 | B | 0 |
| 3 | C | 0 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR condition C) 🟢 · number, hierarchical ruleset → any type
Rule only where the condition holds 🟢 pandas ✅ · DuckDB ✅
- Tests:
condition Id_1, the only clause written in the call, for a ruleset onId_2conditioned byId_1whose only rule,when Id_1 = 1 then C = D + E, holds for one of two groups.- Manual:
Hierarchical roll-up: on Variables condComp and ruleComp “can be specified all the same if it is desired to show explicitly in the invocation which are the involved Components: in this case, the condComp and ruleComp must be the same and in the same order as the Variables”, and in define hierarchical ruleset the left member Code Item “is evaluated only when the leftCondition is true”.
- Expected:
with the defaults
non_null,ruleandcomputed, only (1, C, 3): C = D + E = 1 + 2 whereId_1is 1, and the false condition ofId_12 gives no data point.
define hierarchical ruleset HR_1 ( variable condition Id_1 rule Id_2 ) is
when Id_1 = 1 then C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 condition Id_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | D | 1 |
| 1 | E | 2 |
| 2 | D | 3 |
| 2 | E | 4 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | C | 3 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
Overlapping rules that agree 🟢 pandas ✅ · DuckDB ✅
- Tests:
two rules for
A,when Id_1 <= 2 then A = B + Candwhen Id_1 >= 2 then A = B + C, whose conditions overlap atId_12: both compute (2, A) there, with the same value.- Manual:
define hierarchical ruleset: “if a left Code Item is calculated by means of more Rules […], there is the risk of producing erroneous results (e.g., duplicated data)”; the manual does not say what the result is.
- Expected:
with the defaults
non_null,ruleandcomputed, (1, A, 3) from the first rule alone, and (2, A, 30) once, as both rules compute 10 + 20 = 30.- Team decision:
#1193 chose option 3, “When every rule that applies to a data point computes the same value, return that data point once”, “as it follows the logic used already in older versions of the engine and it is the least prone to errors”. #1210 did it on both engines, comparing the measure and the viral attributes, and keeps 2-1-10-1 for rules that compute different values.
define hierarchical ruleset HR_1 ( variable condition Id_1 rule Id_2 ) is
when Id_1 <= 2 then A = B + C;
when Id_1 >= 2 then A = B + C
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 condition Id_1 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | C | 2 |
| 2 | B | 10 |
| 2 | C | 20 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 3 |
| 2 | A | 30 |
Files: script.vtl · input/DS_1.csv · input/DS_1.json · expected/DS_r.csv · expected/DS_r.json · example page ↗
hierarchy(DS, HR rule R) 🟢 · number, hierarchical ruleset → any type
Domain ruleset bound by rule 🟢 pandas ✅ · DuckDB ✅
- Tests:
a ruleset on the value domain
VD_1, the codes A to E, bound byrule Id_2to the identifier that takes its values.- Manual:
Hierarchical roll-up: “If hr is defined on Value Domains then it is mandatory to specify the condition (if any) and the rule parameters”, and ruleComp “is the Identifier of op to be associated to the rule Value Domain or Variable defined in hr”.
- Expected:
with the defaults
non_null,ruleandcomputed, (1, A, 6) and (1, C, 5): C = D + E = 2 + 3, and A = B + C takes the computed C, 1 + 5; the input data points are left out.
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
A = B + C
; C = D + E
end hierarchical ruleset;
DS_r := hierarchy ( DS_1, HR_1 rule Id_2 );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | B | 1 |
| 1 | D | 2 |
| 1 | E | 3 |
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 1 | A | 6 |
| 1 | C | 5 |
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 ↗