O'Reilly logo

Learning Neo4j 3.x - Second Edition by Rik Van Bruggen, Jérôme Baton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Read data

Assuming that you have tried all the previous queries, you have several homonyms in your base:

MATCH (n:Person) WHERE n.name="Juliet" or n.firstName="Juliet" RETURN n;

The important keywords are MATCH and RETURN. This queries the database for nodes with the Person label; we also see a condition on the name property.

Another, richer example of the READ query is as follows:

MATCH (n:Person)-[:LOVES]-()WHERE toLower(n.name)="juliet"RETURN n ORDER BY n.age ASCSKIP 2 LIMIT 5 ;

Here, we modified the condition with a conversion to lowercase in the condition; there is a sort occurring on the age (from lowest to highest) and nodes without an age property will be at the end of the list. SKIP and LIMIT are used to paginate the results.

Note ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required