Created
November 26, 2015 15:33
-
-
Save anztrax/8fbd504092da02ea0b2a to your computer and use it in GitHub Desktop.
Movie Demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= Movie Demo | |
== Domain | |
This text is kept for Domain text | |
== Setup | |
The Sample data which creates Actors, Movies and their relationships | |
//hide | |
//setup | |
//output | |
[source,cypher] | |
---- | |
CREATE (:Movie {Title : 'Rocky', Year : '1976'}); //Movie-1; | |
CREATE (:Movie {Title : 'Rocky II', Year : '1979'}); //Movie-2; | |
CREATE (:Movie {Title : 'Rocky III', Year : '1982'}); //Movie-3; | |
CREATE (:Movie {Title : 'Rocky IV', Year : '1985'}); //Movie-4; | |
CREATE (:Movie {Title : 'Rocky V', Year : '1990'}); //Movie-5; | |
CREATE (:Movie {Title : 'The Expendables', Year : '2010'}); //Movie-6; | |
CREATE (:Movie {Title : 'The Expendables II', Year : '2012'}); //Movie-7; | |
CREATE (:Movie {Title : 'The Karate Kid', Year : '1984'}); //Movie-8; | |
CREATE (:Movie {Title : 'The Karate Kid II', Year : '1986'}); //Movie-9; | |
//Artist | |
CREATE (:Artist {Name : 'Sylvester Stallone', WorkedAs : ["Actor", "Director"]}); //Artist-1; | |
CREATE (:Artist {Name : 'John G. Avildsen', WorkedAs : ["Director"]}); //Artist-2; | |
CREATE (:Artist {Name : 'Ralph Macchio', WorkedAs : ["Actor"]}); //Artist-3; | |
CREATE (:Artist {Name : 'Simon West', WorkedAs : ["Director"]}); //Artist-4; | |
//Relationships | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky"}) CREATE (artist)-[:ACTED_IN {Role : "Rocky Balboa"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky II"}) CREATE (artist)-[:ACTED_IN {Role : "Rocky Balboa"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky III"}) CREATE (artist)-[:ACTED_IN {Role : "Rocky Balboa"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky IV"}) CREATE (artist)-[:ACTED_IN {Role : "Rocky Balboa"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky V"}) CREATE (artist)-[:ACTED_IN {Role : "Rocky Balboa"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "The Expendables"}) CREATE (artist)-[:ACTED_IN {Role : "Barney Ross"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "The Expendables II"}) CREATE (artist)-[:ACTED_IN {Role : "Barney Ross"}]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky II"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky III"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "Rocky IV"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "Sylvester Stallone"}), (movie:Movie {Title: "The Expendables"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "John G. Avildsen"}), (movie:Movie {Title: "Rocky"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "John G. Avildsen"}), (movie:Movie {Title: "Rocky V"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "John G. Avildsen"}), (movie:Movie {Title: "The Karate Kid"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "John G. Avildsen"}), (movie:Movie {Title: "The Karate Kid II"}) CREATE (artist)-[:DIRECTED]->(movie); | |
Match (artist:Artist {Name : "Ralph Macchio"}), (movie:Movie {Title: "The Karate Kid"}) CREATE (artist)-[:ACTED_IN {Role:"Daniel LaRusso"}]->(movie); | |
Match (artist:Artist {Name : "Ralph Macchio"}), (movie:Movie {Title: "The Karate Kid II"}) CREATE (artist)-[:ACTED_IN {Role:"Daniel LaRusso"}]->(movie); | |
Match (artist:Artist {Name : "Simon West"}), (movie:Movie {Title: "The Expendables II"}) CREATE (artist)-[:DIRECTED]->(movie); | |
---- | |
=== This will show a live Console where you can write and execute your queries!!! | |
//console | |
== Below will be our Queries for exploring Movie Dataset | |
== Get All Nodes | |
[source,cypher] | |
---- | |
MATCH (n) RETURN n; | |
---- | |
== This will show results in a table | |
//table | |
== This will show a Graph | |
//graph |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment