Documentation Index
Fetch the complete documentation index at: https://gql.ch/llms.txt
Use this file to discover all available pages before exploring further.
FOR statement unnests a list into individual records by iterating over its elements, allowing subsequent statements to process these elements one by one.
Using FOR statement to iterate over each edge in a Quantified Path Pattern
Suppose we are interested in the all the hops required to go from Bayreuth to Santiago:
We can use the FOR loop as following
match paths = any shortest (a:city {_id:'Bayreuth'})-[edges:train|flight]->{1,}(b:city {_id:'Santiago'})
for edge in edges
return distinct table(edge._from, edge._to, labels(edge), pnodeIds(paths), length(paths));
We are using the FOR statement to unnest (decompose) the edges.