Hello everyone I believe I have a simple problem but I can’t seem to solve it. I am using Graphql with Neo4j. I want to simply count relationships and put that capability in my graphql schema using the “CALL graphql.idl()” procedure and the “@cypher”directive,my code is as follows
CALL graphql.idl(
"
type User{
userSocialFollowsCount:@cypher(statement:”MATCH (u:User)-[:FOLLOWS_ON_SOCIALS]->(o:User) WITH u,count(o) as rels WHERE rels > 1 RETURN rels”)
}
"
)
``
Iv also tried this example from the internet
CALL graphql.idl("
type User{
degree: Int @cypher(statement: "RETURN SIZE((this)-->())")
}
"
)
I am getting a syntax error in the Neo4j browser but I don’t understand where exactly the problem is.. I want to update my schema to be able to count relationships using the procedure.
I having installed the FULL APOC manually to the Graphene Database & they have confirmed it is installed okay ... I checked the version & it is compatible with the instance
What am I doing wrong? How do you use the @cypher directive in a graphql schema with the “CALL graphql.idl()” procedure to update the schema? I want to do it automatically using the procedure but I seem to be missing something.. thanks 🙏
graphql.idl(“
type User {
followsCount:Int @cypher (
statement: "MATCH (this)<-[r:FOLLOWS_ON_SOCIALS]-(:User) with this, count(r) as rel_cnt return rel_cnt"
)
}
“)
when I run CALL graphql.schema() I get a schema and the schema generation command CALL graphql.idl() runs when I omit the field with the "@cypher" directive on the relevant Node type
You might try it the way that the project is set up on the GRANDstack example and have it in a schema.graphql file. It seems that the graphql.idl isn't playing well with Neo4j.
thanks but I am using the plugin on desktop and I think thats a Java/kotlin kind of set up... its just not working the graphql plugin on desktop with cypher