OtherActive

Cypher Query Language

Cypher Query Language: Neo4j documentation Getting started Get started with Neo4j Explore the capabilities of graph databases.

Open source page

Field note

What it does

Getting Started What is Cypher? Build a recommendation engine Raise an issue Tutorial: Build a Cypher recommendation engine This tutorial uses the Movie dataset to show how to build two recommendation engines: Who an actor hasn’t worked with and should work next Who can introduce the actors to each other If you are completely new to Cypher®, see the tutorial Get started with Cypher to learn how to run basic queries against the same example dataset used here. Pre-requisites After you create a free Aura instance , use the "Connect" button and select "Query". Copy and paste the following Cypher to the Cypher editor and execute the query: CREATE CONSTRAINT movie_title IF NOT EXISTS FOR (m:Movie) REQUIRE m.title IS UNIQUE; CREATE CONSTRAINT person_name IF NOT EXISTS FOR (p:Person) REQUIRE p.name IS UNIQUE; MERGE (TheMatrix:Movie {title:'The Matrix'}) ON CREATE SET TheMatrix.released=1999, TheMatrix.tagline='Welcome to the Real World' MERGE (Keanu:Person {name:'Keanu Reeves'}) ON CREATE SET Keanu.born=1964 MERGE (Carrie:Person {name:'Carrie-Anne Moss'}) ON CREATE SET Carrie.born=1967 MERGE (Laurence:Person {name:'Laurence Fishburne'}) ON CREATE SET Laurence.born=1961 MERGE (Hugo:Person {name:'Hugo Weaving'}) ON CREATE SET Hugo.born=1960 MERGE (LillyW:Person {name:'Lilly Wachowski'}) ON CREATE SET LillyW.born=1967 MERGE (LanaW:Person {name:'Lana Wachowski'}) ON CREATE SET LanaW.born=1965 MERGE (JoelS:Person {name:'Joel Silver'}) ON CREATE SET JoelS.born=1952 MERGE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrix) MERGE (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrix) MERGE (Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrix) MERGE (Hugo)-[:ACTED_IN {roles:['Agent Smith']}]->(TheMatrix) MERGE (LillyW)-[:DIRECTED]->(TheMatrix) MERGE (LanaW)-[:DIRECTED]->(TheMatrix) MERGE (JoelS)-[:PRODUCED]->(TheMatrix) MERGE (Emil:Person {name:'Emil Eifrem'}) ON CREATE SET Emil.born=1978 MERGE (Emil)-[:ACTED_IN {roles:["Emil"]}]->(TheMatrix); MERGE (TheMatrixReloaded:Movie {title:'The Matrix Reloaded'}) ON CREATE SET TheMatrixReloaded.released=2003, TheMatrixReloaded.tagline='Free your mind' MERGE (Keanu:Person {name:'Keanu Reeves'}) ON CREATE SET Keanu.born=1964 MERGE (Carrie:Person {name:'Carrie-Anne Moss'}) ON CREATE SET Carrie.born=1967 MERGE (Laurence:Person {name:'Laurence Fishburne'}) ON CREATE SET Laurence.born=1961 MERGE (Hugo:Person {name:'Hugo Weaving'}) ON CREATE SET Hugo.born=1960 MERGE (LillyW:Person {name:'Lilly Wachowski'}) ON CREATE SET LillyW.born=1967 MERGE (LanaW:Person {name:'Lana Wachowski'}) ON CREATE SET LanaW.born=1965 MERGE (JoelS:Person {name:'Joel Silver'}) ON CREATE SET JoelS.born=1952 MERGE (Keanu)-[:ACTED_IN {roles:['Neo']}]->(TheMatrixReloaded) MERGE (Carrie)-[:ACTED_IN {roles:['Trinity']}]->(TheMatrixReloaded) MERGE (Laurence)-[:ACTED_IN {roles:['Morpheus']}]->(TheMatrixReloaded) MERGE (Hugo)-[:ACTED_IN {roles:['Agent Smith']}]->(TheMatrixReloaded) MERGE (LillyW)-[:DIRECTED]->(TheMatrixReloaded) MERGE (LanaW)-[:DIRECTED]->(TheMatrixReloaded) MERGE (JoelS)-[:PRODUCED]->(TheMatrixReloaded); MERGE (TheMatrixRevolutions:Movie {title:'The Matrix Revolutions'}) ON CREATE SET TheMatrixRevolutions.released=2003, TheMatrixRevolutions.tagline='Everything that has a beginning has an end' MERGE (Keanu:Person {name:'Keanu Reeves'}) ON CREATE SET Keanu.born=1964 MERGE (Carrie:Person {name:'Carrie-Anne Moss'}) ON CREATE SET Carrie.born=1967 MERGE (Laurence:Person {name:'Laurence Fishburne'}) ON CREATE SET Laurence.born=1961 MERGE (Hugo:Person {name:'Hugo Weaving'}) ON CREATE SET Hugo.born=1960 MERGE (LillyW:Person {name:'Lilly Wachowski'}) ON CREATE SET LillyW.born=1967 MERGE (LanaW:Person {name:'Lana Wachowski'}) ON CREATE SET LanaW.born=1965 MERGE (JoelS:Person {name:'Joel Silver'}) ON CREATE SET Joel Getting Started Import data into Neo4j Import from a relational database into Neo4j Raise an issue Import from a relational database into Neo4j You need to have a clear understanding of your graph data model before transferring the data from an existing relational structure to a graph. Depending on the environment you are working in, the format of the exported dataset, and the Neo4j deployment method of your choice, there are different ways you can import data from a relational database into a graph. This page lists some of the recommended methods. For a full list, refer to Import your data into Neo4j . Import tool Import is a tool for importing data into an Aura instance.

Capabilities

Available capabilities

Tags

Tags

No tags filed yet.

Ways to use it

Ways to use it

No integrations filed yet.

Product features

Product features

Conclusion

Exploring the paths between actors and movies

Finding second-degree co-actors

Keep learning

Pre-requisites

Recommendations

Simple filtering

Tutorial: Build a Cypher recommendation engine