0

I'm able to run a series of queries successfully using Cypher-shell in Neo4j. For example I have put my queries inside a file called "cypher.ex1":

LOAD CSV WITH HEADERS FROM 'file:///names.csv' AS row
WITH row.Fname AS first, row.Lname AS last
MERGE (p:la {last: last})
MERGE (o:fi {first: first})
MERGE (c:central {name: "central node"})
MERGE (c)-[r:CONTAINS {first:first}]->(o)-[rel:CONTAINS {first: first}]->(p)
RETURN count(o);

and execute it using:

neo4j@neo4j> :source cypher.ex1

The problem is that when I want to display the created nodes and relationships, I execute another file containing:

MATCH (c:central)-[r:CONTAINS]->(o:fi)-[rel:CONTAINS]->(p:la)
RETURN c, r, o, rel, p

using this command:

neo4j@neo4j> :source cypher.ex2

I see the result written in plain text in cypher-shell window. I wanted to know whether there is a way to display the results in the Neo4j browser as well. I mean upon executing the second cypher script (cypher.ex2), the result should be automatically shown in the neo4j browser as a graph.

Instead of manually inserting query in Neo4j browser such as:

MATCH (n) RETURN n

to view the created nodes or graph, I want the queries that I have executed through Cypher-shell automatically become visible as a visual graph in the Neo4j browser. Is it possible? Is there any way to do this using Cypher-shell?

Pablo
  • 465
  • 1
  • 4
  • 14

1 Answers1

0

Take a look at https://neo4j.com/labs/apoc/4.1/cypher-execution/run-cypher-scripts/

These procedures can be used to run files that are usually run by cypher-shell.

Jerome_B
  • 1,079
  • 8
  • 15