Skip to content

Instantly share code, notes, and snippets.

@jexp
Forked from Pimsepinnen/peoplebooksandcities
Last active December 31, 2015 17:39
Show Gist options
  • Select an option

  • Save jexp/8021341 to your computer and use it in GitHub Desktop.

Select an option

Save jexp/8021341 to your computer and use it in GitHub Desktop.
= People, books and cities
== Modeling the Graph
Let's take a look at the domain model:
image::http://i.imgur.com/TJCNW0b.jpg?1[]
//setup
//hide
[source, cypher]
----
CREATE
//People
(jane:Person{name:'Jane'}),
(mike:Person{name:'Mike'}),
(steve:Person{name:'Steve'}),
(lisa:Person{name:'Lisa'}),
(stella:Person{name:'Stella'}),
(jim:Person{name:'Jim'}),
//Books
(pride_and_prejudice:Book:Classic {title:'Pride and Prejudice'}),
(_1984:Book:Fantasy {title:'1984'}),
(emma:Book:Classic {title:'Emma'}),
(sofies_world:Book:Philosophy {title:'Sofies World'}),
(dracula:Book:Horror {title:'Dracula'}),
(of_mice_and_men:Book:Classic {title:'Of mice and men'}),
(les_miserable:Book:Classic {title:'Les Miserable'}),
(life_of_pi:Book:Animee {title:'Life of Pi'}),
//Cities
(malmo:City{name:'Malmo'}),
(stockholm:City{name:'Stockholm'}),
(san_francisco:City{name:'San Francisco'}),
(london:City{name:'London'}),
(paris:City{name:'Paris'}),
//Read
(lisa)-[:READ]->(pride_and_prejudice),
(lisa)-[:READ]->(sofies_world),
(lisa)-[:READ]->(emma),
(mike)-[:READ]->(emma),
(lisa)-[:READ]->(les_miserable),
(steve)-[:READ]->(of_mice_and_men),
(jim)-[:READ]->(of_mice_and_men),
(mike)-[:READ]->(life_of_pi),
(stella)-[:READ]->(dracula),
(stella)-[:READ]->(_1984),
(jim)-[:READ]->(life_of_pi),
(jim)-[:READ]->(les_miserable),
(jim)-[:READ]->(_1984),
(stella)-[:READ]->(_1984),
(jim)-[:READ]->(life_of_pi),
//LIVES_IN
(lisa)-[:LIVES_IN]->(paris),
(mike)-[:LIVES_IN]->(stockholm),
(stella)-[:LIVES_IN]->(san_francisco),
(jane)-[:LIVES_IN]->(malmo),
(jim)-[:LIVES_IN]->(london),
//RELATIONSHIPS
(jim)-[:KNOW]->(jane),
(jim)<-[:KNOW]-(jane),
(stella)-[:FRIEND_WITH]->(jane),
(stella)<-[:FRIEND_WITH]-(jane),
(stella)<-[:FATHER_OF]-(steve),
(mike)<-[:MARRIED_TO]-(steve),
(mike)-[:MARRIED_TO]->(steve),
(mike)<-[:SISTER_TO]-(lisa)
RETURN london as node
----
//graph
== Fairy Tales
[quote, Audrey Hepburn]
____
If I'm honest I have to tell you I still read fairy-tales and I like them best of all.
____
// todo
image::https://dl-web.dropbox.com/get/Pim%20shared%20w%20the%20world/audreyread.jpg?w=AADDdVCy3-g4qmbDTHZ55DnkSSc2UFxUfWqTmkwVK7gA9A¢[]
// todo some queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment