Here it is the statement and the type definitions that I am using :
type Establecimiento {
nombre: String!
punto: Point!
}
type TipoEstablecimiento {
tipo: String!
numero_establecimientos: Int!
establecimientos: [Establecimiento!]!
}
type Seccion_Censal @node {
codigo_seccion: String!,
geometry: String,
seccion: String,
tipos_establecimientos: [TipoEstablecimiento!]! @cypher(
statement: """
MATCH (s:Seccion_Censal{codigo_seccion:'03008'})
CALL spatial.intersects('map', s.geometry) YIELD node AS nodo
MATCH (nodo)<-[:GEOM]-(o:OSMWay)-[:TAGS]-(t:OSMTags)
MATCH (o)-[:FIRST_NODE]->(:OSMWayNode)-[:NODE]-(n:OSMNode)
WHERE (t.name IS NOT NULL) AND (t.amenity IS NOT NULL OR t.leisure IS NOT NULL)
WITH DISTINCT t, t.amenity AS amenity, t.leisure AS leisure, n
WITH CASE
WHEN t.amenity IS NULL THEN t.leisure
ELSE t.amenity
END AS tipo, COLLECT({nombre: t.name, punto: n.location}) AS establecimientos
WITH tipo, COUNT(tipo) AS numero_establecimientos, establecimientos
RETURN {
tipo: tipo,
numero_establecimientos: numero_establecimientos,
establecimientos: establecimientos
} AS tipos_establecimientos
""",
columnName: "tipos_establecimientos"
)
}
The GraphQL Library doesn't support configuration of this - in the context of a query the Cypher is executed in read mode, and in the context of mutations the Cypher is executed in write mode.
This is my main question - why does this procedure require write permissions? This is a Neo4j Labs project which by the looks of it isn't even supported by Neo4j 5 (but I could be wrong), and the GraphQL Library is moving to not support Neo4j 4 soon anyway.
As per my above answer, this is dependent on the query which is being executed.