This file contains 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
beer paraphraser | |
feat enactment swive hid muck | |
confectionery | |
byssus genuine | |
astrictive Australia | |
quintuple Ching huff | |
back matter traumatism | |
subj calorifacient mire |
This file contains 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
package main | |
import ( | |
"bufio" | |
"fmt" | |
"math/rand" | |
"os" | |
"strings" | |
"time" |
This file contains 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
CREATE (e:Erdos); | |
LOAD CSV FROM "http://www4.skeweredrook.com/Erdos-remix.csv" AS coll | |
WITH coll[0] AS first, toInt(coll[1]) AS year, toInt(coll[2]) as count, coll[3..] AS conns | |
MATCH (e:Erdos) | |
MERGE (p:Person {name:first}) ON CREATE SET p.year = year, p.count = coalesce(count, 1) | |
MERGE (p)-[:COLLABORATED_WITH]-(e) | |
WITH p,conns | |
UNWIND conns as cName | |
MERGE (c:Person {name:cName}) |
This file contains 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
LOAD CSV FROM "http://www4.skeweredrook.com/Erdos-remix.csv" AS coll | |
WITH coll[0] AS first, toInt(coll[1]) AS year, toInt(coll[2]) as count, coll[3..] AS conns | |
MERGE (e:Erdos) | |
MERGE (p:Person {name:first}) ON CREATE SET p.year = year, p.count = coalesce(count, 1) | |
MERGE (p)-[:COLLABORATED_WITH]-(e) | |
WITH p,conns | |
UNWIND conns as cName | |
MERGE (c:Person {name:cName}) | |
MERGE (c)-[:COLLABORATED_WITH]-(p); |
This file contains 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
LOAD CSV WITH HEADERS FROM 'http://www4.skeweredrook.com/movies.csv' as record | |
WITH toInt(record.movieId) as movieId, record.title as title, toFloat(record.voteAverage) as avgVote, toInt(record.releaseYear) as releaseYear, | |
record.tagline as tagline, split(record.genres, ":") as genres, toInt(record.personId) as personId, record.name as personName, | |
toInt(record.birthYear) as birthYear, toInt(record.deathYear) as deathYear, split(record.characters, ":") as roles, | |
CASE WHEN record.personType = "ACTOR" THEN [1] ELSE [] END as actor, CASE WHEN record.personType = "DIRECTOR" THEN [1] ELSE [] END as director | |
MERGE (movie:Movie {id:movieId}) | |
ON CREATE SET movie.title = title, movie.avgVote = avgVote, movie.releaseYear = releaseYear, movie.tagline = tagline, movie.genres = genres | |
FOREACH(x in actor | MERGE(person:Person {id:personId}) | |
ON CREATE SET person.name = personName, person.born = birthYear, person.died = case when deathYear > 0 then deathYear else null end | |
MERGE (person)-[:ACTED_IN {roles:roles}]->(movie)) |
This file contains 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
LOAD CSV WITH HEADERS FROM 'http://www4.skeweredrook.com/movies.csv' as record | |
WITH toInt(record.movieId) as movieId, toFloat(record.voteAvg) as avgVote | |
MERGE (movie:Movie {id:movieId}) | |
ON MATCH SET movie.avgVote = avgVote |
This file contains 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
MATCH (a:Person)-[:ACTED_IN]->(m)-[:IS_GENRE]->(g)<-[:IS_GENRE]-()<-[:DIRECTED]-(d:Person) | |
WHERE a.name = "Keanu Reeves" | |
AND NOT (a)-[:ACTED_IN]->()<-[:DIRECTED]-(d) | |
AND NOT has(d.died) | |
WITH count(distinct g) as intersecting, a,d | |
MATCH (a)-[:ACTED_IN]->(m)-[:IS_GENRE]->(g) | |
WITH intersecting, collect(g) as keanuGenres,a,d | |
MATCH (d)-[:DIRECTED]->(m)-[:IS_GENRE]->(g) | |
WITH intersecting, keanuGenres, collect(g) as directorGenres,a,d | |
WITH intersecting, keanuGenres + directorGenres as unionGenres,a,d |
This file contains 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
MATCH (a:Person)-[:ACTED_IN]->(m)-[:IS_GENRE]->(g)<-[:IS_GENRE]-()<-[:DIRECTED]-(d:Person) | |
WHERE a.name = "Keanu Reeves" | |
AND NOT (a)-[:ACTED_IN]->()<-[:DIRECTED]-(d) | |
AND NOT has(d.died) | |
WITH count(distinct g) as intersecting, a,d | |
MATCH (a)-[:ACTED_IN]->(m)-[:IS_GENRE]->(g) | |
WITH intersecting, collect(distinct g) as keanuGenres,a,d | |
MATCH (d)-[:DIRECTED]->(m)-[:IS_GENRE]->(g) | |
WITH intersecting, keanuGenres, collect(distinct g) as directorGenres,a,d | |
RETURN toFloat(intersecting) / (length(keanuGenres) + length([x in directorGenres where not x in keanuGenres])) as score, a.name, d.name |
This file contains 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
with ['a','b','c','d','e','f','g','h'] as coll | |
return reduce(acc="", x in range(1,8)| acc + coll[toInt(rand()*length(coll))]) |
This file contains 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
MATCH (a)-[:ACTED_IN]->(m)<-[:DIRECTED]-(d) | |
WITH a.name as actor, d.name as director, collect(m.title) as movies, count(1) as movieCount | |
UNWIND movies as movie | |
RETURN actor, director, movie, movieCount | |
ORDER BY movieCount desc; |