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

Creating nodes and relationships


In this section, we will discuss the various syntactical details for creating nodes and relationships using Cypher.

Nodes and relationships are the two most important elements of Neo4j graph databases. They are created using the CREATE clause of Cypher. Let us move forward and understand the process of creating nodes and relationships using Cypher.

Working with nodes

Node is one of the core elements of Neo4j database. Every other element of Neo4j is either connected to nodes or is used to enhance the definition/description of a node. Let us delete the existing data, which we created in the previous chapter from our Neo4j database, and then see the step-by-step process of creating nodes.

Perform the following steps to clean up your Neo4j database:

  1. Open your Linux console or shell and execute <$NEO4J_HOME>/bin/neo4j-shell.

  2. Execute the following Cypher queries to delete the data from the Neo4j database:

    MATCH (n)-[r]-(n1) delete r,n.n1;
    MATCH n delete n;
  3. And we...