Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
= 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
You can’t perform that action at this time.