cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Neo4j browser output on multi statement query

Hello,

In Neo4j browser the following mutli statement succeeds, but doesn't show any output, neither in graph or table form

CREATE (a)
CREATE (b)
CREATE (a)-[:KNOWS]->(b);
MATCH (n) RETURN n

Obviously executing the last line separately show the expected two node graph.

Is there way that output could be created from a multi statement query? For demo purposes I want to store a big multi statement as a favourite and then execute it live with a big reveal at the end.

Thanks

1 ACCEPTED SOLUTION

Thanks Dana, That is a useful workaround. Not sure if it would work for all my scenarios, but i will use it where i can. Cees

View solution in original post

2 REPLIES 2

via the browser if you run :play movies which shows how to populate the movies graph, the 2nd slide of the carousel is similar to yours in that it performs many CREATE statements and then at the end it includes a

WITH TomH as a
MATCH (a)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d) RETURN a,m,d LIMIT 10

so you could do similar such that your original statement is changed to

CREATE (a)
CREATE (b)
CREATE (a)-[:KNOWS]->(b) with a.b
MATCH (a)-[:KNOWS]-(b) RETURN a,b

note hopefully this is just an example but generally speaking when creating nodes you should include a label, for example create (a:Person) ..... so that subsequent queries can reference :Person nodes rather than all nodes

Thanks Dana, That is a useful workaround. Not sure if it would work for all my scenarios, but i will use it where i can. Cees