Book Image

Learning Cypher

By : Onofrio Panzarino
Book Image

Learning Cypher

By: Onofrio Panzarino

Overview of this book

Table of Contents (13 chapters)

Filtering


Pattern matching is useful to describe the data we are looking for and how nodes and relations are organized in the graph database. However, we often need to filter data in more detail.

The book store – an example

In this chapter, we'll learn how to filter results using a real-world example: the book store. Just as we saw in the previous chapter, we have to define labels and relationships. A minimal set of labels are as follows:

  • Book: This label includes all the books

  • Person: This label includes authors, translators, reviewers, and so on

  • Publisher: This label includes the publishers of books in the database

  • User: This label includes the users of the website

A set of basic relationships are as follows:

  • PublishedBy: This relationship is used to specify that a book was published by a publisher

  • Votes: This relationship describes the relation between a user and a book, for example, how a book was rated by a user

Every book has the following properties:

  • Title: This is the title of the book...