• Like
Uploaded on

An introduction to graph databases and Neo4j.

An introduction to graph databases and Neo4j.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,393
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
68
Comments
0
Likes
4

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • How is User A connected to User B?
    Who is the most influential or central in this social network?
  • How many ways can I get from Webpage A to Webpage B?
    What is the shortest path, the longest?
    Which pages would I pass through on my way from A to B?
  • Filter on node label – users.
  • Filter on node label – channels.
  • Filter on node label and property.
  • Relationships.
  • Filter on relationships types – operates.
  • Path identifier – more succinct.
  • Longer paths.
  • Returning entity properties.
  • Aggregate function.
  • Order by.
  • shortestPath

Transcript

  • 1. Intro to Neo4j by Nicole White Data Scientist at Neo4j @_nicolemargaret
  • 2. Agenda What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 3. What is a Graph?
  • 4. Are These Graphs? 0 1 2 3 4 5 6 Category 1 Category 2 Category 3 Category 4 Series 1 Series 2 Series 3 0 2 4 6 8 10 12 14 Category 1 Category 2 Category 3 Category 4 Series 1 Series 2 Series 3 What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 5. This is a Graph What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps Node Relationship
  • 6. Twitter Social Graph What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 7. Internet Graph What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 8. What is Neo4j?
  • 9. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 10. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 11. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps language:’Swedish’ open_source:true year:2007 The Property Graph
  • 12. Neo4j Recommendations eHarmony Glassdoor Logistics eBay shutl Content Management OneFineStay Lufthansa Customers neo4j.com/customers What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 13. Data Modeling
  • 14. A Journey from SQL to Graph What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 15. Example: YouTube in SQL ID Name 1 Alice 2 Bob 3 Charles 4 David What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps ID Name 1 Bob’s Gaming Channel 2 Bob’s Cute Dog 3 Cooking with Charles 4 David’s How-To Channel 5 Disco Dancing with David User ID Channel ID 2 1 2 2 3 3 4 4 4 5 USERS CHANNELS USERS_CHANNELS User ID Channel ID 1 3 1 4 2 3 2 5 3 1 USERS_SUBSCRIPTIONS
  • 16. Example: YouTube in a Graph What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED
  • 17. Cypher Query Language
  • 18. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (n) RETURN n;
  • 19. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (u:User) RETURN u;
  • 20. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (c:Channel) RETURN c;
  • 21. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (bob:User {name:’Bob’}) RETURN bob;
  • 22. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (u:User)-[r]->(c:Channel) RETURN u, r, c;
  • 23. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (u:User)-[r:OPERATES]->(c:Channel) RETURN u, r, c;
  • 24. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH p=(:User)-[:OPERATES]->(:Channel) RETURN p;
  • 25. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH p=(:User {name:’Bob’})-[:OPERATES]->(:Channel)<-[:SUBSCRIBED]-(:User) RETURN p;
  • 26. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (u:User)-[r]->(c:Channel) RETURN u.name, TYPE(r), c.name;
  • 27. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (:User {name:’Bob’})-[:OPERATES]->(c:Channel) RETURN COUNT(c);
  • 28. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH (u:User)-[:OPERATES]->(c:Channel) RETURN u.name, COUNT(c) AS channels ORDER BY channels DESC;
  • 29. What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps name:’Alice’ name:’Bob’ name:’Charles’ name:’David’ name:’Cooking with Charles’ name:’David’s How-To Channel’ name:’Disco Dancing with David’ name:’Bob’s Gaming Channel’ name:’Bob’s Cute Dog’ User Channel SUBSCRIBED MATCH p=(:User {name:'Charles'})-[*1..4]-(:User {name:'David'}) RETURN p LIMIT 1;
  • 30. Uniqueness Constraints CREATE CONSTRAINT ON (u:User) ASSERT u.name IS UNIQUE; CREATE CONSTRAINT ON (c:Channel) ASSERT c.name IS UNIQUE;
  • 31. Download the Cypher Refcard bit.ly/cypher-refcard
  • 32. Neo4j Browser Demo
  • 33. Next Steps
  • 34. Download Neo4j What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps neo4j.com
  • 35. Choose a Driver neo4j.com/contrib What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 36. Join the Community bit.ly/neo4j-google @neo4j #neo4j What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps neo4j.meetup.com
  • 37. Come to the RNeo4j Meetup • Tuesday, September 9th, 2014 • 6:00-7:30PM • In this room • bit.ly/graphs-r-cool What is a Graph? What is Neo4j? Data Modeling Cypher Query Language Neo4j Browser Demo Next Steps
  • 38. October 22, 2014 SF Jazz Innovate. Share. Connect. Register @ graphconnect.com Discount for Meetup attendees: SFLOCAL200