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
| WITH apoc.map.fromLists( $rounds, range(0, size($rounds)-1)) AS rounds | |
| MATCH (winner:Player)-[:MATCH_WINNER]->(final:Match {round: "F"})-[:IN_TOURNAMENT]->(t) | |
| MATCH (winner)-[:MATCH_WINNER]->(m:Match)-[:IN_TOURNAMENT]-(t), | |
| (set)-[:IN_MATCH]->(m:Match)<-[:MATCH_LOSER]-(rival) | |
| WITH * | |
| ORDER BY rounds[m.round] | |
| WITH winner, t, count(DISTINCT m) AS number_of_matches, count(set) AS sets, | |
| collect(DISTINCT{round: m.round, rival: rival.name, score: m.score }) AS matches_in_t | |
| RETURN winner.name AS winner, t.year AS year, t.name AS t_name, t.type AS t_type, number_of_matches, sets, matches_in_t | |
| ORDER BY year DESC; |
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
| MATCH(loser:Player)-[r1:MATCH_LOSER]->(final:Match{round:'F'})-[:IN_TOURNAMENT]->(t:Tournament) | |
| WITH loser.name as loser, final.year as year, t.name as tournament_name, t.type as type | |
| WITH loser, tournament_name, type, count(year) as times, collect(year) as years | |
| WHERE times>1 | |
| RETURN * | |
| ORDER BY times DESC; |
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
| MATCH(winner:Player)-[r1:MATCH_WINNER]->(final:Match{round:'F'})-[:IN_TOURNAMENT]->(t:Tournament) | |
| WITH winner, t | |
| ORDER BY t.year | |
| RETURN t.name as tournament, t.type as t_type, collect(winner.name) as winners; |
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
| MATCH(winner:Player)-[r1:MATCH_WINNER]->(final:Match{round:'F'})-[:IN_TOURNAMENT]->(t:Tournament) | |
| WITH winner.name as winner, type(r1) as won, final.year as year, t.name as tournament_name, t.type as type | |
| WITH winner, tournament_name, type, count(year) as times, collect(year) as years | |
| WHERE times>1 | |
| RETURN * | |
| ORDER BY times DESC; |
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
| MATCH (player)-[:MATCH_LOSER]->(m:Match)-[:IN_TOURNAMENT]->(prev_t)-[:NEXT_TOURNAMENT]->(next_t), | |
| (player)-[:MATCH_WINNER]->(:Match {round: "F"})-[:IN_TOURNAMENT]->(next_t) | |
| WHERE m.round in ['R128', 'R64', 'R32', 'R16'] | |
| RETURN player.name AS player, m.round AS lost_round, prev_t.year AS lost_year, next_t.year AS won_year, next_t.name AS tournament_name, player.gender AS gender | |
| ORDER BY lost_year DESC; |
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
| MATCH (player)-[:MATCH_LOSER]->(:Match {round: "F"})-[:IN_TOURNAMENT]->(t_prev)-[:NEXT_TOURNAMENT]->(t_next), | |
| (player)-[:MATCH_WINNER]->(:Match {round: "F"})-[:IN_TOURNAMENT]->(t_next) | |
| RETURN player.name AS player, t_prev.year AS prev_year, t_next.year AS next_year, t_next.name AS tournament_name, player.gender AS gender | |
| ORDER BY prev_year DESC; |
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
| MATCH path = (p:Player)-[:MATCH_WINNER]->(final:Match {round: "F"})<-[:NEXT_MATCH*]-(m)<-[:MATCH_WINNER]-(p) | |
| WHERE not((m)<-[:NEXT_MATCH]-()) AND (final)-[:IN_TOURNAMENT]-(:Tournament{name:'Roland Garros', type:'atp', year:2021}) | |
| RETURN path, | |
| [node in nodes(path) WHERE node:Match | [p = (p1)-[:MATCH_WINNER]->(node)<-[:MATCH_LOSER]-(p2) | p]]; |
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
| MATCH (winner:Player)-[:MATCH_WINNER]->(match:Match {round: "F"})<-[:MATCH_LOSER]-(loser), | |
| (sets)-[:IN_MATCH]->(match)-[:IN_TOURNAMENT]->(tournament) | |
| RETURN tournament.year AS year, | |
| tournament.type AS type, | |
| tournament.name AS name, | |
| winner.gender AS gender, | |
| winner.hand AS winner_hand, | |
| winner.ioc AS winner_country, | |
| winner.name AS winner, | |
| loser.name AS loser, |
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
| CREATE CONSTRAINT Players IF NOT EXISTS ON (n:Player) ASSERT n.id IS UNIQUE; | |
| CREATE CONSTRAINT Matches IF NOT EXISTS ON (n:Match) ASSERT n.id IS UNIQUE; | |
| CREATE CONSTRAINT Sets IF NOT EXISTS ON (n:Set) ASSERT n.id IS UNIQUE; | |
| CREATE CONSTRAINT Tournaments IF NOT EXISTS ON (n:Tournament) ASSERT n.id IS UNIQUE; |
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
| WITH ["R128", "R64", "R32", "R16", "QF", "SF", "F"] as roundList | |
| WITH apoc.map.fromLists(roundList, range(0, size(roundList)-1)) AS rounds | |
| MATCH (t:Tournament)<-[:IN_TOURNAMENT]-(m:Match)<--(p) | |
| WHERE t.name = "Roland Garros" and t.type = "wta" | |
| WITH p, m, t | |
| ORDER BY p, rounds[m.round] | |
| WITH p, t, collect(m) AS matches | |
| WHERE size(matches) > 1 | |
| CALL apoc.nodes.link(matches, "NEXT_MATCH"); |
NewerOlder