Skip to content

Instantly share code, notes, and snippets.

@suellenstringer-hye
Forked from stardustnrust/roosevelt
Last active December 16, 2019 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save suellenstringer-hye/b0d7e35b31a985752458 to your computer and use it in GitHub Desktop.
Save suellenstringer-hye/b0d7e35b31a985752458 to your computer and use it in GitHub Desktop.
= Roosevelt Family Geneaology
:neo4j-version: 2.1.0
:author: Suellen Stringer-Hye
:twitter: @suellenshye
:tags: domain:education, use-case:geneaology
== Purpose of Graph
This very simple graph was used to help introduce students to graphing concepts. We started the class with a powerpoint presentation covering the nature of networks and graphs and basic coding for Cypher so that they would be prepared to work on a Neo4j GraphGist on their own by the end of the hour class. Since everyone intuitively understands that family trees are derived from a set of relationships, the class was assigned to fork the below graph.
//graph
=== OUR DATASET
[source, cypher]
----
CREATE
//People
(eleanor:Person{name:'Eleanor Roosevelt'}),
(franklin:Person{name:'Franklin D. Roosevelt'}),
(theodore:Person{name:'Theodore Roosevelt'}),
(teddyjr:Person{name:'Teddy Jr.'}),
//Places
(oyster:Location{name:'Oyster Bay'}),
(hyde:Location{name:'Hyde Park'}),
//Relationships
(eleanor)-[:WAS_WIFE_OF]->(franklin),
(eleanor)-[:WAS_COUSIN_OF]->(franklin),
(eleanor)-[:WAS_NIECE_OF]->(theodore),
(franklin)-[:WAS_HUSBAND_OF]->(eleanor),
(franklin)-[:WAS_COUSIN_OF]->(theodore),
(theodore)-[:WAS_COUSIN_OF]->(franklin),
(teddyjr)-[:WAS_SON]->(theodore),
(theodore)-[:WAS_UNCLE_OF]->(eleanor),
(theodore)-[:WAS_FROM]->(oyster),
(eleanor)-[:WAS_FROM]->(oyster),
(eleanor)-[:WAS_FROM]->(hyde),
(franklin)-[:WAS_FROM]->(hyde)
----
== Class Assignment
We then handed out the following assignment and asked everyone to add additional elements to the family tree.
image::http://www.library.vanderbilt.edu/webimages/assets/roosevelt.jpg[]
== Final Graph
Many students added details from the assignment but many filled in connections from their own knowledge base or just made up fictional details.
=== OUR DATASET
[source, cypher]
----
MATCH
(eleanor:Person{name:'Eleanor Roosevelt'}),
(franklin:Person{name:'Franklin D. Roosevelt'}),
(theodore:Person{name:'Theodore Roosevelt'})
CREATE
//People
(jenny:Person{name:'Jennifer R'}),
(nicholas:Person{name:'Nicholas Roosevelt'}),
(johannes:Person{name:'Johannes Roosevelt'}),
(jacobus:Person{name:'Jacobus Roosevelt'}),
(james:Person{name:'James Roosevelt'}),
(claus:Person{name:'Claus Martenszen Van Rosenvelt'}),
//Places
(nashville:Location{name:'Nashville'}),
(holland:Location{name:'Holland'}),
//Relationships
(jenny)-[:BABYSITTER]->(theodore),
(jenny)-[:EMPLOYED]->(eleanor),
(nicholas)-[:FATHER]->(johannes),
(johannes)-[:FATHER]->(jacobus),
(jacobus)-[:FATHER]->(james),
(james)-[:FATHER]->(theodore),
(claus)-[:FROM]->(holland),
(claus)-[:FATHER]->(nicholas),
(theodore)-[:ATTENDED]->(nashville)
----
//graph
=== Sometime in the Future: Next Class
Now to write some queries!
=== What locations are associated with a Roosevelt?
[source, cypher]
----
MATCH (person)-[:WAS_FROM]->(location)
RETURN person.name AS Name, location.name AS Location;
----
//table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment