8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

グラフDB入門

Last updated at Posted at 2018-04-19

DB分野で、RDBやNoSQLに続くデータベースとして候補に上がるグラフDBを、Cassandra上で少し触ってみたので、まとめます。

特徴・用途

  • オブジェクト間の関係の探索に特化しており、同じ事をやろうとした時のRDBのJOIN負荷を、大幅に下げてくれそうな印象

  • 考えられる用途: レコメンデーションエンジン、運輸物流の最適経路探索など

用語

  • vertex (頂点)
    グラフDBの「管理対象」で、名詞で表現される
    例)人物、場所、料理レシピ

  • edge (エッジ)
    頂点間の「関係」で、方向性を持つものもある。動詞で表現される
    例)人がソフトウェアを開発する、著者が本を書く

  • property(プロパティ)
    頂点やエッジの持つ「属性」
    例)著者名、レビュー記入日時

主要な製品
Neo4j、Oracle Spatial and Graph、DataStax DSE Graph 等  

グラフDBのイメージ例 (料理レシピ本)
Graph.JPG

試した環境(DataStax DSE Graph)
https://docs.datastax.com/ja/datastax_enterprise-jajp/5.0/datastax_enterprise/graph/QuickStartStudio.html

大まかな流れ

  • 頂点(例:author、Book)及びエッジ(例:author-writes/authored-Book)の作成
  • 各頂点と各エッジへのデータ挿入(エッジの例:特定Recipeは特定Bookに含まれる)

Graph.png

感想

各エッジ「関係」へのデータ挿入が行われている事で、後からエッジのキーを元にエンティティ同士の関係性を追いかけやすい、レコメンデーション向きなモデルである印象を受けました。

8
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?