Skip to content

Instantly share code, notes, and snippets.

@cboulanger
Created October 18, 2023 15:53
Show Gist options
  • Save cboulanger/d95d75c489bdd76225e07ae1ae99085a to your computer and use it in GitHub Desktop.
Save cboulanger/d95d75c489bdd76225e07ae1ae99085a to your computer and use it in GitHub Desktop.
Neo4J Text-only equivalent for CALL db.schema.visualization()
// written with the help of ChatGPT4
MATCH (n)-[r]->(m)
WITH DISTINCT labels(n) AS ln, type(r) AS rt, labels(m) AS lm
WITH "(" + apoc.text.join(ln, ":") + ")-[:" + rt + "]->(" + apoc.text.join(lm, ":") + ")" AS CypherPathExpression
RETURN apoc.text.join(COLLECT(CypherPathExpression), '\n') AS GraphDataModel
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment