Hierarchical roll-up · hierarchy

🟢 38 of 38 forms all ok · VTL 2.2 Reference Manual ↗ · vtlengine 1.10.0rc3 (9e1c81a6) · pandas 2.3.3 · DuckDB 1.5.5
🟢 all ok🟡 partially implemented🛡️ refused with an error🔴 not implemented or crash🔵 engines differ ✅ match · ❌ wrong result · 🛡 guarded error (code) · 💥 crash · 📌 team decision
        ---
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

Viral attributes: combined with the propagation rules → Viral propagation

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
Clause operators (9) 🟢9
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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1C5
2A24

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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. all adds the 8 data points of DS_1, (2, C, 20) among them, as R has none of their identifiers.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1B1
1C5
1D2
1E3
2A24
2B4
2C20
2D
2E5
3B0

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_null with the default input rule and output computed, on the page’s nine rules over VD_1 and the viral At_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’s HR_1 verbatim and its rule for At_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 null first, then each value in alphabetic order; VD_1 has 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_1 Dx, Pz and Dx; each other rule has a missing or null item, so its value is null and it gives no data point.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1At_1
2010M2Dx
2010N5Pz
2010O4Pz
2010P7Pz
2010Q-7Pz
2010S3Ay
2010T9Bq
2010UNj
2010V6Ko
Expected DS_r
Id_1Id_2Me_1At_1
2010B11Dx
2010C0Pz
2010G11Dx

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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. all adds the 8 data points of DS_1, (2, C, 20) among them, as R has none of their identifiers.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2B4
2C20
2D
2E5
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24

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 computed on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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. all adds the 8 data points of DS_1, (2, C, 20) among them, as R has none of their identifiers.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C20
2D
2E5
3B0

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 all on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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. all adds the other 8 data points of DS_1, its (1, C, 10) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C20
2D
2E5
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 no involved data point is not zero, so no rule is evaluated.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A1
1C5
2A24
2C

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 no involved data point is not zero, so no rule is evaluated. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A1
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3B0

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_zero with the default input rule and output computed, on the page’s nine rules over VD_1 and the viral At_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’s HR_1 verbatim and its rule for At_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 null first, then each value in alphabetic order; VD_1 has 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_1 is null, as R is missing, and so are H’s and I’s; G’s Dx shows that G reads the C that non_zero does not return, as a missing C would bring a null.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1At_1
2010M2Dx
2010N5Pz
2010O4Pz
2010P7Pz
2010Q-7Pz
2010S3Ay
2010T9Bq
2010UNj
2010V6Ko
Expected DS_r
Id_1Id_2Me_1At_1
2010B11Dx
2010D3
2010EBq
2010G11Dx
2010H
2010I14

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3 no involved data point is not zero, so no rule is evaluated.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A
2C

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3 no involved data point is not zero, so no rule is evaluated. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A
2B4
2C
2D
2E5
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 no involved data point is not zero, so no rule is evaluated.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C

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 computed on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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; for Id_1 3 no involved data point is not zero, so no rule is evaluated.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 no involved data point is not zero, so no rule is evaluated. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3B0

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 all on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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; for Id_1 3 no involved data point is not zero, so no rule is evaluated. all adds the other 7 data points of DS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A
1C5
2A24
2C
3A

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A
3B0

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_null with the default input rule and output computed, on the page’s nine rules over VD_1 and the viral At_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’s HR_1 verbatim and its rule for At_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 null first, then each value in alphabetic order; VD_1 has 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_1 as 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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1At_1
2010M2Dx
2010N5Pz
2010O4Pz
2010P7Pz
2010Q-7Pz
2010S3Ay
2010T9Bq
2010UNj
2010V6Ko
Expected DS_r
Id_1Id_2Me_1At_1
2010B11Dx
2010C0Pz
2010D
2010EBq
2010G11Dx
2010H
2010I

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A
2C
3A

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A
2B4
2C
2D
2E5
3A
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A

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 computed on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A
3B0

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 all on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A1
1C5
2A24
2C
3A0

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A1
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A0
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A
2C
3A0

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A
2B4
2C
2D
2E5
3A0
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A0

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 computed on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A0

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A0
3B0

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 all on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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; for Id_1 3 C = D + E finds neither D nor E, so it gives nothing. all adds the other 7 data points of DS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A0
3B0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A
1C5
2A24
2C
3A
3C

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A
3B0
3C

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A
2C
3A
3C

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A
2B4
2C
2D
2E5
3A
3B0
3C

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A
3C

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 computed on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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” covers Id_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A
3C

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A
3B0
3C

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 all on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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” covers Id_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A
3B0
3C

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A1
1C5
2A24
2C
3A0
3C0

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A1
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A0
3B0
3C0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A
2C
3A0
3C0

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A
2B4
2C
2D
2E5
3A0
3B0
3C0

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 computed on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A0
3C0

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 computed on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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” covers Id_1 3, where neither D nor E is found.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1C5
2A24
2C
3A0
3C0

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 all on the grid input, A = B + C; C = D + E on Id_2: Id_1 1 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” covers Id_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (2, C, 20) giving way to the computed one.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A0
3B0
3C0

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 all on the grid input plus (1, C, 10), a C of DS_1 beside the C = D + E = 5 that the ruleset computes for Id_1 1.

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_1 1, not the 10 of DS_1 (1 + 10 = 11), and the 20 of DS_1 for 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” covers Id_1 3, where neither D nor E is found. all adds the other 7 data points of DS_1, its (1, C, 10) and (2, C, 20) giving way to the computed ones.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C10
1D2
1E3
2B4
2C20
2D
2E5
3B0
Expected DS_r
Id_1Id_2Me_1
1A6
1B1
1C5
1D2
1E3
2A24
2B4
2C
2D
2E5
3A0
3B0
3C0

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 on Id_2 conditioned by Id_1 whose 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, rule and computed, only (1, C, 3): C = D + E = 1 + 2 where Id_1 is 1, and the false condition of Id_1 2 gives no data point.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1D1
1E2
2D3
2E4
Expected DS_r
Id_1Id_2Me_1
1C3

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 + C and when Id_1 >= 2 then A = B + C, whose conditions overlap at Id_1 2: 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, rule and computed, (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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1C2
2B10
2C20
Expected DS_r
Id_1Id_2Me_1
1A3
2A30

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 by rule Id_2 to 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, rule and computed, (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.

script.vtl
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 );
Input DS_1
Id_1Id_2Me_1
1B1
1D2
1E3
Expected DS_r
Id_1Id_2Me_1
1A6
1C5

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 ↗