Mike Tyson's Punch-Out!! as a Neo4j database
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
image::http://underratedretro.com/press/wp-content/uploads/2014/08/Mike-Tysons-Punchout.jpg[align="center", Punchout!!!] | |
This is a quick and fun little graph of the classic Nintendo game, Mike Tyson's Punch-Out!!. | |
The information for the graph comes directly from the http://punchout.wikia.com/wiki/Punch-Out_Wiki[Punchout Wiki]. The graph is based off the NES console from 1987 as opposed to the earlier arcade games or the later release for the Wii, etc. | |
I took the liberty of having Little Mac win all his fights by knockout. But then he went up against Iron Mike... | |
_Notice that the dataset is read in painlessly via Google Docs as outlined http://blog.bruggen.com/2014/07/using-loadcsv-to-import-data-from.html[here]._ | |
[source,cypher] | |
---- | |
LOAD CSV WITH HEADERS FROM | |
'https://docs.google.com/spreadsheets/u/0/d/1Jr5ABoLMrUPQ3Vm9GTOzVmNucfnWq1ELTxv2WxOYOx0/export?format=csv&id=1Jr5ABoLMrUPQ3Vm9GTOzVmNucfnWq1ELTxv2WxOYOx0&gid=0' AS line | |
MERGE (b1:boxer { | |
boxer_id: line.boxer_id, | |
name: line.name | |
}) | |
MERGE (b2:boxer {boxer_id: line.fought | |
}) | |
MERGE (f:fight { fight_id: line.fight_id, | |
notes: line.notes, | |
outcome: line.outcome | |
}) | |
//CREATE (b1)-[:AGAINST]->(b2) | |
CREATE (b1)-[r:BOXER_STATUS { | |
total_fights: line.total_fights, | |
wins: line.wins, | |
wins_by_KO: line.wins_by_KO, | |
losses: line.losses, | |
weight: line.weight, | |
height: line.height, | |
nationality: line.nationality, | |
age: line.age, | |
rank: line.rank | |
} ]->(f); | |
---- | |
//graph | |
Query 2: What happened when Little Mac fought opponents ranked #1? | |
//output | |
[source,cypher] | |
---- | |
MATCH (result) <-[r:BOXER_STATUS]- (boxer) | |
WHERE toInt(r.rank) = 1 | |
RETURN result.outcome, result.notes | |
---- | |
Query 3: Did Little Mac lose twice to anyone? Or win twice against anyone? | |
//output | |
[source,cypher] | |
---- | |
START n=node(*), m=node(*) | |
WHERE | |
n.outcome=m.outcome AND | |
ID(n) <ID(m) | |
RETURN n, m | |
---- | |
//graph_result |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment