CALL procedures
GQL provides an inline procedure and a named procedure. Both procedures are invoked by the CALL keyword.
Inline procedures
GQL inline procedures are query blocks that can be called in another query.
They are particularly useful for handling complex data processes that cannot be managed with a simple linear query.
Example: Using CALL to count grouped neighbors
To determine the number of neighbors for each node, an aggregate function can be used.
For example, to calculate the number of neighbors for each node from the graph in Figure 7.5, use the following:
GQL:
MATCH (start)
MATCH (start)-(end)
RETURN start._id as startNode, COUNT(end) as total
GROUP BY startNode
The query returns each startNode and its total number of neighbors:
|
startNode |
total |
|
|
|