Movatterモバイル変換


[0]ホーム

URL:


Takahiro Inoue, profile picture
Uploaded byTakahiro Inoue
PDF, PPTX50,020 views

「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜

The document discusses graph databases and their properties. Graph databases are structured to store graph-based data by using nodes and edges to represent entities and their relationships. They are well-suited for applications with complex relationships between entities that can be modeled as graphs, such as social networks. Key graph database technologies mentioned include Neo4j, OrientDB, and TinkerPop which provides graph traversal capabilities.

Embed presentation

Download as PDF, PPTX
Graph DB       GraphDB doryokujin+WEB          ( Tokyo.Webmining #9-2)
[Me]       doryokujin                    2                        2       33[Company]                            1
[   ]    MongoDB JP    TokyoWebMining   MongoDB[         ]    MongoDB              MongoDB GraphDB
#1[MongoTokyo]    Mongo DB Congerence in Japan    2011 03   01    10gen             3                                    …                http://www.10gen.com/conferences/    mongotokyo2011
#2[gihyo     ]    gihyo.jp    2         DocumentDB    GraphDB               NoSQL
Graph          GraphGraph DB   Graph Traversal          Graph DB   Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop   Gremlin, Blueprints, Pipes, Rexster, Mutant
GraphGraph          GraphGraph DB   Graph Traversal          Graph DB   Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop   Gremlin, Blueprints, Pipes, Rexster, Mutant
Graph:      GraphGraph     DB        Graph
Graph[Graph]     Dots          Lines            vertices           edges                        1        (relationship)                       Dots   Lines       Graph
Undirected Graph[    (Undirected)Graph] Vertices: Edges:    (relationship)    (symmetric)
Directed Graph[       (Directed) Graph]    Vertices:    Edges:       (relationship)       (asymmetric)
Directed / Underected Graph         friend                                     follow                           friend                                         follow                                                               followfriend                                     follow         [Facebook]                                 [Twitter]                      ”Undirected Graph”              Follow            ”Directed Graph”                  ”        ”                                   ”           ”                      ”friends”                                    ”follow”
Single-Relational GraphSingle-Relational Structures   →   Undirected / Directed Graph    Single-Relatinal    1     Graph
Single-Relational Graph         friend                                     follow                           friend                                         follow                                                               followfriend                                     follow         [Facebook]                                 [Twitter]                      ”Undirected Graph”              Follow            ”Directed Graph”                  ”Facebook         ”                          ”Twitter            ”                      ”friends”                                    ”follow”
Single-Relational                           Reply                           num:5                   Reply                   Block                   num:5                                                   Reply            DM                                                   num:5           num:1                            RT         RT Reply    DM                           num:2      num:2 num:2   num:1                              [Twitter]                                   Graph    ”Directed Graph”                                           ”Twitter        ”                                           ”Reply”,”RT”,”DM”,”Block”
*Facebook        Flickr                               lives_in                                           is             is     is                                                                                follow    lives_in                         friend                                                                   is                                           share *                                  friend        share          follow     follow               is[                                      ]                                                           lives_in    Undirected      Directed                                                     is        is                                                is                                                                           lives_in
Multi-Relational GraphMulti-Relational Structures      lives_in: User → Country      Share: Facebook → Flikcr
Multi-Relational                      Reply              Reply           Block         DM                           Reply                       RT     RTReply   DM                            [Twitter]                                              ”Twitter      ”                                              ”Reply”,”RT”,”DM”,”Block”
Multi-Relational                                                             *Facebook        Flickr                     lives_in                                has                   has                                               has                                                                     follow lives_in                   friend                                                              has                     share *            has             friend       share              follow                                                                                        lives_in[Multi-Relatinal Graph]                                     has has         has                                                                 lives_in
Property Graph  Property Graph           Multi-Relational Graph                        (Property)                      Graph DB             Graph           1                         key/value   id          id_A                     follow                id      id_Bfollow         100                                         follow     500follower       200               date       2011/01/23     follower   1000
Property Graph                          Reply                          num:5                  Reply                   Block                  num:5                                                  Reply           DM                                                  num:5          num:1                           RT         RTReply    DM                          num:2      num:2num:2   num:1                                  Graph    ”Property Graph”                                          ”Twitter        ”                                          ”Reply”,”RT”,”DM”,”Block”                                            ”num”
Property Graph                                                                                name      doryokujin                                                                                sex           man                                           lives_in                             birth     1985/05/14                                                              has                       has                                        id        id_B                                                                                                                follow          follow       1000                                                                                                                                follower     2000lives_in                   date         2011/01/23                           friend                                                                                                   has                                               friend                                        date     2011/01/23           has                                         friend                    follow                follow                                                                         date    2010/03/23             date       2011/01/23                 name         full name                  mail        xxx@yyy                 address          zzz                                                                                                                                        lives_in                                                                                                           id          id_A                                                                                                         follow         100                                                                                                        follower        200                                                                has                 has                                                     date   2010/03/23                                                                                                       lives_in
Graph   The Graph Traversal Pattern
Property Graph    Property Graph        Graph    Property Graph      Graph DB           Tinker Pop                        Hyper Graph
Graph DBGragh          GraphGraph DB   Graph Traversal          Graph DB   Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop   Gremlin, Blueprints, Pipes, Rexster, Mutant
Graph DB:   Property Graph           DB“Graph DB”
Graph DB[            DB ≠ Graph DB]    Graph              DB                DB Graph DB
RDB            Graph[Relatinal Database]           AoutV          inV A              B         B        C A              C C              D                               D D              A
Document DB             Graph       [Document Database]             A{    A : {      out : [B, C], in : [D]    }    B : {      in : [A]                 B           C    }    C : {      out : [D], in : [A]    }    D : {      out : [A], in : [C]              D    }}
XML DB                   Graph    [XML Database]                       A<graphml><graph><node id=A /><node id=B />                     B          C<node id=C /><edge source=A   target=B   /><edge source=A   target=C   /><edge source=C   target=D   /><edge source=D   target=A   /></graph>                                 D</graphml>
Graph DB[   ]“A graph database is any storage system   that provides index-free adjacency”                   The Graph Traversal Programming Pattern              (“adjacent”)                             ( “index-free” )
Non-Graph DB and                 Index-Based Adjacency                                                          B   E                            1. A                                               3. (B,C)                                   A A         B      CB, C       E     D, E                        D      E                                        2.                                                          C   D     log_2(n)                          (B,C)     time cost
Graph DB and                Index-Free Adjacency‣    ”Mini - Index”                                            B   E‣                                     1.        1                       A                                    (B,C)‣                                            C   D                 id      id_B              follow     1000              follower   2000
Property (key/value)   The Graph Traversal Programming Pattern
GraphDB: Graph Traversal      Graph DBGraph DB         Query
Graph DB       QueryGraph Query = Graph Traversal   Traversal =   Root   Graph   Graph Traversal    (Root)                         Index-Free Adjacency
private  void  printFriends(  Node  person  ){        Traverser  traverser  =  person.traverse(                Order.BREADTH_FIRST,    //                  StopEvaluator.END_OF_GRAPH,  //  Graph                ReturnableEvaluator.ALL_BUT_START_NODE,  //  Root  Node                MyRelationshipTypes.KNOWS,  //  ”KNOWS”                Direction.OUTGOING  );  //          for  (  Node  friend  :  traverser  )        {      //         Node         ”name”                System.out.println(  friend.getProperty(  "name"  )  );        }                                                                                                  Neo4j Wiki}
1                                  31         2    Trinity    Morpheus    Cypher    Agent  Smith                         Neo4j Wiki
private  void  findHackers(  Node  startNode  )                                                                               Neo4j Wiki{        Traverser  traverser  =  startNode.traverse(                Order.BREADTH_FIRST,  //                  StopEvaluator.END_OF_GRAPH,  //  Graph                new  ReturnableEvaluator()  //                  {                        public  boolean  isReturnableNode(  TraversalPosition  currentPosition  )                        {                                Relationship  rel  =  currentPosition.lastRelationshipTraversed();                                if  (  rel  !=  null  &&  rel.isType(  MyRelationshipTypes.CODED_BY  )  )                                {                                        return  true;  //            “CODED_BY”                                  }                                return  false;  //                          }                },  //                                    2                MyRelationshipTypes.CODED_BY,  Direction.OUTGOING,  //                  MyRelationshipTypes.KNOWS,  Direction.OUTGOING  );  //          for  (  Node  hacker  :  traverser  )        {                TraversalPosition  position  =  traverser.currentPosition();                System.out.println(  "At  depth  "  +  position.depth()  +  "  =>  "                        +  hacker.getProperty(  "name"  )  );        }                                                                             ∴  At  depth  4  =>  The  Architect
Graph DB[Data Locality]        [Local Search, Social Network]   2        [Transition]       Web        [Recommendation]
[Graph Problems]    [Shortest Path]   2GraphDB                   Traversal                                  Neo4jrb
Graph DB               ”       ”                       10         ”Knows”  Tables, Documents, Key/Value Model  GraphDB                              Union,  Intersection, Join
Graph DB[     ]           Property Graph    Index-Free Adjacency    Graph Query = Graph Traversal    Data Locality
Graph DBGraph          GraphGraph DB   Graph Traversal          Graph DB   Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop   Gremlin, Blueprints, Pipes, Rexster, Mutant
Neo4j
Neo4j[   ] HP    Java                  AGPLv3    2003     24                     8    2009     VC    ACID    Propety Graph Model / Gremlin    Lucene
Neo4j[Language Binding - Framework]    Python - Django    Ruby - Ruby on Rails    Clojure    Scala    Groovy - Griffin / Grails    Java - Spring Framework                  Ruby           Ruby Java
Neo4j[Tools]     Shell        Shell    Graph   Traverse Indexing     neo4j-server        Neo4j REST API        Admin tools     Online BackUp     Neoclipse        Neo4j                                ↑     Batch Insert
Neo4j[ver. 1.2]                 1.2     Neo4j Server         REST API         Admin Interface     High Availability     Kernel
sones
sones[   ] HP    C#                  AGPLv3    2011     VC    ACID    REST Interface    Property Graph Model / Gremlin               : Property Hyper Graph    Graph Query Language(GQL)
sones    [GQL]       SQL             Traversal       Cheat Sheet                             Query• FROM User SELECT User.Friends.Friends.Name// aggregation• SELECT COUNT(User.Friends)• SELECT User.Friends.Random(2)• SELECT User.Friends.Name.Substring(2,5)
Orient DB
Orient DB[   ] HP    Java                  Apache2.0    1997               C++ → Java    Document-Graph DB    ACID    Shell / REST Interface    Propety Graph Model / Gremlin
Orient DB     [Document-Graph DB]              [    ] Orient DB                Object DB  Key/Value              Server                         Document DB// DATABASE   OPENODatabaseDocumentTx db = new ODatabaseDocumentTx("remote:localhost/petshop").open("admin", "admin");//      DocumentODocument doc = new ODocument(db, "Person");doc.field( "name", "Luke" );doc.field( "surname", "Skywalker" );doc.field( "city", new ODocument(db, "City").field("name","Rome").field("country","Italy") );             //      Transactiondoc.save();db.close();
Orient DB      [Document-Graph DB]                 OGraphVertex               OGraphEdge                  OGraphElement           ODocumentWrapper                        Document           SQLSELECT FROM OGraphVertex WHERE outEdges CONTAINS ( label = 'knows' )//7           ”knows”SELECT FROM OGraphVertex WHERE outEdges TRAVERSE(0,7,'out,outEdges')( @class = 'OGraphEdge' and label = 'knows' )
Orient DB[Language Binding Using Binary Protocol]    Java    C    PHP    JRuby (Ruby: soon)[Language Binding Using REST Protocol]    Python    Java Script
InfoGrid
InfoGrid    [    ] HP        JAVA                           AGPLv3        ACID        REST Interface        MeshObject GraphMeshBase _GDB = StoreMeshBase.create(_MySQLStore);MeshObject _xkcd = _GDB.getMeshObjectLifecycleManager().createMeshObject();_xkcd.setProperty("Name", "xkcd");_xkcd.setProperty("Url", "http://www.xkcd.com");_xkcd.relate(_good)
Infinite Graph
Infinite Graph[   ] HP    C++                                 Academic and Start    Up    2010   6    Distributed Graph DB    ↑Objectivity/DB: distributed database server
Graph DB:                                                Data                                    SQL LikeGraphDB      License    Language   Protocol                  Gremlin    Binding                                                Model                                    Query                                   REST/       Property                Ruby, Python, Neo4j      AGPLv3        Java                                 Yes                                                                         Scala,...                                                                                           -                                   JSON         Graph                                   REST/       Property sones      AGPLv3        C#        JSON        Graph          Yes           -            Yes                                   (XML)      (+Extend)                                   REST/       Property                 PHP, Jruby,OrientDB    Apache2.0     Java                                 Yes                                                                       Python, JS,...                                                                                          Yes                                   JSON         Graph                                                Property                                   REST/Info Grid   AGPLv3        Java                  Graph?          -            -             -                                   JSON       (MeshObject) Infinite                                       Property             Product      C++         -                         -            -             -  Graph                                         Graph
Graph DB[      ]    Graph DB                     Neo4j    Open Source Social Graph Software Not Ready Yet                       Graph DB       Hypergtaph: PropertyGraph                 HyperGraph       Pregel: bulk synchronous parallel model                Distributed DB       Google       FlockDB: Distributed DB for storing adjancency lists     Twitter
Tinker PopGraph          GraphGraph DB   Graph Traversal          Graph DB   Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop   Gremlin, Blueprints, Pipes, Rexster, Mutant
Tinker Pop
Tinker Pop[Tinker Pop] HP                      Property Graph Model         GraphDB       Blueprints: A Property Graph Model Interface       Gremlin: A Graph Traversal Language       Pipes: A Data Flow Framework using Process Graphs       Rexster: A RESTful Graph Shell       Mutant: A Poly-ScriptEngine ScriptEngine
Tinker Pop
Tinker Pop: BluePrints
BluePrints[       ] HP        GraphDB      ”JDBC”Property Graph Model                 GraphDB[Now]               Tinker Graph: in-memory property graph model               Sail: Open RDF               Neo4j, Orient DB, sones, ...[Future]               Redis               Infinite Graph, Dex
BluePrints      GraphDBGraph graph = new Neo4jGraph("/tmp/graph/neo4j");// Graph graph = new OrientGraph("/tmp/graph/orientdb");Vertex a = graph.addVertex(null);Vertex b = graph.addVertex(null);a.setProperty("name","marko");b.setProperty("name","aaron");Edge e = graph.addEdge(null,a,b,"knows");e.setProperty("since",2010);graph.shutdown();
BluePrints     Transactiongraph.startTransaction();try{  Vertex luca = graph.addVertex(null);  luca.setProperty( "name", "Luca" );  Vertex marko = graph.addVertex(null);  marko.setProperty( "name", "Marko" );  Edge lucaKnowsMarko = graph.addEdge(null, luca, marko,"knows");  graph.stopTransaction(Conclusion.SUCCESS);} catch( Exception e ) {  graph.stopTransaction(Conclusion.FAILURE);}
Tinker Pop: Gremlin
Gremlin[     ] HPGremlin = Graph Programing LanguageBlueprints               GraphDBShell    GraphDB      QueryJava + Groovy
GremlinProperty Graph                           Basic Graph Traversals
doryokujin$ ./gremlin.sh         ,,,/         (o o)-----oOOo-(_)-oOOo-----gremlin>  g  =  TinkerGraphFactory.createTinkerGraph()==>tinkergraph[vertices:6  edges:6]  //        6     6gremlin>  g.class==>class  com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphgremlin>  //  gremlin>  g.V==>v[3]==>v[2]...gremlin>  //  gremlin>  g.E==>e[10][4-­‐created-­‐>5]==>e[7][1-­‐knows-­‐>2]==>e[9][1-­‐created-­‐>3]...                                                      Getting Srarted
gremlin>  v  =  g.v(1)  //  id=1  ==>v[1]gremlin>  v.keys()  //  ==>age==>namegremlin>  v.values()  //  ==>29==>markogremlin>  v.name  +  '  is  '  +  v.age  +  '  years  old.'==>marko  is  29  years  old.gremlin>  //  id=1,  name=marko  gremlin>  v.outE==>e[7][1-­‐knows-­‐>2]==>e[9][1-­‐created-­‐>3]==>e[8][1-­‐knows-­‐>4]gremlin>  //  gremlin>  v.outE.weight==>0.5==>0.4==>1.0                                                                         Getting Srarted
gremlin>  //  id=1                                                                              1.0gremlin>  v.outE{it.weight  <  1.0}.inV==>v[2]==>v[3]gremlin>  //  gremlin>  list  =  []                                                          gremlin>  v.outE{it.weight  <  1.0}.inV  >>  list==>v[2]==>v[3]gremlin>  //  list                                                              property  mapsgremlin>  list.collect{  it.map()  }==>{name=vadas,  age=27}==>{name=lop,  lang=java}gremlin>  //  listgremlin>  list.inE()              ==>e[7][1-­‐knows-­‐>2]==>e[9][1-­‐created-­‐>3]...                                                                                                                                        Getting Srarted
gremlin>  list.inE{it.label=='knows'}    //                      'knows'              ==>e[7][1-­‐knows-­‐>2]              gremlin>  list.inE()[[label:'knows']]  //                ==>e[7][1-­‐knows-­‐>2]              gremlin>  list.inE()[[label:'knows']].outV.name  //                                                         :name                ==>marko                                                                                     Getting Srarted~20000ms:  g.V.outE{it['label']=='followed_by'}.inV.outE{it['label']=='followed_by'}.inV.outE                      {it['label']=='followed_by'}.inV  >>-­‐1~9000ms:    g.V.outE{it.label=='followed_by'}.inV.outE{it.label=='followed_by'}.inV.outE                    {it.label=='followed_by'}.inV  >>-­‐1~8500ms:    g.V.outE{it.getLabel()=='followed_by'}.inV.outE{it.getLabel()=='followed_by'}.inV.outE                            {it.getLabel()=='followed_by'}.inV  >>-­‐1~6000ms:    g.V.outE[[label:'followed_by']].inV.outE[[label:'followed_by']].inV.outE                      [[label:'followed_by']].inV  >>-­‐1                                                                     ClosureFilterPipe vs. PropertyFIlterPipe
Tinker Pop: Pipes
Pipes[       ] HPPipes = Data Flow FrameworkPipes    Graph Traversal    1   1Pipes          filtering, splitting, merging, traversing,...
Gremling:id-v('a')/outE[@label='knows']/inV/outE[@label='develops']/inV/@name      Pipe pipe1 = new VertexEdgePipe(Step.OUT_EDGES);      Pipe pipe2 = new LabelFilterPipe("knows", Filter.NOT_EQUALS);      Pipe pipe3 = new EdgeVertexPipe(Step.IN_VERTEX);      Pipe pipe4 = new VertexEdgePipe(Step.OUT_EDGES);      Pipe pipe5 = new LabelFilterPipe("develops",      Filter.NOT_EQUALS);      Pipe pipe6 = new EdgeVertexPipe(Step.IN_VERTEX);      Pipe pipe7 = new PropertyPipe("name");      Pipe pipeline = new Pipeline      (pipe1,pipe2,pipe3,pipe4,pipe5,pipe6,pipe7);      pipeline.setStarts(new SingleIterator(graph.getVertex("a"));      for(String name : pipeline) {        System.out.println(name);      }                                        A Graph Processing Stack
Pipes        Pipespublic  class  NumCharsPipe  extends  AbstractPipe<String,Integer>  {    public  Integer  processNextStart()  {        String  word  =  this.starts.next();        return  word.length();    }}                                                          A Graph Processing Stack
Tinker Pop: Rexster
Rexster[    ] HPRexster = A RESTful Graph ShellBlueprints               GraphDB   RESTfulAPI             (JSON)Gremlin
> http://localhost:8182/examplegraph/vertices/b{  "version":"0.1",  "results": {    "_type":"vertex",    "_id":"b",    "name":"aaron",    "type":"person"  },  "query_time":0.1537}                                            A Graph Processing Stack// g:key-v('name','DARK STAR')[0]: Usin gGremlin Code> http://localhost:8182/gratefulgraph/traversals/gremlin?script=g:key-v%28%27name%27,%27DARK%20STAR%27%29[0]{    "results":  [{        "_type":"vertex",        "_id":"89",        "name":"DARK  STAR",        "song_type":"original",        "performances":219,        "type":"song"}    ],    "query_time":6.753024,    "success":true,    "version"}                                                      Using Gremilin
Tinker Pop: Mutant
Mutant[      ] HPMutant = A Poly-ScriptEngine ScriptEngineJVM    Script Engine
Mutant Consolemarko:~/software/mutant$  ./mutant.sh              //          oO  ~~-­‐____m(___m___~.___    MuTanT  0.1-­‐SNAPSHOT_|__|__|__|__|__|          [  ?h  =  help  ][gremlin]  gremlin  0.6-­‐SNAPSHOT[Groovy]  Groovy  Scripting  Engine  2.0[ruby]  JSR  223  JRuby  Engine  1.5.5[ECMAScript]  Mozilla  Rhino  1.6  release  2[AppleScript]  AppleScriptEngine  1.0mutant[gremlin]>  $x  :=  12[12]mutant[gremlin]>  ?xmutant[AppleScript]>  ?xmutant[Groovy]>  $x12mutant[Groovy]>  ?xmutant[ruby]>  $x12mutant[ruby]>  ?xmutant[ECMAScript]>  $x12                                                               Basic Examples
[     ]           Graph DB    Graph DB      Graph Partitioning      Pregel Neo4j
…※    Graph DB    http://snap.stanford.edu/data/index.html

Recommended

PDF
テスト文字列に「うんこ」と入れるな
PDF
RDF Semantic Graph「RDF 超入門」
PDF
Dockerfile を書くためのベストプラクティス解説編
PDF
異次元のグラフデータベースNeo4j
PPTX
本当は恐ろしい分散システムの話
PDF
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
PDF
AWSではじめるMLOps
PPTX
AWSで作る分析基盤
PDF
Fluentdのお勧めシステム構成パターン
PDF
DSIRNLP #3 LZ4 の速さの秘密に迫ってみる
PPTX
Redisの特徴と活用方法について
PDF
GeoPackageを使ってみた(おざき様)
PDF
見やすいプレゼン資料の作り方 - リニューアル増量版
PDF
Hadoop/Spark を使うなら Bigtop を使い熟そう! ~並列分散処理基盤のいま、から Bigtop の最近の取り組みまで一挙ご紹介~(Ope...
PPTX
え!?データがオンプレにあるけどPower BI で BI したいの?
PDF
マイクロにしすぎた結果がこれだよ!
PDF
新入社員のための大規模ゲーム開発入門 サーバサイド編
PDF
RDB技術者のためのNoSQLガイド NoSQLの必要性と位置づけ
PPTX
グラフ構造のデータモデルをPower BIで可視化してみた
PDF
マルチテナント化で知っておきたいデータベースのこと
PDF
Spring Boot × Vue.jsでSPAを作る
PDF
TLS, HTTP/2演習
PPTX
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけら
PDF
Python 3.9からの新定番zoneinfoを使いこなそう
PPTX
世界一わかりやすいClean Architecture
PDF
分散トレーシング技術について(Open tracingやjaeger)
PDF
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PDF
Point net
PDF
The Graph Traversal Programming Pattern
PDF
The Definition of GraphDB

More Related Content

PDF
テスト文字列に「うんこ」と入れるな
PDF
RDF Semantic Graph「RDF 超入門」
PDF
Dockerfile を書くためのベストプラクティス解説編
PDF
異次元のグラフデータベースNeo4j
PPTX
本当は恐ろしい分散システムの話
PDF
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
PDF
AWSではじめるMLOps
PPTX
AWSで作る分析基盤
テスト文字列に「うんこ」と入れるな
RDF Semantic Graph「RDF 超入門」
Dockerfile を書くためのベストプラクティス解説編
異次元のグラフデータベースNeo4j
本当は恐ろしい分散システムの話
Apache Sparkに手を出してヤケドしないための基本 ~「Apache Spark入門より」~ (デブサミ 2016 講演資料)
AWSではじめるMLOps
AWSで作る分析基盤

What's hot

PDF
Fluentdのお勧めシステム構成パターン
PDF
DSIRNLP #3 LZ4 の速さの秘密に迫ってみる
PPTX
Redisの特徴と活用方法について
PDF
GeoPackageを使ってみた(おざき様)
PDF
見やすいプレゼン資料の作り方 - リニューアル増量版
PDF
Hadoop/Spark を使うなら Bigtop を使い熟そう! ~並列分散処理基盤のいま、から Bigtop の最近の取り組みまで一挙ご紹介~(Ope...
PPTX
え!?データがオンプレにあるけどPower BI で BI したいの?
PDF
マイクロにしすぎた結果がこれだよ!
PDF
新入社員のための大規模ゲーム開発入門 サーバサイド編
PDF
RDB技術者のためのNoSQLガイド NoSQLの必要性と位置づけ
PPTX
グラフ構造のデータモデルをPower BIで可視化してみた
PDF
マルチテナント化で知っておきたいデータベースのこと
PDF
Spring Boot × Vue.jsでSPAを作る
PDF
TLS, HTTP/2演習
PPTX
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけら
PDF
Python 3.9からの新定番zoneinfoを使いこなそう
PPTX
世界一わかりやすいClean Architecture
PDF
分散トレーシング技術について(Open tracingやjaeger)
PDF
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
PDF
Point net
Fluentdのお勧めシステム構成パターン
DSIRNLP #3 LZ4 の速さの秘密に迫ってみる
Redisの特徴と活用方法について
GeoPackageを使ってみた(おざき様)
見やすいプレゼン資料の作り方 - リニューアル増量版
Hadoop/Spark を使うなら Bigtop を使い熟そう! ~並列分散処理基盤のいま、から Bigtop の最近の取り組みまで一挙ご紹介~(Ope...
え!?データがオンプレにあるけどPower BI で BI したいの?
マイクロにしすぎた結果がこれだよ!
新入社員のための大規模ゲーム開発入門 サーバサイド編
RDB技術者のためのNoSQLガイド NoSQLの必要性と位置づけ
グラフ構造のデータモデルをPower BIで可視化してみた
マルチテナント化で知っておきたいデータベースのこと
Spring Boot × Vue.jsでSPAを作る
TLS, HTTP/2演習
「関心の分離」と「疎結合」 ソフトウェアアーキテクチャのひとかけら
Python 3.9からの新定番zoneinfoを使いこなそう
世界一わかりやすいClean Architecture
分散トレーシング技術について(Open tracingやjaeger)
PostgreSQLをKubernetes上で活用するためのOperator紹介!(Cloud Native Database Meetup #3 発表資料)
Point net

Similar to 「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜

PDF
The Graph Traversal Programming Pattern
PDF
The Definition of GraphDB
PDF
Undirected graphs
PDF
Graphs - Chris Dixon & Matt Gattis
PDF
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
PDF
Neo4j - The Benefits of Graph Databases (OSCON 2009)
PDF
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
PDF
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
PDF
Problem-Solving using Graph Traversals: Searching, Scoring, Ranking, and Reco...
PDF
Neo4j -- or why graph dbs kick ass
PDF
Kickoff research project TU Ilmenau
PDF
Leveraging social data with semantics
PDF
Eifrem neo4j
PPTX
CSC 8101 Non Relational Databases
PDF
Graph Databases: Trends in the Web of Data
PPTX
Socialmediaviz short
PPTX
An Introduction to NOSQL, Graph Databases and Neo4j
PDF
Graph Theory and Databases
PDF
Gephi short introduction
KEY
Graphs in the Database: Rdbms In The Social Networks Age
The Graph Traversal Programming Pattern
The Definition of GraphDB
Undirected graphs
Graphs - Chris Dixon & Matt Gattis
NOSQL overview and intro to graph databases with Neo4j (Geeknight May 2010)
Neo4j - The Benefits of Graph Databases (OSCON 2009)
NOSQL Overview, Neo4j Intro And Production Example (QCon London 2010)
A NOSQL Overview And The Benefits Of Graph Databases (nosql east 2009)
Problem-Solving using Graph Traversals: Searching, Scoring, Ranking, and Reco...
Neo4j -- or why graph dbs kick ass
Kickoff research project TU Ilmenau
Leveraging social data with semantics
Eifrem neo4j
CSC 8101 Non Relational Databases
Graph Databases: Trends in the Web of Data
Socialmediaviz short
An Introduction to NOSQL, Graph Databases and Neo4j
Graph Theory and Databases
Gephi short introduction
Graphs in the Database: Rdbms In The Social Networks Age

More from Takahiro Inoue

PDF
Treasure Data × Wave Analytics EC Demo
PDF
トレジャーデータとtableau実現する自動レポーティング
PDF
Tableauが魅せる Data Visualization の世界
PDF
トレジャーデータのバッチクエリとアドホッククエリを理解する
PDF
20140708 オンラインゲームソリューション
PDF
トレジャーデータ流,データ分析の始め方
PDF
オンラインゲームソリューション@トレジャーデータ
PDF
事例で学ぶトレジャーデータ 20140612
PDF
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
PDF
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
PDF
Treasure Data Intro for Data Enthusiast!!
PDF
Hadoop and the Data Scientist
PDF
MongoDB: Intro & Application for Big Data
PDF
An Introduction to Fluent & MongoDB Plugins
PDF
An Introduction to Tinkerpop
PDF
An Introduction to Neo4j
PDF
Large-Scale Graph Processing〜Introduction〜(完全版)
PDF
Large-Scale Graph Processing〜Introduction〜(LT版)
PDF
Advanced MongoDB #1
PDF
はじめてのGlusterFS
Treasure Data × Wave Analytics EC Demo
トレジャーデータとtableau実現する自動レポーティング
Tableauが魅せる Data Visualization の世界
トレジャーデータのバッチクエリとアドホッククエリを理解する
20140708 オンラインゲームソリューション
トレジャーデータ流,データ分析の始め方
オンラインゲームソリューション@トレジャーデータ
事例で学ぶトレジャーデータ 20140612
トレジャーデータ株式会社について(for all Data_Enthusiast!!)
この Visualization がすごい2014 〜データ世界を彩るツール6選〜
Treasure Data Intro for Data Enthusiast!!
Hadoop and the Data Scientist
MongoDB: Intro & Application for Big Data
An Introduction to Fluent & MongoDB Plugins
An Introduction to Tinkerpop
An Introduction to Neo4j
Large-Scale Graph Processing〜Introduction〜(完全版)
Large-Scale Graph Processing〜Introduction〜(LT版)
Advanced MongoDB #1
はじめてのGlusterFS

Recently uploaded

PDF
Safeguarding AI-Based Financial Infrastructure
PDF
Eredità digitale sugli smartphone: cosa resta di noi nei dispositivi mobili
PDF
Making Sense of Raster: From Bit Depth to Better Workflows
PDF
Accelerating Responsible AI Adoption in Public Sector and Private Organizations.
PPTX
Cybersecurity Best Practices - Step by Step guidelines
PPTX
Protecting Data in an AI Driven World - Cybersecurity in 2026
PPTX
From Backup to Resilience: How MSPs Are Preparing for 2026
 
PDF
Usage Control for Process Discovery through a Trusted Execution Environment
PPTX
Cybercrime in the Digital Age: Risks, Impact & Protection
PDF
Is It Possible to Have Wi-Fi Without an Internet Provider
PDF
Decoding the DNA: The Digital Networks Act, the Open Internet, and IP interco...
PDF
Digit Expo 2025 - EICC Edinburgh 27th November
PDF
TrustArc Webinar - Looking Ahead: The 2026 Privacy Landscape
PPTX
THIS IS CYBER SECURITY NOTES USED IN CLASS ON VARIOUS TOPICS USED IN CYBERSEC...
PDF
GPUS and How to Program Them by Manya Bansal
PDF
ElyriaSoftware — Powering the Future with Blockchain Innovation
PPTX
Software Analysis &Design ethiopia chap-2.pptx
PDF
Day 3 - Data and Application Security - 2nd Sight Lab Cloud Security Class
PPTX
Unit-4-ARTIFICIAL NEURAL NETWORKS.pptx ANN ppt Artificial neural network
PDF
Energy Storage Landscape Clean Energy Ministerial
Safeguarding AI-Based Financial Infrastructure
Eredità digitale sugli smartphone: cosa resta di noi nei dispositivi mobili
Making Sense of Raster: From Bit Depth to Better Workflows
Accelerating Responsible AI Adoption in Public Sector and Private Organizations.
Cybersecurity Best Practices - Step by Step guidelines
Protecting Data in an AI Driven World - Cybersecurity in 2026
From Backup to Resilience: How MSPs Are Preparing for 2026
 
Usage Control for Process Discovery through a Trusted Execution Environment
Cybercrime in the Digital Age: Risks, Impact & Protection
Is It Possible to Have Wi-Fi Without an Internet Provider
Decoding the DNA: The Digital Networks Act, the Open Internet, and IP interco...
Digit Expo 2025 - EICC Edinburgh 27th November
TrustArc Webinar - Looking Ahead: The 2026 Privacy Landscape
THIS IS CYBER SECURITY NOTES USED IN CLASS ON VARIOUS TOPICS USED IN CYBERSEC...
GPUS and How to Program Them by Manya Bansal
ElyriaSoftware — Powering the Future with Blockchain Innovation
Software Analysis &Design ethiopia chap-2.pptx
Day 3 - Data and Application Security - 2nd Sight Lab Cloud Security Class
Unit-4-ARTIFICIAL NEURAL NETWORKS.pptx ANN ppt Artificial neural network
Energy Storage Landscape Clean Energy Ministerial

「GraphDB徹底入門」〜構造や仕組み理解から使いどころ・種々のGraphDBの比較まで幅広く〜

  • 1.
    Graph DB GraphDB doryokujin+WEB ( Tokyo.Webmining #9-2)
  • 2.
    [Me] doryokujin 2 2 33[Company] 1
  • 3.
    [] MongoDB JP TokyoWebMining MongoDB[ ] MongoDB MongoDB GraphDB
  • 4.
    #1[MongoTokyo] Mongo DB Congerence in Japan 2011 03 01 10gen 3 … http://www.10gen.com/conferences/ mongotokyo2011
  • 5.
    #2[gihyo ] gihyo.jp 2 DocumentDB GraphDB NoSQL
  • 6.
    Graph GraphGraph DB Graph Traversal Graph DB Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop Gremlin, Blueprints, Pipes, Rexster, Mutant
  • 7.
    GraphGraph GraphGraph DB Graph Traversal Graph DB Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop Gremlin, Blueprints, Pipes, Rexster, Mutant
  • 8.
    Graph: GraphGraph DB Graph
  • 9.
    Graph[Graph] Dots Lines vertices edges 1 (relationship) Dots Lines Graph
  • 10.
    Undirected Graph[ (Undirected)Graph] Vertices: Edges: (relationship) (symmetric)
  • 11.
    Directed Graph[ (Directed) Graph] Vertices: Edges: (relationship) (asymmetric)
  • 12.
    Directed / UnderectedGraph friend follow friend follow followfriend follow [Facebook] [Twitter] ”Undirected Graph” Follow ”Directed Graph” ” ” ” ” ”friends” ”follow”
  • 13.
    Single-Relational GraphSingle-Relational Structures → Undirected / Directed Graph Single-Relatinal 1 Graph
  • 14.
    Single-Relational Graph friend follow friend follow followfriend follow [Facebook] [Twitter] ”Undirected Graph” Follow ”Directed Graph” ”Facebook ” ”Twitter ” ”friends” ”follow”
  • 15.
    Single-Relational Reply num:5 Reply Block num:5 Reply DM num:5 num:1 RT RT Reply DM num:2 num:2 num:2 num:1 [Twitter] Graph ”Directed Graph” ”Twitter ” ”Reply”,”RT”,”DM”,”Block”
  • 16.
    *Facebook Flickr lives_in is is is follow lives_in friend is share * friend share follow follow is[ ] lives_in Undirected Directed is is is lives_in
  • 17.
    Multi-Relational GraphMulti-Relational Structures lives_in: User → Country Share: Facebook → Flikcr
  • 18.
    Multi-Relational Reply Reply Block DM Reply RT RTReply DM [Twitter] ”Twitter ” ”Reply”,”RT”,”DM”,”Block”
  • 19.
    Multi-Relational *Facebook Flickr lives_in has has has follow lives_in friend has share * has friend share follow lives_in[Multi-Relatinal Graph] has has has lives_in
  • 20.
    Property GraphProperty Graph Multi-Relational Graph (Property) Graph DB Graph 1 key/value id id_A follow id id_Bfollow 100 follow 500follower 200 date 2011/01/23 follower 1000
  • 21.
    Property Graph Reply num:5 Reply Block num:5 Reply DM num:5 num:1 RT RTReply DM num:2 num:2num:2 num:1 Graph ”Property Graph” ”Twitter ” ”Reply”,”RT”,”DM”,”Block” ”num”
  • 22.
    Property Graph name doryokujin sex man lives_in birth 1985/05/14 has has id id_B follow follow 1000 follower 2000lives_in date 2011/01/23 friend has friend date 2011/01/23 has friend follow follow date 2010/03/23 date 2011/01/23 name full name mail xxx@yyy address zzz lives_in id id_A follow 100 follower 200 has has date 2010/03/23 lives_in
  • 23.
    GraphThe Graph Traversal Pattern
  • 24.
    Property Graph Property Graph Graph Property Graph Graph DB Tinker Pop Hyper Graph
  • 25.
    Graph DBGragh GraphGraph DB Graph Traversal Graph DB Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop Gremlin, Blueprints, Pipes, Rexster, Mutant
  • 26.
    Graph DB: Property Graph DB“Graph DB”
  • 27.
    Graph DB[ DB ≠ Graph DB] Graph DB DB Graph DB
  • 28.
    RDB Graph[Relatinal Database] AoutV inV A B B C A C C D D D A
  • 29.
    Document DB Graph [Document Database] A{ A : { out : [B, C], in : [D] } B : { in : [A] B C } C : { out : [D], in : [A] } D : { out : [A], in : [C] D }}
  • 30.
    XML DB Graph [XML Database] A<graphml><graph><node id=A /><node id=B /> B C<node id=C /><edge source=A target=B /><edge source=A target=C /><edge source=C target=D /><edge source=D target=A /></graph> D</graphml>
  • 31.
    Graph DB[ ]“A graph database is any storage system that provides index-free adjacency” The Graph Traversal Programming Pattern (“adjacent”) ( “index-free” )
  • 32.
    Non-Graph DB and Index-Based Adjacency B E 1. A 3. (B,C) A A B CB, C E D, E D E 2. C D log_2(n) (B,C) time cost
  • 33.
    Graph DB and Index-Free Adjacency‣ ”Mini - Index” B E‣ 1. 1 A (B,C)‣ C D id id_B follow 1000 follower 2000
  • 34.
    Property (key/value) The Graph Traversal Programming Pattern
  • 35.
    GraphDB: Graph Traversal Graph DBGraph DB Query
  • 36.
    Graph DB QueryGraph Query = Graph Traversal Traversal = Root Graph Graph Traversal (Root) Index-Free Adjacency
  • 37.
    private  void  printFriends( Node  person  ){        Traverser  traverser  =  person.traverse(                Order.BREADTH_FIRST,    //                  StopEvaluator.END_OF_GRAPH,  //  Graph                ReturnableEvaluator.ALL_BUT_START_NODE,  //  Root  Node                MyRelationshipTypes.KNOWS,  //  ”KNOWS”                Direction.OUTGOING  );  //          for  (  Node  friend  :  traverser  )        {      //   Node ”name”                System.out.println(  friend.getProperty(  "name"  )  );        } Neo4j Wiki}
  • 38.
    1 31 2 Trinity Morpheus Cypher Agent  Smith Neo4j Wiki
  • 39.
    private  void  findHackers( Node  startNode  ) Neo4j Wiki{        Traverser  traverser  =  startNode.traverse(                Order.BREADTH_FIRST,  //                  StopEvaluator.END_OF_GRAPH,  //  Graph                new  ReturnableEvaluator()  //                  {                        public  boolean  isReturnableNode(  TraversalPosition  currentPosition  )                        {                                Relationship  rel  =  currentPosition.lastRelationshipTraversed();                                if  (  rel  !=  null  &&  rel.isType(  MyRelationshipTypes.CODED_BY  )  )                                {                                        return  true;  //  “CODED_BY”                                  }                                return  false;  //                          }                },  //   2                MyRelationshipTypes.CODED_BY,  Direction.OUTGOING,  //                  MyRelationshipTypes.KNOWS,  Direction.OUTGOING  );  //          for  (  Node  hacker  :  traverser  )        {                TraversalPosition  position  =  traverser.currentPosition();                System.out.println(  "At  depth  "  +  position.depth()  +  "  =>  "                        +  hacker.getProperty(  "name"  )  );        } ∴  At  depth  4  =>  The  Architect
  • 40.
    Graph DB[Data Locality] [Local Search, Social Network] 2 [Transition] Web [Recommendation]
  • 41.
    [Graph Problems] [Shortest Path] 2GraphDB Traversal Neo4jrb
  • 42.
    Graph DB ” ” 10 ”Knows” Tables, Documents, Key/Value Model GraphDB Union, Intersection, Join
  • 43.
    Graph DB[ ] Property Graph Index-Free Adjacency Graph Query = Graph Traversal Data Locality
  • 44.
    Graph DBGraph GraphGraph DB Graph Traversal Graph DB Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop Gremlin, Blueprints, Pipes, Rexster, Mutant
  • 45.
  • 46.
    Neo4j[] HP Java AGPLv3 2003 24 8 2009 VC ACID Propety Graph Model / Gremlin Lucene
  • 47.
    Neo4j[Language Binding -Framework] Python - Django Ruby - Ruby on Rails Clojure Scala Groovy - Griffin / Grails Java - Spring Framework Ruby Ruby Java
  • 48.
    Neo4j[Tools] Shell Shell Graph Traverse Indexing neo4j-server Neo4j REST API Admin tools Online BackUp Neoclipse Neo4j ↑ Batch Insert
  • 49.
    Neo4j[ver. 1.2] 1.2 Neo4j Server REST API Admin Interface High Availability Kernel
  • 50.
  • 51.
    sones[] HP C# AGPLv3 2011 VC ACID REST Interface Property Graph Model / Gremlin : Property Hyper Graph Graph Query Language(GQL)
  • 52.
    sones [GQL] SQL Traversal Cheat Sheet Query• FROM User SELECT User.Friends.Friends.Name// aggregation• SELECT COUNT(User.Friends)• SELECT User.Friends.Random(2)• SELECT User.Friends.Name.Substring(2,5)
  • 53.
  • 54.
    Orient DB[ ] HP Java Apache2.0 1997 C++ → Java Document-Graph DB ACID Shell / REST Interface Propety Graph Model / Gremlin
  • 55.
    Orient DB [Document-Graph DB] [ ] Orient DB Object DB Key/Value Server Document DB// DATABASE OPENODatabaseDocumentTx db = new ODatabaseDocumentTx("remote:localhost/petshop").open("admin", "admin");// DocumentODocument doc = new ODocument(db, "Person");doc.field( "name", "Luke" );doc.field( "surname", "Skywalker" );doc.field( "city", new ODocument(db, "City").field("name","Rome").field("country","Italy") );             // Transactiondoc.save();db.close();
  • 56.
    Orient DB [Document-Graph DB] OGraphVertex OGraphEdge OGraphElement ODocumentWrapper Document SQLSELECT FROM OGraphVertex WHERE outEdges CONTAINS ( label = 'knows' )//7 ”knows”SELECT FROM OGraphVertex WHERE outEdges TRAVERSE(0,7,'out,outEdges')( @class = 'OGraphEdge' and label = 'knows' )
  • 57.
    Orient DB[Language BindingUsing Binary Protocol] Java C PHP JRuby (Ruby: soon)[Language Binding Using REST Protocol] Python Java Script
  • 58.
  • 59.
    InfoGrid [ ] HP JAVA AGPLv3 ACID REST Interface MeshObject GraphMeshBase _GDB = StoreMeshBase.create(_MySQLStore);MeshObject _xkcd = _GDB.getMeshObjectLifecycleManager().createMeshObject();_xkcd.setProperty("Name", "xkcd");_xkcd.setProperty("Url", "http://www.xkcd.com");_xkcd.relate(_good)
  • 60.
  • 61.
    Infinite Graph[ ] HP C++ Academic and Start Up 2010 6 Distributed Graph DB ↑Objectivity/DB: distributed database server
  • 63.
    Graph DB: Data SQL LikeGraphDB License Language Protocol Gremlin Binding Model Query REST/ Property Ruby, Python, Neo4j AGPLv3 Java Yes Scala,... - JSON Graph REST/ Property sones AGPLv3 C# JSON Graph Yes - Yes (XML) (+Extend) REST/ Property PHP, Jruby,OrientDB Apache2.0 Java Yes Python, JS,... Yes JSON Graph Property REST/Info Grid AGPLv3 Java Graph? - - - JSON (MeshObject) Infinite Property Product C++ - - - - Graph Graph
  • 64.
    Graph DB[ ] Graph DB Neo4j Open Source Social Graph Software Not Ready Yet Graph DB Hypergtaph: PropertyGraph HyperGraph Pregel: bulk synchronous parallel model Distributed DB Google FlockDB: Distributed DB for storing adjancency lists Twitter
  • 65.
    Tinker PopGraph GraphGraph DB Graph Traversal Graph DB Neo4j, Sones, InfoGrid, OrientDB, InfiniteGraphTinker Pop Gremlin, Blueprints, Pipes, Rexster, Mutant
  • 66.
  • 67.
    Tinker Pop[Tinker Pop]HP Property Graph Model GraphDB Blueprints: A Property Graph Model Interface Gremlin: A Graph Traversal Language Pipes: A Data Flow Framework using Process Graphs Rexster: A RESTful Graph Shell Mutant: A Poly-ScriptEngine ScriptEngine
  • 68.
  • 69.
  • 70.
    BluePrints[ ] HP GraphDB ”JDBC”Property Graph Model GraphDB[Now] Tinker Graph: in-memory property graph model Sail: Open RDF Neo4j, Orient DB, sones, ...[Future] Redis Infinite Graph, Dex
  • 71.
    BluePrints GraphDBGraph graph = new Neo4jGraph("/tmp/graph/neo4j");// Graph graph = new OrientGraph("/tmp/graph/orientdb");Vertex a = graph.addVertex(null);Vertex b = graph.addVertex(null);a.setProperty("name","marko");b.setProperty("name","aaron");Edge e = graph.addEdge(null,a,b,"knows");e.setProperty("since",2010);graph.shutdown();
  • 72.
    BluePrints Transactiongraph.startTransaction();try{  Vertex luca = graph.addVertex(null);  luca.setProperty( "name", "Luca" );  Vertex marko = graph.addVertex(null);  marko.setProperty( "name", "Marko" );  Edge lucaKnowsMarko = graph.addEdge(null, luca, marko,"knows");  graph.stopTransaction(Conclusion.SUCCESS);} catch( Exception e ) {  graph.stopTransaction(Conclusion.FAILURE);}
  • 73.
  • 74.
    Gremlin[ ] HPGremlin = Graph Programing LanguageBlueprints GraphDBShell GraphDB QueryJava + Groovy
  • 75.
    GremlinProperty Graph Basic Graph Traversals
  • 76.
    doryokujin$ ./gremlin.sh ,,,/ (o o)-----oOOo-(_)-oOOo-----gremlin>  g  =  TinkerGraphFactory.createTinkerGraph()==>tinkergraph[vertices:6  edges:6]  // 6 6gremlin>  g.class==>class  com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphgremlin>  //  gremlin>  g.V==>v[3]==>v[2]...gremlin>  //  gremlin>  g.E==>e[10][4-­‐created-­‐>5]==>e[7][1-­‐knows-­‐>2]==>e[9][1-­‐created-­‐>3]... Getting Srarted
  • 77.
    gremlin>  v  = g.v(1)  //  id=1  ==>v[1]gremlin>  v.keys()  //  ==>age==>namegremlin>  v.values()  //  ==>29==>markogremlin>  v.name  +  '  is  '  +  v.age  +  '  years  old.'==>marko  is  29  years  old.gremlin>  //  id=1,  name=marko  gremlin>  v.outE==>e[7][1-­‐knows-­‐>2]==>e[9][1-­‐created-­‐>3]==>e[8][1-­‐knows-­‐>4]gremlin>  //  gremlin>  v.outE.weight==>0.5==>0.4==>1.0 Getting Srarted
  • 78.
    gremlin>  //  id=1 1.0gremlin>  v.outE{it.weight  <  1.0}.inV==>v[2]==>v[3]gremlin>  //  gremlin>  list  =  []                                                          gremlin>  v.outE{it.weight  <  1.0}.inV  >>  list==>v[2]==>v[3]gremlin>  //  list property  mapsgremlin>  list.collect{  it.map()  }==>{name=vadas,  age=27}==>{name=lop,  lang=java}gremlin>  //  listgremlin>  list.inE()              ==>e[7][1-­‐knows-­‐>2]==>e[9][1-­‐created-­‐>3]... Getting Srarted
  • 79.
    gremlin>  list.inE{it.label=='knows'}   //   'knows' ==>e[7][1-­‐knows-­‐>2] gremlin>  list.inE()[[label:'knows']]  //   ==>e[7][1-­‐knows-­‐>2] gremlin>  list.inE()[[label:'knows']].outV.name  // :name   ==>marko Getting Srarted~20000ms:  g.V.outE{it['label']=='followed_by'}.inV.outE{it['label']=='followed_by'}.inV.outE                      {it['label']=='followed_by'}.inV  >>-­‐1~9000ms:    g.V.outE{it.label=='followed_by'}.inV.outE{it.label=='followed_by'}.inV.outE                    {it.label=='followed_by'}.inV  >>-­‐1~8500ms:    g.V.outE{it.getLabel()=='followed_by'}.inV.outE{it.getLabel()=='followed_by'}.inV.outE                            {it.getLabel()=='followed_by'}.inV  >>-­‐1~6000ms:    g.V.outE[[label:'followed_by']].inV.outE[[label:'followed_by']].inV.outE                      [[label:'followed_by']].inV  >>-­‐1 ClosureFilterPipe vs. PropertyFIlterPipe
  • 80.
  • 81.
    Pipes[ ] HPPipes = Data Flow FrameworkPipes Graph Traversal 1 1Pipes filtering, splitting, merging, traversing,...
  • 82.
    Gremling:id-v('a')/outE[@label='knows']/inV/outE[@label='develops']/inV/@name Pipe pipe1 = new VertexEdgePipe(Step.OUT_EDGES); Pipe pipe2 = new LabelFilterPipe("knows", Filter.NOT_EQUALS); Pipe pipe3 = new EdgeVertexPipe(Step.IN_VERTEX); Pipe pipe4 = new VertexEdgePipe(Step.OUT_EDGES); Pipe pipe5 = new LabelFilterPipe("develops", Filter.NOT_EQUALS); Pipe pipe6 = new EdgeVertexPipe(Step.IN_VERTEX); Pipe pipe7 = new PropertyPipe("name"); Pipe pipeline = new Pipeline (pipe1,pipe2,pipe3,pipe4,pipe5,pipe6,pipe7); pipeline.setStarts(new SingleIterator(graph.getVertex("a")); for(String name : pipeline) {   System.out.println(name); } A Graph Processing Stack
  • 83.
    Pipes Pipespublic  class  NumCharsPipe  extends  AbstractPipe<String,Integer>  {    public  Integer  processNextStart()  {        String  word  =  this.starts.next();        return  word.length();    }} A Graph Processing Stack
  • 84.
  • 85.
    Rexster[ ] HPRexster = A RESTful Graph ShellBlueprints GraphDB RESTfulAPI (JSON)Gremlin
  • 86.
    > http://localhost:8182/examplegraph/vertices/b{  "version":"0.1",  "results": {    "_type":"vertex",    "_id":"b",    "name":"aaron",    "type":"person"  },  "query_time":0.1537} A Graph Processing Stack// g:key-v('name','DARK STAR')[0]: Usin gGremlin Code> http://localhost:8182/gratefulgraph/traversals/gremlin?script=g:key-v%28%27name%27,%27DARK%20STAR%27%29[0]{    "results":  [{        "_type":"vertex",        "_id":"89",        "name":"DARK  STAR",        "song_type":"original",        "performances":219,        "type":"song"}    ],    "query_time":6.753024,    "success":true,    "version"} Using Gremilin
  • 87.
  • 88.
    Mutant[ ] HPMutant = A Poly-ScriptEngine ScriptEngineJVM Script Engine
  • 89.
    Mutant Consolemarko:~/software/mutant$  ./mutant.sh             //          oO  ~~-­‐____m(___m___~.___    MuTanT  0.1-­‐SNAPSHOT_|__|__|__|__|__|          [  ?h  =  help  ][gremlin]  gremlin  0.6-­‐SNAPSHOT[Groovy]  Groovy  Scripting  Engine  2.0[ruby]  JSR  223  JRuby  Engine  1.5.5[ECMAScript]  Mozilla  Rhino  1.6  release  2[AppleScript]  AppleScriptEngine  1.0mutant[gremlin]>  $x  :=  12[12]mutant[gremlin]>  ?xmutant[AppleScript]>  ?xmutant[Groovy]>  $x12mutant[Groovy]>  ?xmutant[ruby]>  $x12mutant[ruby]>  ?xmutant[ECMAScript]>  $x12 Basic Examples
  • 90.
    [ ] Graph DB Graph DB Graph Partitioning Pregel Neo4j
  • 91.
    …※ Graph DB http://snap.stanford.edu/data/index.html

[8]ページ先頭

©2009-2025 Movatter.jp