48

How can I show all nodes and relationships in Data Browser tab?

What are sample index queries that I can type in in search field?

7 Answers 7

55

You may also want to try a cypher query such as:

START n=node(*) RETURN n;

It's very obvious, and it will return all the existing nodes in the database.

EDIT : the following displays the nodes and the relationships :

START n=node(*) MATCH (n)-[r]->(m) RETURN n,r,m;
4
  • 7
    it only return node,adding match n-[r]-() and return n,r to see further relationship
    – Huei Tan
    Jan 3, 2013 at 15:56
  • Completely forgot about the relationships! Apr 16, 2013 at 3:11
  • With version 1.9.5 (I MUST use that) it returns the nodes, but it does NOT show them...
    – tonjo
    Jan 10, 2015 at 12:14
  • 3
    Just to note this only matches nodes that have a relationship. If you want all use START n=node(*) MATCH (n)-[r]->(m),(o) RETURN n,r,m,o;
    – geotheory
    Oct 28, 2017 at 22:26
41

More simple way is

MATCH (n) RETURN (n)
1
  • 2
    This is the proper way to produce all nodes and then the Data Browser Tab will magically add the relationships to the view.
    – The Demz
    Sep 26, 2019 at 9:08
18
MATCH (n) OPTIONAL MATCH (n)-[r]-() RETURN n, r;
10

You can show everything with simple MATCH (n) RETURN n, as offical documentation suggests.

START n=node(*) RETURN n from Neo4j 2.0 is deprecated:

The START clause should only be used when accessing legacy indexes (see Chapter 34, Legacy Indexing). In all other cases, use MATCH instead (see Section 10.1, “Match”).

9

There is a little help icon beside the search field, if you hoover over it it shows the syntax.

If a property of your nodes and relationships is indexed you can search for all of them like this.

node:index:indexname:fieldname:*
rels:index:indexname:fieldname:*
5

I found that this worked, retrieving all nodes including orphans, and all relationships:

MATCH (n) MATCH ()-[r]->() RETURN n, r
1
  • 2
    As far as I can tell, that is a horrible query, since you don't include the match n node in the second match. It would probably end up with a Cartesian product returns A LOT of redundant data. Might I suggest: cypher MATCH (n) OPTIONAL MATCH (n)-[r]-(m) RETURN n,r,m
    – larsw
    Oct 27, 2017 at 8:27
1

Other good way for get ALL nodes (and nodes without relationship) :

MATCH (n) RETURN n UNION START n = rel(*) return n;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.