open:graph-model

Graph Model

  • Entity-Tables become Nodes
  • Foreign Keys become Relationships
  • Link Tables become Relationships
  • Remove artificial Primary Keys and Foreign Keys

select movie.title
from actors join actor_movie on (...) join movies on (...)
where actors.name = "Andreas"

// find starting points
MATCH (:Person {name:'Andreas'})
// then traverse the relationships
      -[:ACTED_IN]->(movie:Movie)
      <-[:ACTED_IN]-(other:Person)
// and return results
RETURN other

  • Cannot model or store data and relationships without complexity
  • Performance degrades with number and levels of relationships, and database size
  • Query complexity grows with need for JOINs
  • Adding new types of data and relationships requires schema redesign, increasing time to market

When data relationships are valuable in real-time traditional database aren't the best choice.

Find all reports and how many people they manage, up to 3 levels down.

MATCH (boss)-[:MANAGES*0..3]->(mgr)

WHERE boss.name = "John Doe"
AND (mgr)-[:MANAGES]->()

RETURN mgr.name as Manager,
       size((mgr)-[:MANAGES*1..3]->()) AS Total

  • Model your data naturally as a graph of data and relationships
  • Drive graph model from domain and use-cases
  • Use relationship information in real-time to transform your business
  • Add new relationships on the fly to adapt to your changing requirements
  • Relationships are first class citizen
  • No need for joins, just follow pre-materialized relationships of nodes
  • Query & Data-locality - navigate out from your starting points
  • Only load what's needed
  • Aggregate and project results as you go
  • Optimized disk and memory model for graphs
  • open/graph-model.txt
  • 마지막으로 수정됨: 2021/06/29 00:16
  • 저자 127.0.0.1