Skip to content

Instantly share code, notes, and snippets.

@jjaderberg
Forked from davidoliverSP2/nfl_draft.adoc
Created May 11, 2017 16:05
Show Gist options
  • Select an option

  • Save jjaderberg/310d0fb0afb2934e50f1c9df790af6b4 to your computer and use it in GitHub Desktop.

Select an option

Save jjaderberg/310d0fb0afb2934e50f1c9df790af6b4 to your computer and use it in GitHub Desktop.

Revisions

  1. David Oliver revised this gist Apr 13, 2017. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -9,13 +9,13 @@

    == Introduction

    The NFL Draft is an annual event, where young Football players leaving College are selected by the professional NFL teams.
    Every year, the NFL team with the worst record from the previous season gets to pick first.
    The NFL Draft is an annual event, where young football players at the end of their College careers are selected by the professional NFL teams.
    Every year, the first overall pick is allocated to the NFL team with the worst record from the previous season.
    At the end of the 1st round, the reigning champions finally get to make their selection.

    There are 32 professional teams in the NFL, so each round in the draft consists of 32 selections.
    To add an extra twist, the NFL teams can use their picks as currency, trading up and down the draft board.
    In any given draft, you can find NFL teams with 2 or 3 picks in the first round - they will have traded places with other teams, sometimes for better selections, sometimes to move down the draft and gain more picks, or sometimes by trading away existing players for extra picks.
    In any given draft, you can find NFL teams with 2 or 3 picks in the first couple of rounds - they will have traded places with other teams; sometimes for better selections, sometimes to move down the draft and gain more picks, or sometimes by trading away existing players for extra picks.

    This GraphGist uses the data from the 2016 NFL Draft, with all the players taken in the 7 rounds of selections.
    Using this data, we can map which teams selected the most players, who the fewest, and find patterns in the positions of players selected.
  2. David Oliver revised this gist Apr 13, 2017. 1 changed file with 10 additions and 1 deletion.
    11 changes: 10 additions & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,16 @@

    == Introduction

    REPLACEME: Introductory text and domain model image.
    The NFL Draft is an annual event, where young Football players leaving College are selected by the professional NFL teams.
    Every year, the NFL team with the worst record from the previous season gets to pick first.
    At the end of the 1st round, the reigning champions finally get to make their selection.

    There are 32 professional teams in the NFL, so each round in the draft consists of 32 selections.
    To add an extra twist, the NFL teams can use their picks as currency, trading up and down the draft board.
    In any given draft, you can find NFL teams with 2 or 3 picks in the first round - they will have traded places with other teams, sometimes for better selections, sometimes to move down the draft and gain more picks, or sometimes by trading away existing players for extra picks.

    This GraphGist uses the data from the 2016 NFL Draft, with all the players taken in the 7 rounds of selections.
    Using this data, we can map which teams selected the most players, who the fewest, and find patterns in the positions of players selected.

    ////
    Provide an introduction to your domain and what you are trying to accomplish, link to http://a.source.com[sources] as needed.
  3. David Oliver revised this gist Apr 13, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -76,11 +76,11 @@ CREATE (t)-[:SELECTION]->(r)
    [source,cypher]
    ----
    MATCH (p:Player)-[:TO]->(t:Team)
    RETURN a.name, count(*) as freq, collect(t:Team) as Teams
    ORDER BY freq DESC
    LIMIT 5
    RETURN p,t
    ----

    //graph_result

    //table

    == REPLACEME: SECOND USE-CASE TITLE
    @@ -91,8 +91,8 @@ LIMIT 5

    [source,cypher]
    ----
    MATCH path=(a:Person {name: 'Alice'})-[:FRIENDS_WITH]-(:Person)-[:FRIENDS_WITH]-(fof:Person)
    RETURN path, a, fof
    MATCH (p:Player)-[:TO]->(t:Team)
    RETURN p,t
    ----

    //graph_result
  4. David Oliver revised this gist Apr 13, 2017. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -75,8 +75,10 @@ CREATE (t)-[:SELECTION]->(r)

    [source,cypher]
    ----
    MATCH (a:Person {name: 'Alice'})-[:FRIENDS_WITH]-(:Person)-[:FRIENDS_WITH]-(fof:Person)
    RETURN fof.name as fof, count(*) as frequency
    MATCH (p:Player)-[:TO]->(t:Team)
    RETURN a.name, count(*) as freq, collect(t:Team) as Teams
    ORDER BY freq DESC
    LIMIT 5
    ----

    //table
  5. David Oliver revised this gist Apr 13, 2017. 1 changed file with 14 additions and 16 deletions.
    30 changes: 14 additions & 16 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -50,14 +50,19 @@ CREATE
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    // MERGE (p:Player {name: line.Player}) ON CREATE SET p.DraftPosition = toInt(line.`Draft Position`)
    MERGE (:Round {id: line.Round})
    MERGE (:DraftPosition {id: line.`Draft Position`})
    MERGE (:Team {name: line.Team})
    MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    MERGE (p:Player {name: line.Player}) ON CREATE SET p.DraftPosition = toInt(line.`Draft Position`)
    MERGE (r:Round {id: line.Round})
    MERGE (t:Team {name: line.Team})
    MERGE (s:Position {name: line.Position})
    MERGE (l:College {name: line.College})
    MERGE (n:Conference {name: line.Conference})
    CREATE (p)-[:POSITION_IS]->(s)
    CREATE (p)-[:TO]->(t)
    CREATE (p)-[:FROM]->(l)
    CREATE (p)-[:PICKED_IN]->(r)
    CREATE (p)-[:PLAYED_IN]->(n)
    CREATE (l)-[:PLAYS_IN]->(n)
    CREATE (t)-[:SELECTION]->(r)
    ----

    //graph
    @@ -94,21 +99,14 @@ RETURN path, a, fof
    // You can also use both graph_result and then table if you return full nodes, relationships or paths
    ////

    == REPLACEME: THIRD USE-CASE TITLE
    // REMOVEME: add as many use-cases as make sense

    // optional section
    == Conclusions

    REPLACEME: Offer a conclusion

    // optional section
    == Resources

    REPLACEME: Link to resorces like data sources, further discussions,

    // optional Footer
    ---

    Created by {author} - https://twitter.com/{twitter}[Twitter] | http://your.blog.com/[Blog] | https://in.linkedin.com/in/linked-in-handle/[LinkedIn]
    Created by David Oliver - https://twitter.com/DaveOliver79[Twitter] | https://writingfortech.wordpress.com/[Blog] | https://www.linkedin.com/in/david-oliver-97184421/[LinkedIn]

  6. David Oliver revised this gist Apr 13, 2017. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,14 @@ CREATE
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (p:Player {name: line.Player}) ON CREATE SET p.DraftPosition = toInt(line.`Draft Position`)
    // MERGE (p:Player {name: line.Player}) ON CREATE SET p.DraftPosition = toInt(line.`Draft Position`)
    MERGE (:Round {id: line.Round})
    MERGE (:DraftPosition {id: line.`Draft Position`})
    MERGE (:Team {name: line.Team})
    MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    ----

    //graph
  7. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 13 deletions.
    14 changes: 1 addition & 13 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -50,19 +50,7 @@ CREATE
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (pl:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    MERGE (rd:Round {id: toInt(line.Round)})
    MERGE (tm:Team {name: line.Team})
    MERGE (ps:Position {name: line.Position})
    MERGE (cl:College {name: line.College})
    MERGE (cn:Conference {name: line.Conference})
    CREATE (pl)-[:POSITION_IS]->(ps)
    CREATE (pl)-[:TO]->(tm)
    CREATE (pl)-[:FROM]->(cl)
    CREATE (pl)-[:PICKED_IN]->(rd)
    CREATE (pl)-[:PLAYED_IN]->(cn)
    CREATE (cl)-[:PLAYS_IN]->(cn)
    CREATE (tm)-[:SELECTION]->(rd)
    MERGE (p:Player {name: line.Player}) ON CREATE SET p.DraftPosition = toInt(line.`Draft Position`)
    ----

    //graph
  8. David Oliver revised this gist Apr 13, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -61,8 +61,8 @@ CREATE (pl)-[:TO]->(tm)
    CREATE (pl)-[:FROM]->(cl)
    CREATE (pl)-[:PICKED_IN]->(rd)
    CREATE (pl)-[:PLAYED_IN]->(cn)
    CREATE (College)-[:PLAYS_IN]->(cn)
    CREATE (Team)-[:SELECTION]->(rd)
    CREATE (cl)-[:PLAYS_IN]->(cn)
    CREATE (tm)-[:SELECTION]->(rd)
    ----

    //graph
  9. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -62,7 +62,7 @@ CREATE (pl)-[:FROM]->(cl)
    CREATE (pl)-[:PICKED_IN]->(rd)
    CREATE (pl)-[:PLAYED_IN]->(cn)
    CREATE (College)-[:PLAYS_IN]->(cn)
    CREATE (Team)-[:SELECTION]->(rd);
    CREATE (Team)-[:SELECTION]->(rd)
    ----

    //graph
  10. David Oliver revised this gist Apr 13, 2017. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -56,13 +56,13 @@ MERGE (tm:Team {name: line.Team})
    MERGE (ps:Position {name: line.Position})
    MERGE (cl:College {name: line.College})
    MERGE (cn:Conference {name: line.Conference})
    CREATE (pl)-[:POSITION_IS]->(ps);
    CREATE (pl)-[:POSITION_IS]->(ps)
    CREATE (pl)-[:TO]->(tm)
    CREATE (pl)-[:FROM]->(cl)
    CREATE (pl)-[:PICKED_IN]->(rd)
    CREATE (pl)-[:PLAYED_IN]->(cn)
    CREATE (College)-[:PLAYS_IN]->(cn)
    CREATE (Team)-[:SELECTION]->(rd)
    CREATE (Team)-[:SELECTION]->(rd);
    ----

    //graph
  11. David Oliver revised this gist Apr 13, 2017. 1 changed file with 10 additions and 10 deletions.
    20 changes: 10 additions & 10 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -51,18 +51,18 @@ CREATE
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (pl:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    //MERGE (rd:Round {id: toInt(line.Round)})
    //MERGE (tm:Team {name: line.Team})
    MERGE (rd:Round {id: toInt(line.Round)})
    MERGE (tm:Team {name: line.Team})
    MERGE (ps:Position {name: line.Position})
    //MERGE (cl:College {name: line.College})
    //MERGE (cn:Conference {name: line.Conference})
    MERGE (cl:College {name: line.College})
    MERGE (cn:Conference {name: line.Conference})
    CREATE (pl)-[:POSITION_IS]->(ps);
    //CREATE (Player)-[:TO]->(Team)
    //CREATE (Player)-[:FROM]->(College)
    //CREATE (Player)-[:PICKED_IN]->(Round)
    //CREATE (Player)-[:PLAYED_IN]->(Conference)
    //CREATE (College)-[:PLAYS_IN]->(Conference)
    //CREATE (Team)-[:SELECTION]->(Round)
    CREATE (pl)-[:TO]->(tm)
    CREATE (pl)-[:FROM]->(cl)
    CREATE (pl)-[:PICKED_IN]->(rd)
    CREATE (pl)-[:PLAYED_IN]->(cn)
    CREATE (College)-[:PLAYS_IN]->(cn)
    CREATE (Team)-[:SELECTION]->(rd)
    ----

    //graph
  12. David Oliver revised this gist Apr 13, 2017. 1 changed file with 31 additions and 18 deletions.
    49 changes: 31 additions & 18 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -23,33 +23,46 @@ RETURN DISTINCT head(labels(a)) AS This, type(r) as To, head(labels(b)) AS That

    image::http://i.imgur.com/Rr4qZi3.png[width=600]

    == Setup
    This domain model diagram was created with the http://www.apcjones.com/arrows/#[Arrows tool]

    ////
    A Cypher query to setup the database
    Please use a small sample of your domain, at most 150 nodes and 200 relationships are enough for the pedagocial example.
    You can link to the setup of a larger dataset or LOAD CSV queries in a second file of your GitHub Gist at the end.
    In your setup query you can also use LOAD CSV loading CSV files from your GitHub Gist, like here: https://gist.github.com/jexp/f78df7b232d0faa171ff
    CREATE
    (`0` :Player {`{name`:'Jared Goff}',`{draftposition`:'1}'}) ,
    (`1` :College {`{name`:'California}'}) ,
    (`2` :Team {`{name`:'Los Angeles Rams}'}) ,
    (`3` :Conference {`{name`:'Pac-12}'}) ,
    (`4` :Position {`{name`:'QB}'}) ,
    (`5` :Round {`{name`:'Round 1}'}) ,
    (`0`)-[:`RELATED_TO`]->(`0`),
    (`0`)-[:`TO`]->(`2`),
    (`0`)-[:`FROM`]->(`1`),
    (`1`)-[:`PLAYS_IN`]->(`3`),
    (`0`)-[:`POSITION_IS`]->(`4`),
    (`0`)-[:`PICKED_IN`]->(`5`),
    (`0`)-[:`PLAYED_IN`]->(`3`),
    (`2`)-[:`SELECTION`]->(`5`)
    ////

    == Setup

    //setup
    //hide
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    MERGE (:Round {id: toInt(line.Round)})
    MERGE (:Team {name: line.Team})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    MERGE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    MERGE (pl:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    //MERGE (rd:Round {id: toInt(line.Round)})
    //MERGE (tm:Team {name: line.Team})
    MERGE (ps:Position {name: line.Position})
    //MERGE (cl:College {name: line.College})
    //MERGE (cn:Conference {name: line.Conference})
    CREATE (pl)-[:POSITION_IS]->(ps);
    //CREATE (Player)-[:TO]->(Team)
    //CREATE (Player)-[:FROM]->(College)
    //CREATE (Player)-[:PICKED_IN]->(Round)
    //CREATE (Player)-[:PLAYED_IN]->(Conference)
    //CREATE (College)-[:PLAYS_IN]->(Conference)
    //CREATE (Team)-[:SELECTION]->(Round)
    ----

    //graph
  13. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -43,7 +43,7 @@ MERGE (:Team {name: line.Team})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    MERGE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
  14. David Oliver revised this gist Apr 13, 2017. 1 changed file with 6 additions and 12 deletions.
    18 changes: 6 additions & 12 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -37,18 +37,12 @@ In your setup query you can also use LOAD CSV loading CSV files from your GitHub
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    CREATE (:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    CREATE (:Round {id: toInt(line.Round)})
    CREATE (:Team {name: line.Team})
    CREATE (:Player {name: line.Player})
    CREATE (:Position {name: line.Position})
    CREATE (:College {name: line.College})
    CREATE (:Conference {name: line.Conference})
    ----
    //setup
    //hide
    [source,cypher]
    ----
    MERGE (:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    MERGE (:Round {id: toInt(line.Round)})
    MERGE (:Team {name: line.Team})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
  15. David Oliver revised this gist Apr 13, 2017. 1 changed file with 12 additions and 7 deletions.
    19 changes: 12 additions & 7 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,13 +44,18 @@ CREATE (:Player {name: line.Player})
    CREATE (:Position {name: line.Position})
    CREATE (:College {name: line.College})
    CREATE (:Conference {name: line.Conference})
    //CREATE (Player)-[:POSITION_IS]->(Position)
    //CREATE (Player)-[:TO]->(Team)
    //CREATE (Player)-[:FROM]->(College)
    //CREATE (Player)-[:PICKED_IN]->(Round)
    //CREATE (Player)-[:PLAYED_IN]->(Conference)
    //CREATE (College)-[:PLAYS_IN]->(Conference)
    //CREATE (Team)-[:SELECTION]->(Round)
    ----
    //setup
    //hide
    [source,cypher]
    ----
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    ----

    //graph
  16. David Oliver revised this gist Apr 13, 2017. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -38,12 +38,19 @@ In your setup query you can also use LOAD CSV loading CSV files from your GitHub
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    CREATE (:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    CREATE (:Round {id: line.Round})
    CREATE (:Round {id: toInt(line.Round)})
    CREATE (:Team {name: line.Team})
    CREATE (:Player {name: line.Player})
    CREATE (:Position {name: line.Position})
    CREATE (:College {name: line.College})
    CREATE (:Conference {name: line.Conference})
    //CREATE (Player)-[:POSITION_IS]->(Position)
    //CREATE (Player)-[:TO]->(Team)
    //CREATE (Player)-[:FROM]->(College)
    //CREATE (Player)-[:PICKED_IN]->(Round)
    //CREATE (Player)-[:PLAYED_IN]->(Conference)
    //CREATE (College)-[:PLAYS_IN]->(Conference)
    //CREATE (Team)-[:SELECTION]->(Round)
    ----

    //graph
  17. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 8 deletions.
    9 changes: 1 addition & 8 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -37,20 +37,13 @@ In your setup query you can also use LOAD CSV loading CSV files from your GitHub
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    CREATE (:Player { name: line.Player, draftposition: toInt(line.`Draft Position`)})
    CREATE (:Player {name: line.Player, draftposition: toInt(line.`Draft Position`)})
    CREATE (:Round {id: line.Round})
    CREATE (:Team {name: line.Team})
    CREATE (:Player {name: line.Player})
    CREATE (:Position {name: line.Position})
    CREATE (:College {name: line.College})
    CREATE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    ----

    //graph
  18. David Oliver revised this gist Apr 13, 2017. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,11 +44,11 @@ CREATE (:Player {name: line.Player})
    CREATE (:Position {name: line.Position})
    CREATE (:College {name: line.College})
    CREATE (:Conference {name: line.Conference})
    CREATE (Person)-[:POSITION_IS]->(Position)
    CREATE (Person)-[:TO]->(Team)
    CREATE (Person)-[:FROM]->(College)
    CREATE (Person)-[:PICKED_IN]->(Round)
    CREATE (Person)-[:PLAYED_IN]->(Conference)
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    ----
  19. David Oliver revised this gist Apr 13, 2017. 1 changed file with 7 additions and 8 deletions.
    15 changes: 7 additions & 8 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -37,14 +37,13 @@ In your setup query you can also use LOAD CSV loading CSV files from your GitHub
    [source,cypher]
    ----
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (:Round {id: line.Round})
    MERGE (:DraftPosition {id: line.`Draft Position`})
    MERGE (:Team {name: line.Team})
    MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (:Person { name: line.Player, year: toInt(line.DraftPosition)})
    CREATE (:Player { name: line.Player, draftposition: toInt(line.`Draft Position`)})
    CREATE (:Round {id: line.Round})
    CREATE (:Team {name: line.Team})
    CREATE (:Player {name: line.Player})
    CREATE (:Position {name: line.Position})
    CREATE (:College {name: line.College})
    CREATE (:Conference {name: line.Conference})
    CREATE (Person)-[:POSITION_IS]->(Position)
    CREATE (Person)-[:TO]->(Team)
    CREATE (Person)-[:FROM]->(College)
  20. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (:Person { name: line.Player, year: toInt(line.DraftPosition)})
    CREATE (Person)-[:POSITION_IS]->(line.Position)
    CREATE (Person)-[:POSITION_IS]->(Position)
    CREATE (Person)-[:TO]->(Team)
    CREATE (Person)-[:FROM]->(College)
    CREATE (Person)-[:PICKED_IN]->(Round)
  21. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -45,7 +45,7 @@ MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (:Person { name: line.Player, year: toInt(line.DraftPosition)})
    CREATE (Person)-[:POSITION_IS]->(Position)
    CREATE (Person)-[:POSITION_IS]->(line.Position)
    CREATE (Person)-[:TO]->(Team)
    CREATE (Person)-[:FROM]->(College)
    CREATE (Person)-[:PICKED_IN]->(Round)
  22. David Oliver revised this gist Apr 13, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ MATCH (a)-[r]->(b) WHERE labels(a) <> [] AND labels(b) <> []
    RETURN DISTINCT head(labels(a)) AS This, type(r) as To, head(labels(b)) AS That LIMIT 10
    ////

    image::http://i.imgur.com/LXOar25.png[width=600]
    image::http://i.imgur.com/Rr4qZi3.png[width=600]

    == Setup

  23. David Oliver revised this gist Apr 12, 2017. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,11 +44,12 @@ MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (:Person { name: line.Player, year: toInt(line.DraftPosition)})
    CREATE (Person)-[:POSITION_IS]->(Position)
    CREATE (Person)-[:TO]->(Team)
    CREATE (Person)-[:FROM]->(College)
    CREATE (Person)-[:PICKED_IN]->(Round)
    CREATE (Person)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    ----
  24. David Oliver revised this gist Apr 12, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,7 +44,7 @@ MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (name.Player)-[:POSITION_IS]->(name.Position)
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
  25. David Oliver revised this gist Apr 12, 2017. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,13 +44,13 @@ MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player.name)-[:POSITION_IS]->(Position.name)
    CREATE (Player.name)-[:TO]->(Team.name)
    CREATE (Player.name)-[:FROM]->(College.name)
    CREATE (Player.name)-[:PICKED_IN]->(Round.name)
    CREATE (Player.name)-[:PLAYED_IN]->(Conference.name)
    CREATE (College.name)-[:PLAYS_IN]->(Conference.name)
    CREATE (Team.name)-[:SELECTION]->(Round.id)
    CREATE (name.Player)-[:POSITION_IS]->(name.Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    ----

    //graph
  26. David Oliver revised this gist Apr 12, 2017. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,13 +44,13 @@ MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    CREATE (Player.name)-[:POSITION_IS]->(Position.name)
    CREATE (Player.name)-[:TO]->(Team.name)
    CREATE (Player.name)-[:FROM]->(College.name)
    CREATE (Player.name)-[:PICKED_IN]->(Round.name)
    CREATE (Player.name)-[:PLAYED_IN]->(Conference.name)
    CREATE (College.name)-[:PLAYS_IN]->(Conference.name)
    CREATE (Team.name)-[:SELECTION]->(Round.id)
    ----

    //graph
  27. David Oliver revised this gist Apr 12, 2017. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -45,6 +45,12 @@ MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    CREATE (Player)-[:TO]->(Team)
    CREATE (Player)-[:FROM]->(College)
    CREATE (Player)-[:PICKED_IN]->(Round)
    CREATE (Player)-[:PLAYED_IN]->(Conference)
    CREATE (College)-[:PLAYS_IN]->(Conference)
    CREATE (Team)-[:SELECTION]->(Round)
    ----

    //graph
  28. David Oliver revised this gist Apr 12, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -44,6 +44,7 @@ MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    CREATE (Player)-[:POSITION_IS]->(Position)
    ----

    //graph
  29. David Oliver revised this gist Apr 12, 2017. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,6 @@ In your setup query you can also use LOAD CSV loading CSV files from your GitHub
    //hide
    [source,cypher]
    ----
    CREATE
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (:Round {id: line.Round})
    MERGE (:DraftPosition {id: line.`Draft Position`})
  30. David Oliver renamed this gist Apr 12, 2017. 1 changed file with 12 additions and 13 deletions.
    25 changes: 12 additions & 13 deletions graph_gist_template.adoc → nfl_draft.adoc
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    = REPLACEME: TITLE OF YOUR GRAPHGIST
    = The 2016 NFL Draft
    :neo4j-version: 2.3.0
    :author: YOUR NAME
    :twitter: @your_twitter_username
    :author: David Oliver
    :twitter: @DaveOliver79
    :style: red:Person(name)

    // Please use the style & syntax-help outlined here: https://github.com/neo4j-contrib/graphgist/blob/master/gists/syntax.adoc
    @@ -21,7 +21,7 @@ MATCH (a)-[r]->(b) WHERE labels(a) <> [] AND labels(b) <> []
    RETURN DISTINCT head(labels(a)) AS This, type(r) as To, head(labels(b)) AS That LIMIT 10
    ////

    image::http://i.imgur.com/5giAsjq.png[width=600]
    image::http://i.imgur.com/LXOar25.png[width=600]

    == Setup

    @@ -37,15 +37,14 @@ In your setup query you can also use LOAD CSV loading CSV files from your GitHub
    [source,cypher]
    ----
    CREATE
    (a:Person {name: 'Alice'}),
    (b:Person {name: 'Bob'}),
    (c:Person {name: 'Carrie'}),
    (d:Person {name: 'David'}),
    (e:Person {name: 'Emily'}),
    (a)-[:FRIENDS_WITH]->(b),
    (a)-[:FRIENDS_WITH]->(e),
    (b)-[:FRIENDS_WITH]->(c),
    (b)-[:FRIENDS_WITH]->(d)
    LOAD CSV WITH HEADERS FROM 'https://gist.githubusercontent.com/davidoliverSP2/716ed3b7155efbe78b5bd41d4c3c523a/raw/bcba24649549b58f44563766cba39bdb8ba2931b/draft_data.csv' AS line
    MERGE (:Round {id: line.Round})
    MERGE (:DraftPosition {id: line.`Draft Position`})
    MERGE (:Team {name: line.Team})
    MERGE (:Player {name: line.Player})
    MERGE (:Position {name: line.Position})
    MERGE (:College {name: line.College})
    MERGE (:Conference {name: line.Conference})
    ----

    //graph