neo4j-graphql-java
neo4j-graphql-java copied to clipboard
add ability to transform graphql statements before transpiling
E.g. given
type Order {
firstName: String!
lastName: String!
name: String
}
and (coming from an external client)
mutation {
addOrder(firstName: "John", lastName:"Doe") {
name
}
}
it would be great if there is a way to store the data in neo4j like
(o:Order)--(a:Address {firstName: "John", lastName: "Doe"})
There should also be a possibility to post process the returned data before sending it back to the external client
val name = "$firstName $lastName"
The pre and post processing should be possible in your code using the transpiler.
Preprocessing via graphql java apis Ie parse/modify/generate.
We could add another method that takes the ast.
Postprocessing by walking over the bolt results
You can achieve the post processing with the following schema:
type Order {
firstName: String!
lastName: String!
name: String @cypher(statement:"WITH (this) RETURN this.firstName + ' ' + this.lastName")
}
The Query:
{order{name}}
will result in the following cypher:
MATCH (order:`Order`) RETURN order { name:apoc.cypher.runFirstColumnSingle('WITH $this AS this WITH (this) RETURN this.firstName + \' \' + this.lastName', { this:order }) } AS order