Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-08-2022 03:07 PM
First time posting, and probably in way over my head. Kudos to the team that put the GraphQL and Neo4j code together. You made it easy for me to dive deep and quickly, and therefore over my head. I want to surface the relationship types and node labels in the graph. I found this in a Google Vertex example, and it works as expected in the Neo4j browser, but when I try the same code in a cypher statement, I don't get any records. I am using the same credentials to access the Aura database:
// Works as expected in Neo4j Browser
CALL db.relationshipTypes() YIELD relationshipType as type
CALL apoc.cypher.run('MATCH ()-[:'+type+']->() RETURN count(*) as freq', {})
YIELD value
RETURN type AS relationshipType, value.freq AS freq
ORDER by freq DESC
// Does not work as expected as a @cypher statement
@cypher(
statement: """
CALL db.relationshipTypes() YIELD relationshipType as type
CALL apoc.cypher.run('MATCH ()-[:'+type+']->() RETURN count(*) as freq', {})
YIELD value
RETURN type AS relationshipType, value.freq AS freq
ORDER by freq DESC
"""
)
// DEBUG output of cypher statement
@neo4j/graphql:execute About to execute Cypher:
Cypher:
MATCH (this:`relationshipTypes`)
CALL {
WITH this
UNWIND apoc.cypher.runFirstColumnMany("CALL db.relationshipTypes() YIELD relationshipType as type
CALL apoc.cypher.run('MATCH ()-[:'+type+']->() RETURN count(*) as freq', {})
YIELD value
RETURN type AS relationshipType, value.freq AS freq
ORDER by freq DESC", { this: this, auth: $auth }) AS this_type
RETURN collect(this_type { .name, .frequency }) AS this_type
}
RETURN this { type: this_type } AS this
Params:
{
"auth": {
"isAuthenticated": false,
"roles": []
}
} +214ms
@neo4j/graphql:execute Execute successful, received 0 records +0ms
All the sessions of the conference are now available online