-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
I tried the cypher antlr grammar:
It seems the grammar is outdated and does not consider subqueries. It fails to parse the following queries, e.g.:
UNWIND [0, 1, 2] AS x
CALL {
RETURN 'hello' AS innerReturn
}
RETURN innerReturn
(from https://neo4j.com/docs/cypher-manual/current/clauses/call-subquery/ )
as well as
MATCH (person:Person)
WHERE EXISTS {
(person)-[:HAS_DOG]->(:Dog)
}
RETURN person.name AS name
and
MATCH (person:Person)
WHERE EXISTS {
MATCH (person)-[:HAS_DOG]->(dog:Dog)
WHERE person.name = dog.name
}
RETURN person.name AS name
(from https://neo4j.com/docs/cypher-manual/current/syntax/expressions/#existential-subquery-simple-case )
Suggestion:
Include subqueryclauses like this
subqueryClause : CALL SP? '{' SP? query? SP? '}' ;
and add the exists sub query to the expressions:
expression : orExpression | existsSubQuery;
existsSubQuery : EXISTS SP? existsSubQueryBody;
existsSubQueryBody: subquery | subqueryPatternBody ;
subqueryPatternBody: '{' SP? pattern ( hint )* ( SP? where )? SP? '}' ;
Note that I am not a cypher expert so the above may be wrong or incomplete.
Metadata
Metadata
Assignees
Labels
No labels