Book Image

Building web applications with Python and Neo4j

By : Sumit Gupta
Book Image

Building web applications with Python and Neo4j

By: Sumit Gupta

Overview of this book

Table of Contents (14 chapters)
Building Web Applications with Python and Neo4j
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Pattern and pattern matching


Pattern and pattern matching are the heart of Cypher. They describe the shape of the data that we want to search, create, or update within the provided graph. It is imperative to understand pattern and pattern matching as a concept with reference to Cypher, so that you can write effective and efficient queries. Before moving forward, let's create a small dataset, and then let's see how patterns are applied or constructed for various elements of graphs.

Sample dataset

In this section, we will create a small dataset for a social network, which will help us in understanding and executing various examples provided further in this section.

Perform the following steps to create a sample dataset:

  1. Open your console or shell and then start your Neo4j server by executing <$NEO4J_HOME>/bin/neo4j on the console.

  2. On the same console, execute <$NEO4J_HOME>/bin/neo4j-shell.

  3. Now, execute the following set of statements to clean up your database:

    MATCH (n)-[r]-(n1) delete...