openCypher icon indicating copy to clipboard operation
openCypher copied to clipboard

Scalar Subqueries and List Subqueries

Open thobe opened this issue 7 years ago • 7 comments

Solves #177.

CIP2017-03-29

thobe avatar Apr 13 '17 13:04 thobe

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

thobe avatar Apr 13 '17 13:04 thobe

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)

boggle avatar May 01 '17 21:05 boggle

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 avatar Jun 01 '19 14:06 a-type

@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.

thobe avatar Jun 28 '19 09:06 thobe

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.

thobe avatar Jun 28 '19 10:06 thobe

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!

SpaghettiFactory avatar May 27 '20 15:05 SpaghettiFactory

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.

boggle avatar May 30 '20 08:05 boggle