openCypher
openCypher copied to clipboard
Scalar Subqueries and List Subqueries
There is still some work to be done here, but comments are welcome.
Ideas for examples to include in the document:
- [x] Sorting lists
- [x] Filtering lists
- [x] Unpacking a singleton list
Just realized... using round parenthesis for scalar subqueries seems not well aligned with EXISTS {}
which also returns a single value... in a way.. Not sure how to solve this given that we overloaded exists(n.prop)
This seems like a very powerful feature and I'd love to see it added. In particular I think this would give a massive boost to the GraphQL->Cypher use case seen the in Neo4j-GraphQL tools. It's been two years without much conversation, but what would it take to get this moving again?
@a-type indeed this was first conceived of when we did a comparative analysis of Cypher and GraphQL in 2015. What is primarily needed for this to move forward is an openCypher implementor with a desire to get this into their product. In terms of actual work, the next step in terms of actual work on this proposal is to start designing TCK test cases to guide an implementation.
I believe that if we disallowed the SingleValuePatternQuery
form from ScalarSubquery
- which has the effect of a ScalarSubquery
always starting with a keyword - we could do away with the SCALAR
keyword as a prefix for ScalarSubquery
with only a single parser lookahead.
I think that would be nicer.
Does this enable sorting, filtering and using aggregate functions in Map Projections, as mentioned in this blog post?
Would be awesome if neo4j could be queried like this!
Yes, that's the goal of this proposal which I expect to also become a part of GQL. It may happen eventually in Neo4j but note this repository is about language design primarily, not implementation by vendors.