Boolean operators with Cypher

Cypher supports the Boolean operators AND, OR, NOT, and XOR, which are very useful to describe more than one condition to be checked simultaneously. In this recipe, we will learn their uses within the graph we have created.

Getting ready

To step through this recipe, you will need to create the nodes and relationships for which data has been provided with the code files.

How to do it...

We have divided this recipe into the following problem sets:

  • The Boolean operator AND with Cypher: Let's get all the flights that originate from any airport in Atlanta city that are destined for Dallas/Fort Worth:
    MATCH (o)<-[:`ORIGIN`]-(f)-[:`DESTINATION`]->(d) where o.city = "Atlanta" AND d.city = "Dallas/Fort Worth" return o,f,d

    The following ...

Get Neo4j Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.