an(introduc/on(to(neo4j - goto...

67
#neo4j An Introduc/on to Neo4j @iansrobinson [email protected]

Upload: others

Post on 16-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

An  Introduc/on  to  Neo4j

@[email protected]

Page 2: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Neo4j  is  a  Graph  Database

Page 3: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Neo4j  is  a  Graph  Database

Page 4: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Neo4j  is  a  Graph  Database

Page 5: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Neo4j  is  a  Graph  Database

Page 6: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Neo4j  is  a  Graph  Database

Page 7: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Nodes  &  Proper/es

Page 8: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Nodes  &  Proper/es

Page 9: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Nodes  &  Proper/es

Page 10: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Rela/onships

Page 11: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Rela/onships

Page 12: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Neo4j

Page 13: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com
Page 14: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

32  billion  nodes32  billion  rela/onships64  billion  proper/es

Page 15: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Page 16: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Page 17: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

How  do  I  query  the  data?

hIp://opfm.jpl.nasa.gov/

hIp://news.xinhuanet.com

Page 18: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Page 19: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free

Page 20: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free• Complex,  densely-­‐connected  datasets

Page 21: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free• Complex,  densely-­‐connected  datasets

ACID  transac2ons

Page 22: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free• Complex,  densely-­‐connected  datasets

ACID  transac2ons• Durable,  consistent  data

Page 23: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free• Complex,  densely-­‐connected  datasets

ACID  transac2ons• Durable,  consistent  data

Performance

Page 24: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free• Complex,  densely-­‐connected  datasets

ACID  transac2ons• Durable,  consistent  data

Performance• Millions  of  ‘joins’  per  second

Page 25: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Why  Neo4j?

Schema-­‐free• Complex,  densely-­‐connected  datasets

ACID  transac2ons• Durable,  consistent  data

Performance• Millions  of  ‘joins’  per  second• Consistent  query  /mes  as  dataset  grows

Page 26: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com
Page 27: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com
Page 28: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

from

Page 29: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

Page 30: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

enemy

Page 31: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

enemy

enemy

Page 32: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

enemy

enemy

enemy

Page 33: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

enemy

enemy

companion

companion

enemy

Page 34: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

lovesloves

enemy

enemy

companion

companion

enemy

Page 35: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

lovesloves

enemy

enemy

Victory  of  the  Daleks

appeared  in

appeared  in

companion

companion

enemy

Page 36: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

stolefrom

lovesloves

enemy

enemyA  Good  Man  Goes  to  War

appeared  in

appeared  in

appeared  in

appeared  in

Victory  of  the  Daleks

appeared  in

appeared  in

companion

companion

enemy

Page 37: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

GraphDatabaseService db = new EmbeddedGraphDatabase("/data/drwho");

Page 38: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

GraphDatabaseService db = new EmbeddedGraphDatabase("/data/drwho");

Node theDoctor = db.createNode(); theDoctor.setProperty("name", "The Doctor"); Node daleks = db.createNode(); daleks.setProperty("name", "Daleks"); Node cybermen = db.createNode(); cybermen.setProperty("name", "Cybermen");

Page 39: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

GraphDatabaseService db = new EmbeddedGraphDatabase("/data/drwho");

Node theDoctor = db.createNode(); theDoctor.setProperty("name", "The Doctor"); Node daleks = db.createNode(); daleks.setProperty("name", "Daleks"); Node cybermen = db.createNode(); cybermen.setProperty("name", "Cybermen"); theDoctor.createRelationshipTo(daleks, DynamicRelationshipType.withName("ENEMY")); theDoctor.createRelationshipTo(cybermen, DynamicRelationshipType.withName("ENEMY"));

ENEMY

ENEMY

Page 40: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

GraphDatabaseService db = new EmbeddedGraphDatabase("/data/drwho");

Transaction tx = db.beginTx();try { Node theDoctor = db.createNode(); theDoctor.setProperty("name", "The Doctor"); Node daleks = db.createNode(); daleks.setProperty("name", "Daleks"); Node cybermen = db.createNode(); cybermen.setProperty("name", "Cybermen"); theDoctor.createRelationshipTo(daleks, DynamicRelationshipType.withName("ENEMY")); theDoctor.createRelationshipTo(cybermen, DynamicRelationshipType.withName("ENEMY"));

ENEMY

ENEMY

Page 41: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Cypher

(daleks)<-[:ENEMY]-(doctor)-[:ENEMY]->(cybermen)

ENEMY ENEMY

Page 42: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Cypher

(doctor)-[:ENEMY]->(daleks),(doctor)-[:ENEMY]->(cybermen)

ENEMY ENEMY

Page 43: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

CREATE doctor = {name : 'The Doctor'}, daleks = {name : 'Daleks'}, cybermen = {name : 'Cybermen'}, doctor-[:ENEMY]->daleks, doctor-[:ENEMY]->cybermenRETURN doctor;

ENEMY ENEMY

Create  Graph  Using  Cypher

Page 44: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

CREATE doctor = {name : 'The Doctor'}, daleks = {name : 'Daleks'}, cybermen = {name : 'Cybermen'}, doctor-[:ENEMY]->daleks, doctor-[:ENEMY]->cybermenRETURN doctor;

ENEMY ENEMY

Create  Graph  Using  Cypher

Page 45: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Dalek  PropshIp://www.dalek6388.co.uk/

Page 46: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

!tle:Power  of  the  Daleks

species:Dalek

APPEARED_IN

USED_INprops:Daleks

name:Dalek  Six-­‐5

name:Dalek  7name:Dalek  2name:Dalek  1

MEMBER_OF MEMBER_OF

type:shoulders type:skirt

Page 47: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com
Page 48: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

name:Dalek  Six-­‐5

name:Dalek  6 name:Dalek  5

ORIGINAL_PROPORIGINAL_PROP

ORIGINAL_PROP ORIGINAL_PROP

name:Dalek  1 name:Dalek  2 name:Dalek  7

Page 49: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com
Page 50: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

!tle:Power  of  the  Daleks!tle:The  

Daleks

!tle:The  Dalek  

Invasion  of  Earth

name:Dalek  Two-­‐1name:Dalek  One-­‐5 name:Dalek  Six-­‐7

name:Dalek  Six-­‐5name:Dalek  1 name:Dalek  2 name:Dalek  7

Page 51: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Supply  Chain  Traceability

Page 52: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

daleks episode

part originalprop

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP

Page 53: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

daleks episode

part originalprop

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP

Page 54: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

(daleks)-­‐[:APPEARED_IN]-­‐>(episode)<-­‐[:USED_IN]-­‐

daleks episode

part originalprop

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP

Page 55: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

(daleks)-­‐[:APPEARED_IN]-­‐>(episode)<-­‐[:USED_IN]-­‐()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>  

daleks episode

part originalprop

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP

Page 56: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

(daleks)-­‐[:APPEARED_IN]-­‐>(episode)<-­‐[:USED_IN]-­‐()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>  (part)-­‐[:ORIGINAL_PROP]-­‐>(originalprop)

daleks episode

part originalprop

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP

Page 57: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

START    daleks=node:species(species='Dalek')  MATCH    daleks-­‐[:APPEARED_IN]-­‐>episode<-­‐[:USED_IN]-­‐              ()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>                part-­‐[:ORIGINAL_PROP]-­‐>originalpropRETURN  originalprop.name  AS  prop,                part.type  AS  part,                count(episode)  AS  episode_count,                collect(episode.2tle)  AS  episodes  ORDER  BY  episode_count  desc  LIMIT  1;

Cypher Query

Page 58: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Index Lookup

START    daleks=node:species(species='Dalek')  MATCH    daleks-­‐[:APPEARED_IN]-­‐>episode<-­‐[:USED_IN]-­‐              ()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>                part-­‐[:ORIGINAL_PROP]-­‐>originalpropRETURN  originalprop.name  AS  prop,                part.type  AS  part,                count(episode)  AS  episode_count,                collect(episode.2tle)  AS  episodes  ORDER  BY  episode_count  desc  LIMIT  1;

Page 59: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Match Nodes & Relationships

START    daleks=node:species(species='Dalek')  MATCH    daleks-­‐[:APPEARED_IN]-­‐>episode<-­‐[:USED_IN]-­‐              ()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>                part-­‐[:ORIGINAL_PROP]-­‐>originalpropRETURN  originalprop.name  AS  prop,                part.type  AS  part,                count(episode)  AS  episode_count,                collect(episode.2tle)  AS  episodes  ORDER  BY  episode_count  desc  LIMIT  1;

Page 60: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

Return Values

START    daleks=node:species(species='Dalek')  MATCH    daleks-­‐[:APPEARED_IN]-­‐>episode<-­‐[:USED_IN]-­‐              ()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>                part-­‐[:ORIGINAL_PROP]-­‐>originalpropRETURN  originalprop.name  AS  prop,                part.type  AS  part,                count(episode)  AS  episode_count,                collect(episode.2tle)  AS  episodes  ORDER  BY  episode_count  desc  LIMIT  1;

Page 61: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

In Webadmin

Page 62: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

The  Hardest  Working  Prop  Part

hIp://www.dalek6388.co.uk/

Dalek  One’s  shoulders

Page 63: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Download

hIp://neo4j.org/download/

Page 64: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Tutorial

hIps://github.com/jimwebber/neo4j-­‐tutorial

Page 65: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

#neo4j

Ques/ons?

@[email protected]

Page 66: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

daleks episode

part originalprop

match  (daleks)-­‐[:APPEARED_IN]-­‐>(episode)<-­‐[:USED_IN]-­‐                        ()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>                          (part)-­‐[:ORIGINAL_PROP]-­‐>(originalprop)  

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP

Page 67: An(Introduc/on(to(Neo4j - GOTO Conferencegotocon.com/.../slides/IanRobinson_AnIntroductionToDoctorWhoand… · #neo4j How(do(Iquery(the(data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com

daleks episode

part originalprop

match  (daleks)-­‐[:APPEARED_IN]-­‐>(episode)<-­‐[:USED_IN]-­‐                        ()<-­‐[:MEMBER_OF]-­‐()-­‐[:COMPOSED_OF]-­‐>                          (part)-­‐[:ORIGINAL_PROP]-­‐>(originalprop)  

APPEARED_IN

USED_IN

MEMBER_OF

COMPOSED_OF

ORIGINAL_PROP