I’ve been watching the Men’s Roller Derby World Cup today so thought I’d get some info out of what’s going on.
Still ne to Neo4j so still learning and playing around with it to see what I can do with it.
-
(Team)-[:IS_IN]→(Group)
-
(Team)-[:PLAYED_IN {score:0}]→(Game)
-
I think this probably needs to change
-
create (red:Group {name:"Red"}),
(orange:Group {name:"Orange"}),
(green:Group {name:"Green"}),
(blue:Group {name:"Blue"}),
(finland:Team {name:"Team Finland MRD"})-[:IS_IN]->(red),
(usa:Team {name:"USA Roller Derby – Men’s Team"})-[:IS_IN]->(red),
(wales:Team {name:"Team Wales Men’s Roller Derby"})-[:IS_IN]->(red),
(belgium:Team {name:"Belgium"})-[:IS_IN]->(orange),
(canada:Team {name:"Canada"})-[:IS_IN]->(orange),
(japan:Team {name:"Ninjapan"})-[:IS_IN]->(orange),
(scotland:Team {name:"Team Scotland Men’s Roller Derby"})-[:IS_IN]->(orange),
(argentina:Team {name:"Argentina"})-[:IS_IN]->(green),
(england:Team {name:"Team England Men’s Roller Derby"})-[:IS_IN]->(green),
(netherlands:Team {name:"Team Netherlands Men’s Derby"})-[:IS_IN]->(green),
(sweden:Team {name:"Sweden"})-[:IS_IN]->(green),
(australia:Team {name:"Team Australia-Wizards of Aus"})-[:IS_IN]->(blue),
(france:Team {name:"France"})-[:IS_IN]->(blue),
(germany:Team {name:"Team Germany"})-[:IS_IN]->(blue),
(ireland:Team {name:"Team Ireland"})-[:IS_IN]->(blue),
(argentina)-[:PLAYED_IN {score:51}]->(:Game {day:1, time:1000})<-[:PLAYED_IN {score:158}]-(england),
(belgium)-[:PLAYED_IN {score:20}]->(:Game {day:1, time:1030})<-[:PLAYED_IN {score:255}]-(canada),
(ireland)-[:PLAYED_IN {score:30}]->(:Game {day:1, time:1100})<-[:PLAYED_IN {score:145}]-(france),
(finland)-[:PLAYED_IN {score:0}]->(:Game {day:1, time:1130})<-[:PLAYED_IN {score:314}]-(usa),
(sweden)-[:PLAYED_IN {score:72}]->(:Game {day:1, time:1200})<-[:PLAYED_IN {score:101}]-(netherlands),
(japan)-[:PLAYED_IN {score:73}]->(:Game {day:1, time:1230})<-[:PLAYED_IN {score:247}]-(scotland),
(germany)-[:PLAYED_IN {score:12}]->(:Game {day:1, time:1300})<-[:PLAYED_IN {score:232}]-(australia),
(sweden)-[:PLAYED_IN {score:59}]->(:Game {day:1, time:1330})<-[:PLAYED_IN {score:176}]-(argentina),
(belgium)-[:PLAYED_IN {score:82}]->(:Game {day:1, time:1400})<-[:PLAYED_IN {score:98}]-(scotland),
(germany)-[:PLAYED_IN {score:14}]->(:Game {day:1, time:1430})<-[:PLAYED_IN {score:251}]-(france),
(usa)-[:PLAYED_IN {score:217}]->(:Game {day:1, time:1500})<-[:PLAYED_IN {score:13}]-(wales),
(england)-[:PLAYED_IN {score:345}]->(:Game {day:1, time:1530})<-[:PLAYED_IN {score:22}]-(netherlands),
(japan)-[:PLAYED_IN {score:11}]->(:Game {day:1, time:1600})<-[:PLAYED_IN {score:349}]-(canada),
(ireland)-[:PLAYED_IN {score:65}]->(:Game {day:1, time:1630})<-[:PLAYED_IN {score:111}]-(australia),
(england)-[:PLAYED_IN {score:363}]->(:Game {day:1, time:1700})<-[:PLAYED_IN {score:0}]-(sweden),
(canada)-[:PLAYED_IN {score:220}]->(:Game {day:1, time:1730})<-[:PLAYED_IN {score:18}]-(scotland),
(ireland)-[:PLAYED_IN {score:62}]->(:Game {day:1, time:1800})<-[:PLAYED_IN {score:22}]-(germany),
(japan)-[:PLAYED_IN {score:88}]->(:Game {day:1, time:1830})<-[:PLAYED_IN {score:241}]-(belgium),
(australia)-[:PLAYED_IN {score:57}]->(:Game {day:1, time:1900})<-[:PLAYED_IN {score:117}]-(france),
(wales)-[:PLAYED_IN {score:107}]->(:Game {day:1, time:1930})<-[:PLAYED_IN {score:35}]-(finland),
(netherlands)-[:PLAYED_IN {score:35}]->(:Game {day:1, time:2000})<-[:PLAYED_IN {score:105}]-(argentina)
MATCH (t1:Team)-[p1:PLAYED_IN]->(game:Game)<-[p2:PLAYED_IN]-(t2:Team)
WHERE id(t1)<id(t2)
RETURN t1.name AS Team1, p1.score AS Score1, game.time AS Time, p2.score AS Score2, t2.name AS Team2
ORDER BY Time
MATCH (t1:Team)-[p1:PLAYED_IN]->(Game)<-[p2:PLAYED_IN]-(t2:Team)
WHERE id(t1)<id(t2)
RETURN t1.name AS Team1, p1.score AS Score1, p2.score AS Score2, t2.name AS Team2, sqrt((p1.score - p2.score)*(p1.score - p2.score)) AS `Point Differential`
ORDER BY `Point Differential`
MATCH (t1:Team)-[p1:PLAYED_IN]->(game:Game)<-[p2:PLAYED_IN]-(t2:Team)
WHERE id(t1)<id(t2) AND game.day = 1
RETURN t1.name AS Team1, SUM(p1.score - p2.score) AS `Point Differential`
ORDER BY `Point Differential` DESC
Now don’t have me break this thing down for nothing!
MATCH (group:Group)<--(t1:Team)-[p1:PLAYED_IN]->(game:Game)<-[p2:PLAYED_IN]-(t2:Team)
WHERE id(t1)<id(t2) AND game.day = 1
RETURN group.name AS `Group Name`, t1.name AS Team1, SUM(p1.score - p2.score) AS `Point Differential`
ORDER BY `Group Name`, `Point Differential` DESC
MATCH (group:Group)<-[:IS_IN]-(team1:Team)-[p1:PLAYED_IN]->()
RETURN group.name AS `Group Name`, SUM(p1.score) AS `Total Points Scored`
ORDER BY `Total Points Scored` DESC