A write and a read
A statement is Cypher on every store unless it says otherwise, so a plain string runs on Postgres, Oracle and SQLite
as it runs on a graph engine: compiled to the store’s SQL. A CypherStatement, as below, says so explicitly, and is
Cypher whatever the connection’s default. SQL of your own is marked with sqlStatement(...) (a SqlStatement), and
runs as it is:
manager.query(QuerySpecification.withStatement("MATCH (p:Person) RETURN p.name")) // Cypher, compiledmanager.query(QuerySpecification.withStatement(sqlStatement("SELECT COUNT(*) FROM graph_node"))) // SQL, as it isA datasource whose statements are mostly SQL can make SQL its default instead: defaultLanguage = QueryLanguage.SQL in
its ConnectionProperties, defaultLanguage(QueryLanguage.SQL) on a ConnectionProviderBuilder, or
database.datasources.<name>.default-language: SQL with the Spring Boot starter. A plain string is then SQL on it, and a
CypherStatement is still compiled. A graph engine runs no SQL, so SQL as the default of a Neo4j, FalkorDB, Memgraph,
Neptune or Embabel datasource is refused as its provider is built. Before 0.9.0 a plain string was SQL on Postgres,
Oracle and SQLite, and Cypher on the graph engines: see Cypher by default to migrate.
data class Person(val name: String, val city: String)
manager.execute( QuerySpecification .withStatement(CypherStatement( "MERGE (p:Person {name: \$name}) SET p.city = \$city " + "MERGE (c:City {name: \$city}) " + "MERGE (p)-[:LIVES_IN]->(c)" )) .bind(mapOf("name" to "Ada", "city" to "London")))
val londoners: List<Person> = manager.query( QuerySpecification .withStatement(CypherStatement( "MATCH (p:Person)-[:LIVES_IN]->(:City {name: \$city}) " + "RETURN properties(p) AS person ORDER BY person.name" )) .bind(mapOf("city" to "London")) .transform(Person::class.java)) // [Person(name=Ada, city=London)]The write is applied whole or not at all on each SQL store. The same read from Java:
List<Person> londoners = manager.query( QuerySpecification .withStatement(new CypherStatement( "MATCH (p:Person)-[:LIVES_IN]->(:City {name: $city}) " + "RETURN properties(p) AS person ORDER BY person.name")) .bind(Map.of("city", "London")) .transform(Person.class));Return one map or one value, as RETURN Clause Best Practices says: a
RETURN of several items gives a list of them for each row.

