Graph Databases

Using Neo4J

2016-01-08

D Fetterman

What is a graph database?

  • Relational datastore
  • Can be schemaless
  • Nodes
  • Edges / Relationships
  • Properties

Nodes

  • Nouns
  • Label(s) - optional
  • Properties - Key:Value pairs

Person

ID: 100

Name: David

Gender: Male

Job: DBA

Person

ID: 101

Name: Eleanor

Gender: Female

Age: 1

Vehicle

ID: 102

Make: Honda

Model: Accord

Year: 2014

Employee

Relationships

  • Verbs(?)
  • Start and End node
  • Directional
  • Named
  • Properties - optional

Person

ID: 100

Name: David

Vehicle

ID: 101

Make: Subaru

OWNS

ID: 102

Purchased: 2014

Why Graphs

  • Performance
    • Queries tend to be local
    • Scales well compared to 'join-heavy' RDBMS data models
  • Flexibility
    • No enforced schemas
    • Additive data model changes
    • Fewer schema changes = lower maintenance
      • Runtime schema changes?!
  • Agility
    • Data model in the code layer, not the datastore
    • Exposed and testable API's  
    • Plays well in TDD

Interaction:

  • neo4j-shell
  • web interface
    • ​RESTful service
  • ​REST::Neo4p

Examples

  • Movie Graph
    • CLI
    • Web
  • Perl

deck

By davefett

deck

  • 741