Last active
February 6, 2016 06:51
-
-
Save joshblack/98220c0b4475f63d5326 to your computer and use it in GitHub Desktop.
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
// Extends Tom Hanks co-actors, to find co-co-actors who haven't worked with Tom Hanks... | |
MATCH (tom:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors), | |
(coActors)-[:ACTED_IN]->(m2)<-[:ACTED_IN]-(cocoActors) | |
WHERE NOT (tom)-[:ACTED_IN]->(m2) | |
RETURN cocoActors.name AS Recommended, count(*) AS Strength ORDER BY Strength DESC | |
// Find someone to introduce Tom Hanks to Tom Cruise | |
MATCH (tom:Person {name:"Tom Hanks"})-[:ACTED_IN]->(m)<-[:ACTED_IN]-(coActors), | |
(coActors)-[:ACTED_IN]->(m2)<-[:ACTED_IN]-(cruise:Person {name:"Tom Cruise"}) | |
RETURN tom, m, coActors, m2, cruise | |
// Create data relationships | |
MATCH (p:Product),(c:Category) | |
WHERE p.categoryID = c.categoryID | |
CREATE (p)-[:PART_OF]->(c) | |
MATCH (p:Product),(s:Supplier) | |
WHERE p.supplierID = s.supplierID | |
CREATE (s)-[:SUPPLIES]->(p) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment