an introduc on to neo4j
play

An Introduc/on to Neo4j @iansrobinson - PowerPoint PPT Presentation

An Introduc/on to Neo4j @iansrobinson ian.robinson@neotechnology.com #neo4j Neo4j is a Graph Database #neo4j Neo4j is a Graph Database #neo4j Neo4j is a Graph Database #neo4j


  1. An ¡Introduc/on ¡to ¡Neo4j @iansrobinson ian.robinson@neotechnology.com #neo4j

  2. Neo4j ¡is ¡a ¡Graph ¡Database #neo4j

  3. Neo4j ¡is ¡a ¡Graph ¡Database #neo4j

  4. Neo4j ¡is ¡a ¡Graph ¡Database #neo4j

  5. Neo4j ¡is ¡a ¡Graph ¡Database #neo4j

  6. Neo4j ¡is ¡a ¡Graph ¡Database #neo4j

  7. Nodes ¡& ¡Proper/es #neo4j

  8. Nodes ¡& ¡Proper/es #neo4j

  9. Nodes ¡& ¡Proper/es #neo4j

  10. Rela/onships #neo4j

  11. Rela/onships #neo4j

  12. Neo4j #neo4j

  13. 32 ¡billion ¡nodes 32 ¡billion ¡rela/onships 64 ¡billion ¡proper/es

  14. #neo4j

  15. #neo4j

  16. How ¡do ¡I ¡query ¡the ¡data? hIp://opfm.jpl.nasa.gov/ hIp://news.xinhuanet.com #neo4j

  17. Why ¡Neo4j?

  18. Why ¡Neo4j? Schema-­‑free

  19. Why ¡Neo4j? Schema-­‑free • Complex, ¡densely-­‑connected ¡datasets

  20. Why ¡Neo4j? Schema-­‑free • Complex, ¡densely-­‑connected ¡datasets ACID ¡transac2ons

  21. Why ¡Neo4j? Schema-­‑free • Complex, ¡densely-­‑connected ¡datasets ACID ¡transac2ons • Durable, ¡consistent ¡data

  22. Why ¡Neo4j? Schema-­‑free • Complex, ¡densely-­‑connected ¡datasets ACID ¡transac2ons • Durable, ¡consistent ¡data Performance

  23. Why ¡Neo4j? Schema-­‑free • Complex, ¡densely-­‑connected ¡datasets ACID ¡transac2ons • Durable, ¡consistent ¡data Performance • Millions ¡of ¡‘joins’ ¡per ¡second

  24. 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

  25. from

  26. stole from

  27. stole from enemy

  28. stole from enemy enemy

  29. stole from enemy enemy enemy

  30. stole companion from enemy companion enemy enemy

  31. stole companion loves from loves enemy companion enemy enemy

  32. stole companion loves from loves enemy companion appeared ¡ enemy in enemy appeared ¡ in Victory ¡of ¡ the ¡Daleks

  33. stole companion loves from appeared ¡ loves enemy in companion appeared ¡ in appeared ¡ enemy in enemy appeared ¡ appeared ¡ in A ¡Good ¡Man ¡ in Goes ¡to ¡War Victory ¡of ¡ the ¡Daleks appeared ¡ in

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

  35. 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");

  36. GraphDatabaseService db = new EmbeddedGraphDatabase("/data/drwho"); Node theDoctor = db.createNode(); ENEMY theDoctor.setProperty("name", "The Doctor"); Node daleks = db.createNode(); daleks.setProperty("name", "Daleks"); Node cybermen = db.createNode(); cybermen.setProperty("name", "Cybermen"); ENEMY theDoctor.createRelationshipTo(daleks, DynamicRelationshipType.withName("ENEMY")); theDoctor.createRelationshipTo(cybermen, DynamicRelationshipType.withName("ENEMY"));

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

  38. Cypher ENEMY ENEMY (daleks)<-[:ENEMY]-(doctor)-[:ENEMY]->(cybermen) #neo4j

  39. Cypher ENEMY ENEMY (doctor)-[:ENEMY]->(daleks), (doctor)-[:ENEMY]->(cybermen) #neo4j

  40. Create ¡Graph ¡Using ¡Cypher ENEMY ENEMY CREATE doctor = {name : 'The Doctor'}, daleks = {name : 'Daleks'}, cybermen = {name : 'Cybermen'}, doctor-[:ENEMY]->daleks, doctor-[:ENEMY]->cybermen RETURN doctor; #neo4j

  41. Create ¡Graph ¡Using ¡Cypher ENEMY ENEMY CREATE doctor = {name : 'The Doctor'}, daleks = {name : 'Daleks'}, cybermen = {name : 'Cybermen'}, doctor-[:ENEMY]->daleks, doctor-[:ENEMY]->cybermen RETURN doctor; #neo4j

  42. Dalek ¡Props hIp://www.dalek6388.co.uk/ #neo4j

  43. species:Dalek APPEARED_IN !tle:Power ¡of ¡ the ¡Daleks USED_IN props:Daleks MEMBER_OF MEMBER_OF name:Dalek ¡Six-­‑5 name:Dalek ¡1 name:Dalek ¡2 name:Dalek ¡7 type:shoulders type:skirt

  44. name:Dalek ¡1 name:Dalek ¡2 name:Dalek ¡7 name:Dalek ¡Six-­‑5 ORIGINAL_PROP ORIGINAL_PROP ORIGINAL_PROP ORIGINAL_PROP name:Dalek ¡6 name:Dalek ¡5

  45. !tle:The ¡ !tle:Power ¡of ¡ !tle:The ¡ Dalek ¡ the ¡Daleks Daleks Invasion ¡of ¡ Earth name: name:Dalek ¡1 name:Dalek ¡2 name:Dalek ¡7 Dalek ¡Six-­‑5 name:Dalek ¡Two-­‑1 name:Dalek ¡One-­‑5 name:Dalek ¡Six-­‑7

  46. Supply ¡Chain ¡Traceability #neo4j

  47. APPEARED_IN daleks episode USED_IN MEMBER_OF COMPOSED_OF ORIGINAL_PROP part originalprop

  48. APPEARED_IN daleks episode USED_IN MEMBER_OF COMPOSED_OF ORIGINAL_PROP part originalprop

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

  50. (daleks)-­‑[:APPEARED_IN]-­‑>(episode)<-­‑[:USED_IN]-­‑ ()<-­‑[:MEMBER_OF]-­‑()-­‑[:COMPOSED_OF]-­‑> ¡ APPEARED_IN daleks episode USED_IN MEMBER_OF COMPOSED_OF ORIGINAL_PROP part originalprop

  51. (daleks)-­‑[:APPEARED_IN]-­‑>(episode)<-­‑[:USED_IN]-­‑ ()<-­‑[:MEMBER_OF]-­‑()-­‑[:COMPOSED_OF]-­‑> ¡ (part)-­‑[:ORIGINAL_PROP]-­‑>(originalprop) APPEARED_IN daleks episode USED_IN MEMBER_OF COMPOSED_OF ORIGINAL_PROP part originalprop

  52. Cypher Query START ¡ ¡daleks=node:species(species='Dalek') ¡ MATCH ¡ ¡daleks-­‑[:APPEARED_IN]-­‑>episode<-­‑[:USED_IN]-­‑ ¡ ¡ ¡ ¡ ¡ ¡ ¡()<-­‑[:MEMBER_OF]-­‑()-­‑[:COMPOSED_OF]-­‑> ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡part-­‑[:ORIGINAL_PROP]-­‑>originalprop RETURN ¡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;

  53. Index Lookup START ¡ ¡daleks=node:species(species='Dalek') ¡ MATCH ¡ ¡daleks-­‑[:APPEARED_IN]-­‑>episode<-­‑[:USED_IN]-­‑ ¡ ¡ ¡ ¡ ¡ ¡ ¡()<-­‑[:MEMBER_OF]-­‑()-­‑[:COMPOSED_OF]-­‑> ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡part-­‑[:ORIGINAL_PROP]-­‑>originalprop RETURN ¡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;

  54. Match Nodes & Relationships START ¡ ¡daleks=node:species(species='Dalek') ¡ MATCH ¡ ¡daleks-­‑[:APPEARED_IN]-­‑>episode<-­‑[:USED_IN]-­‑ ¡ ¡ ¡ ¡ ¡ ¡ ¡()<-­‑[:MEMBER_OF]-­‑()-­‑[:COMPOSED_OF]-­‑> ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡part-­‑[:ORIGINAL_PROP]-­‑>originalprop RETURN ¡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;

  55. Return Values START ¡ ¡daleks=node:species(species='Dalek') ¡ MATCH ¡ ¡daleks-­‑[:APPEARED_IN]-­‑>episode<-­‑[:USED_IN]-­‑ ¡ ¡ ¡ ¡ ¡ ¡ ¡()<-­‑[:MEMBER_OF]-­‑()-­‑[:COMPOSED_OF]-­‑> ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡part-­‑[:ORIGINAL_PROP]-­‑>originalprop RETURN ¡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;

  56. In Webadmin

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend