← check_hierarchy operator page · validation/check_hierarchy/rule/manual_ex_1
pandas ✅ · DuckDB ✅
the manual's HR_1, eleven rules on VD_1, "the 26 uppercase letters of the English language", with rule Id_2 partial_null all.
Check hierarchy, Example 1, with the erratum below: partial_null produces a data point "if at least one Data Point ... of the rule is found (whichever is its Measure value)"; R080, with H found but null, follows this, not the mode table's "If at least the involved Data Points is not null".
the error 1-3-2-3, "At op {op}: Vtl Script contains Cycles, no DAG established. Nodes involved: {nodes}": R020 B = M + N + O, R070 G = B + C and R110 M <= G form a cycle, as a rule with <= or >= links its items as = does (team decision). The manual's example is to be fixed.
define hierarchical ruleset HR_1 ( valuedomain rule VD_1 ) is
R010 : A = J + K + L errorlevel 5
; R020 : B = M + N + O errorlevel 5
; R030 : C = P + Q errorcode "XX" errorlevel 5
; R040 : D = R + S errorlevel 1
; R050 : E = T + U + V errorlevel 0
; R060 : F = Y + W + Z errorlevel 7
; R070 : G = B + C
; R080 : H = D + E errorlevel 0
; R090 : I = D + G errorcode "YY" errorlevel 0
; R100 : M >= N errorlevel 5
; R110 : M <= G errorlevel 5
end hierarchical ruleset;
DS_r := check_hierarchy ( DS_1, HR_1 rule Id_2 partial_null all );
| Id_1 | Id_2 | Me_1 |
|---|---|---|
| 2010 | A | 5 |
| 2010 | B | 11 |
| 2010 | C | 0 |
| 2010 | G | 19 |
| 2010 | H | |
| 2010 | I | 14 |
| 2010 | M | 2 |
| 2010 | N | 5 |
| 2010 | O | 4 |
| 2010 | P | 7 |
| 2010 | Q | -7 |
| 2010 | S | 3 |
| 2010 | T | 9 |
| 2010 | U | |
| 2010 | V | 6 |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "Integer", "role": "Measure", "nullable": true}
]
}
]
}
{"code": "1-3-2-3"}
{
"name": "VD_1",
"setlist": [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z"
],
"type": "String"
}