GraphGists

Welcome to the wonderful world of Harry Potter!

v0 of this graph models some of Harrys friends, enemies and their parents. Also have some pets and a few killings. The obvious relation missing is the one between Harry Potter and Voldemort- it took us 7 books to figure that one out, so you’ll have to wait till I add more data :-)

The model

To start with, we’re modeling friends, enemies, parents, pets, and murderers.

The following labels exist in v0:

  • Wizard with property name

  • Witch with property name

  • Muggle with property name

  • Pet Pets with property name,type

  • Being Being with property name,type

harrypotter.wikia.com was used to look up facts that escape memory.

Setup

The graph

match n return n

Exploring the graph

Who are Harrys friends?

match (h:Wizard)-[:FRIEND_OF]-f
where h.name="Harry Potter"
return f.name as friend

Who are Harrys enemies?

match (h:Wizard)-[:ENEMY_OF]-e
where h.name="Harry Potter"
return e.name as enemy

Who are the Muggle borns?

match (w)<-[:PARENT_OF]-(p)
with w, collect(p) as parents
where all(parent in parents where parent:Muggle) and not(w:Muggle)
return distinct w.name as muggleBorn

Who are the Half bloods?

We’ll consider the qualification to be at least one Muggle in the known ancestry

match (w)<-[:PARENT_OF*]-(p)
with w,collect(p) as parents
where any(parent in parents where parent:Muggle)
and (not (all(parent in parents where parent:Muggle))) and not(w:Muggle)
return distinct w.name as halfBlood

Who are Pure bloods?

We’ll consider the qualification to be no Muggles in the known ancestry

match (w)<-[:PARENT_OF*]-(p)
with w,collect(p) as parents
where none(parent in parents WHERE parent:Muggle) and not(w:Muggle)
return distinct w.name as pureBlood

Which friends of Harry Potter are Beings?

match (b:Being)-[:FRIEND_OF]-(harry)
where harry.name="Harry Potter"
return b.name as beingName, b.type as beingType

Which half bloods were killed by enemies of Harry?

match line=(h)<-[:PARENT_OF*]-(p)
with h,collect(p) as parents
where any(parent in parents where parent:Muggle)
and (not (all(parent in parents where parent:Muggle)))  and not(h:Muggle)
with distinct h as halfblood
match halfblood<-[:KILLED]-(enemy)-[:ENEMY_OF]-(harry)
where harry.name="Harry Potter"
return halfblood.name as halfBloodName,enemy.name as enemyName

Which people had love-hate relations with Harry Potter?

match (harry)-[:FRIEND_OF]-(w)-[:ENEMY_OF]-(harry)
where harry.name="Harry Potter"
return w.name as name

Changelog

  • v0

    • Handpicked friends, enemies and their parents

  • Next

    • Houses, Affiliations, Magical characteristics, Magical and dark creatures

Created by Luanne Misquitta: