Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Graphs and Neo4j

Praveena
September 28, 2016

Introduction to Graphs and Neo4j

Intro to neo4j

Praveena

September 28, 2016
Tweet

More Decks by Praveena

Other Decks in Programming

Transcript

  1. Welcome to NEO4J - Week 1 of 3 - Intro

    to Graphs Grab a drink/snack and say hi to your neighbour! Wifi: neo4j / GraphConnectLondon If you’ve got a laptop download neo4j from neo4j.com/download
  2. Neo4j Graph databases & neo4j - have heard the terms,

    but don't really know what they're about. Learn about use cases of Neo4j, how is working with it, architecture, etc. The potential of neo4j Graph database How to create some Graphs with Neo4j Databases and how they can be used. Neo4J Graph Database and Document Databases Neo4 in practice How to use graph databases practically. About graph databases, how and where are they used in industries (use cases, real life scenarios etc.), how are they different from other types of databases, and how to create them. Applications of graph databases and how to structure them New skills and using graph databases in practice Visualisation More about databases and translating that into visual data (aka graphs) Data viz Your expectations
  3. What is a database? database ˈdeɪtəbeɪs/ noun a structured set

    of data held in a computer, especially one that is accessible in various ways. Ex:"a database covering nine million workers" An example of a database is where A-Level results are stored before they are printed out and published to students.
  4. Evolution of Databases • Unit Records and Punch Cards •

    File Systems • Hierarchical DBMS • Network DBMS • Relational Databases • Object Oriented Databases • NoSQL Source: http://avant.org/project/history-of-databases/
  5. What’s a graph database? Simply put, a graph consists of

    nodes connected by relationships. Graph databases store data as graph structures (nodes and relationships)
  6. CAR Property Graph Model Components Nodes • Represent the objects

    in the graph • Can be labeled PERSON PERSON
  7. CAR DRIVES Property Graph Model Components Nodes • Represent the

    objects in the graph • Can be labeled Relationships • Relate nodes by type and direction LOVES LOVES LIVES WITH OW NS PERSON PERSON
  8. CAR DRIVES name: “Dan” born: May 29, 1970 twitter: “@dan”

    name: “Ann” born: Dec 5, 1975 since: Jan 10, 2011 brand: “Volvo” model: “V70” Property Graph Model Components Nodes • Represent the objects in the graph • Can be labeled Relationships • Relate nodes by type and direction Properties • Name-value pairs that can go on nodes and relationships. LOVES LOVES LIVES WITH OW NS PERSON PERSON
  9. Summary of the graph building blocks • Nodes - Entities

    and complex value types • Relationships - Connect entities and structure domain • Properties - Entity attributes, relationship qualities, metadata • Labels - Group nodes by role
  10. Cypher: Graph Query Language MATCH (:Person { name:"Dan"} ) -[:LOVES]->

    (:Person { name:"Ann"} ) LOVES Dan Ann LABEL PROPERTY NODE NODE LABEL PROPERTY
  11. Nodes () or (n) • Surrounded with parentheses • Use

    an alias n to refer to our node later in the query
  12. Nodes () or (n) • Surrounded with parentheses • Use

    an alias n to refer to our node later in the query (n:Label) • Specify a Label, starting with a colon : • Used to group nodes by roles or types (similar to tags)
  13. Nodes () or (n) • Surrounded with parentheses • Use

    an alias n to refer to our node later in the query (n:Label) • Specify a Label, starting with a colon : • Used to group nodes by roles or types (similar to tags) (n:Label {prop: 'value'}) • Nodes can have properties
  14. --> or -[r:TYPE]-> • Wrapped with hyphens & square brackets

    • A relationship type starts with a colon : Relationships
  15. --> or -[r:TYPE]-> • Wrapped with hyphens & square brackets

    • A relationship type starts with a colon : < > Specify the direction of the relationship -[:KNOWS {since: 2010}]-> • Relationships can have properties too! Relationships
  16. • Find Alice who knows Bob • In other words:

    • find Person named 'Alice' • who KNOWS • a Person named 'Bob' (p1:Person {name:'Alice'})-[:KNOWS]->(p2:Person {name:'Bob') Patterns
  17. Once you download, For setup you will be asked to

    give a default location. Click start! You are good to go. Goto Browser type http://localhost:7474 Enter default password: neo4j Instructions
  18. Sample Queries to try out // Find the Matrix MATCH

    (movie:Movie {title:"The Matrix"}) RETURN movie // Find the people who acted in any movie and return their name and // the role they played in the movie MATCH (actor:Person)-[rel:ACTED_IN]->(movie:Movie) RETURN rel.roles, actor.name
  19. How Customers Use Neo4j Network & Data Center Master Data

    Management Social Recommendations Identity & Access Search & Discovery GEO
  20. Neo4j ✓Graph databases & neo4j - have heard the terms,

    but don't really know what they're about. ✓Learn about use cases of Neo4j, how is working with it, architecture, etc. The potential of neo4j ✓Graph database ✓How to create some Graphs with Neo4j ✓Databases and how they can be used. Neo4J Graph Database and Document Databases Neo4 in practice How to use graph databases practically. ✓About graph databases, how and where are they used in industries (use cases, real life scenarios etc.), how are they different from other types of databases, and how to create them. Applications of graph databases and how to structure them New skills and using graph databases in practice Visualisation ✓More about databases and translating that into visual data (aka graphs) Data viz Your expectations
  21. Thank you :) Contact us: @markhneedham @praveenasekhar Feedback here ->

    bit.ly/wwc-neo4j Join neo4j.com/slack - we’ll be using it next week
  22. Resources • Online Training - https://neo4j.com/online_training/graphdatabases • Graph Databases Book

    - http://graphdatabases.com/ • Meetup group - https://www.meetup.com/graphdb-london/ • Slack channel - http://neo4j.com/slack • Stack Overflow - http://stackoverflow.com/tags/neo4j