On the Semantics of Cypher's Implicit Group-by
Cypher is a declarative query language for the property graph model, created by Neo Technology for its graph database Neo4j and opened up through the openCypher initiative in 2015. Despite having been adopted by several graph database vendors, Cypher lacks a comprehensive semantics other than the reference implementation. This paper stems from Cypher.PL, a project aimed at creating an executable (and readable) semantics of Cypher in Prolog, and focuses on Cypher’s implicit group-by feature. Rather than being explicitly specified in the query, in Cypher the grouping key is derived from the return expressions. We show how this becomes problematic when a single return expression mixes unaggregated property references and aggregating functions, and discuss ways of giving this construct a proper semantics without defying common sense.