Database Reference
In-Depth Information
Creating a sample dataset - movie dataset
Let's perform the following steps to clean up our Neo4j database and insert some data
which will help us in exploring various constructs of Cypher queries:
1. Open your Command Prompt or Linux shell and open the Neo4j shell by typing
<$NEO4J_HOME>/bin/neo4j-shell .
2. Execute the following commands on your Neo4j shell for cleaning all the previous
data:
//Delete all relationships between Nodes
MATCH ()-[r]-() delete r;
//Delete all Nodes
MATCH (n) delete n;
3. Now we will create a sample dataset, which will contain movies, artists, directors,
and their associations. Execute the following set of Cypher queries in your Neo4j
shell to create the list of movies:
CREATE (:Movie {Title : 'Rocky', Year :
'1976'}); 

 CREATE (:Movie {Title : 'Rocky II', Year :
'1979'});
CREATE (:Movie {Title : 'Rocky III', Year : '1982'});
CREATE (:Movie {Title : 'Rocky IV', Year : '1985'});
CREATE (:Movie {Title : 'Rocky V', Year : '1990'});
CREATE (:Movie {Title : 'The Expendables', Year :
'2010'});
CREATE (:Movie {Title : 'The Expendables II', Year :
'2012'});
CREATE (:Movie {Title : 'The Karate Kid', Year :
'1984'});
CREATE (:Movie {Title : 'The Karate Kid II', Year :
'1986'});
4. Execute the following set of Cypher queries in your Neo4j shell to create the list of
artists:
CREATE (:Artist {Name : 'Sylvester Stallone', WorkedAs
: ["Acto
r", "Director"]});
Search WWH ::




Custom Search