I’m trying to create a report using the query language from this (simplified) model [1]:
root {
...
'Partijen': collection ['Partij']
'Bron': acyclic-graph
{
'Partij': text
'Soort partij': stategroup (
'Stampartij' { ... }
'Deelpartij' {
'Stampartij': text -> -> ( recurse ^ 'Bron' ) ^ sibling in ('Bron') .'Soort partij'?'Stampartij' = ( recurse ^ 'Bron' ) switch >'Bronpartij'.'Soort partij' (
|'Stampartij' as $'stam' => $'stam'
|'Deelpartij' as $'deel' => $'deel'>'Stampartij'
)
}
)
...
}
'Soort partij': stategroup
= switch .'Partijen'* .'Soort partij'?'Stampartij' ( // [1] ; ?'Deelpartij' ( // [2]
| nodes => 'Stampartij' ( ) // [1] ; => 'Deelpartij' ( ) // [2]
| none => 'Deelpartij' ( ) // [1] ; => 'Stampartij' ( ) // [2]
) @hidden (
'Stampartij' {
'Partijen': collection ['Partij'] = ^ .'Partijen'* .'Soort partij'?'Stampartij'
{
'Partij': text -> ^ ^ .'Partijen'[] .'Soort partij'?'Stampartij' = key
}
}
'Deelpartij' {
'Partijen': collection ['Partij'] = ^ .'Partijen'* .'Soort partij'?'Stampartij'
{
'Partij': text -> ^ ^ .'Partijen'[] .'Soort partij'?'Stampartij' = key
}
}
)
}
The derived stategroup is required (in my case) for using the query type graph (query language). The file for this report looks like this [1]:
graph: ?'Soort partij'|'Stampartij' // [1] ; |'Deelpartij' // [2]
from .'Partijen' >'Partij'
flatten 'Bron'
from
select
...
The goal of the report is to show how each Stampartij is divided into several Deelpartijen, possibly on several levels (each Deelpartij can again be divided into several Deelpartijen).
However, this particular report file [1] only shows the Stampartijen. Then I changed the model [2] and report file [2] to collect and show the Deelpartijen.
This report shows all Deelpartijen with its Stampartij and potentially its Deelpartij, so in ‘reversed order’.
My conclusion is that I would like to traverse the acyclic graph ‘backwards’, starting with Stampartijen (sink of Bron) and showing its Deelpartijen (source of Bron).
How can I achieve this? And is this even possible?