2
votes

How to export including relationships? I've found that executing the default query

MATCH (n) RETURN n

Does return what I need graphically including the relationships between nodes (AUTO-COMPLETE switched on). I see my nodes and their relationship.

But when I save it either CVS or JSON it does not includes the relationships. Any idea how can I do it?

1

1 Answers

3
votes

This is how you'd get all the nodes and their outgoing relationships, if any.

MATCH (n)
OPTIONAL MATCH (n)-[r]->()
RETURN n, r;

Each relationship will tell you what its start and end nodes are, so you can get the end node's ID from it.

If you want to get the end node returned as well:

MATCH (n)
OPTIONAL MATCH (n)-[r]->(m)
RETURN n, r, m;