The value query expression allows you to specify a scalar value derived from a nested query specification. The output of this expression is expected to be either a single value or null.
Syntax<value query expression> ::= "VALUE {" <query> "}"
Details
<query> is executed as a complete query and must end with a RETURN that projects exactly one return item (a single column). Returning more than one column raises an error.null.avg(), count()) or add an explicit LIMIT 1 to the body.
GQLINSERT (p1:Paper {_id:'P1', title:'Efficient Graph Search', score:6}), (p2:Paper {_id:'P2', title:'Optimizing Queries', score:9}), (p3:Paper {_id:'P3', title:'Path Patterns', score:7}), (p1)-[:Cites]->(p2), (p2)-[:Cites]->(p3)
GQLLET avgScore = VALUE {MATCH (n) RETURN avg(n.score)} MATCH (n) WHERE n.score > avgScore RETURN n.title
Result:
| n.title |
|---|
| Optimizing Queries |