Instantly share code, notes, and snippets.

anonymous /HallOfFame-Inducted-Query
Created Aug 22, 2017

Embed
What would you like to do?
MATCH(vote:HallOfFame{inducted: 'Y'})
WITH vote
MATCH(player:People{playerID: vote.playerID})
RETURN player, vote
MATCH p=()-[r:WAS_INDUCTED_TO_HALL_OF_FAME]->() RETURN p LIMIT 25;
MATCH(vote:HallOfFame{inducted: 'Y'})
WITH vote
MATCH(person:People{playerID: vote.playerID})
MERGE(person)-[:WAS_INDUCTED_TO_HALL_OF_FAME]->(vote);
// People to Batting
MATCH (player:People)
WITH player
MATCH (playerStats:Batting{playerID:player.playerID})
MERGE (player)-[:HAS_BATTING_STATISTICS]->(playerStats);
// People to Fielding
MATCH (player:People)
WITH player
MATCH (playerStats:Fielding{playerID:player.playerID})
MERGE (player)-[:HAS_FIELDING_STATISTICS]->(playerStats);
// People to Pitching
MATCH (player:People)
WITH player
MATCH (playerStats:Pitching{playerID:player.playerID})
MERGE (player)-[:HAS_PITCHING_STATISTICS]->(playerStats);
// Team to Player Batting Stats
MATCH (team:Teams)
WITH team
MATCH (playerStats:Batting{teamID:team.teamID, yearID: team.yearID})
MERGE (playerStats)-[:BATTED_FOR]->(team);
// Team to Player Pitching Stats
MATCH (team:Teams)
WITH team
MATCH (playerStats:Pitching{teamID:team.teamID, yearID: team.yearID})
MERGE (playerStats)-[:PITCHED_FOR]->(team);
// Team to Player Fielding Stats
MATCH (team:Teams)
WITH team
MATCH (playerStats:Fielding{teamID:team.teamID, yearID: team.yearID})
MERGE (playerStats)-[:FIELDED_FOR]->(team);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment