0
The Pathology of Graph Databases              Marko A. Rodriguez            Graph Systems Architect           http://marko...
AbstractThere is nothing more fascinating and utterly mind-bending than traversing a graph. Those whosuccumb to this data ...
What you are about to see may disturb you.It has infected  Neo4j, OrientDB, DEX, RDF Sail, TinkerGraph, and ReXster.      ...
?        ??
~$ cd /tmp/graphdb
graphdb$ gremlin
,,,/         (o o)-----o00o(_)-o00o-----gremlin>
The Basics
Gremlin is a Groovy DSL and as such, has native JVM access.Gremlin is a Groovy DSL and as such, has native JVM access.
31+2
gremlingremlin
emlingremlin.substring(2)
[1,2,3,4,5]list = [1,2,3,4,5]
key1=value               key2=123map = [key1:value,key2:123]
<modem sound/>socket = new Socket(127.0.0.1,8182)
trueTextAnalysis.isMean(You are that which is not good.)
Graph Traversing
/tmp/graphdbg = new Neo4jGraph(/tmp/graphdb)
/tmp/graphdbg
1g.v(1)
name=marko              1g.v(1).name
1g.v(1)
city=santafe                   1g.v(1).city
1g.v(1)
name=marko          city=santafe               1g.v(1).map()
1g.v(1)
created              1    knows                  knowsg.v(1).outE
created              1    knows                  knowsg.v(1).outE
null                       created                    since=2010              1        knows                    since=2005...
created              1    knows                  knowsg.v(1).outE
2                  created              1   knows     3                  knows                            4g.v(1).outE.inV
2   name=rexster                       created              1        knows     3   name=stephen                       know...
/tmp/graphdbg
1g.v(1)
created              1    knows                  knowsg.v(1).outE
created              1      knows                    knowsg.v(1).outE[[label:knows]]
1g.v(1)
created              1    knows                  knowsg.v(1).outE
created              1      knows                    knowsg.v(1).outE.filter{it.label==knows}
2g.v(1).outE.filter{it.label==knows}.count()
created              1    knows                  knowsg.v(1).outE
created              1      knows                    knowsg.v(1).outE.filter{it.label==knows & since > 2006}
[OutEdgesPipe, LabelFilterPipe(NOT_EQUAL,knows), InVertexPipe]g.v(1).outE[[label:knows]].inV.toString()
1g.v(1)
1        knows                       knowsg.v(1).outE(knows)
1     knows   3                    knows                            4g.v(1).outE(knows).inV
[OutEdgesPipe(knows), InVertexPipe]g.v(1).outE(knows).inV.toString()
1g.v(1)
1       knows   3                      knows                              4g.v(1).out(knows)
1     knows   3   name=stephen                    knows                            4   name=peterg.v(1).out(knows).name
1     knows   3   name=stephen                    knows                            4   name=peterg.v(1).out(knows).name.fi...
1     knows   3   name=stephen                    knows                            4   name=peterg.v(1).out(knows).name.fi...
1     knows   3   name=stephen                    knows                            4   name=peterg.v(1).out(knows).name.fi...
[OutPipe(knows)]g.v(1).out(knows).toString()
1g.v(1)
o   o!                    o   oH                   W               1g.v(1).filter{new Random().nextBoolean()}
1g.v(1)
t!                   A lrigh               1g.v(1).filter{new Random().nextBoolean()}
1g.v(1)
Doh!               1g.v(1).filter{new Random().nextBoolean()}
1
1
1
1
Graph Inference
1g.v(1)
2                        created               1g.v(1).out(created)
2   name=rexster                      created               1g.v(1).out(created).name
1g.v(1)
2                        created               1g.v(1).out(created)
2                      created   created               1                  3g.v(1).out(created).in(created)
2                      created   created               1                  3g.v(1).out(created).in(created).except([g.v(1)])
2                      created   created               1                  3       name=stepheng.v(1).out(created).in(creat...
2                      created   created               1                  3       name=stepheng.v(1).out(created).in(creat...
2                       created      created               1     collaborator     3       name=stepheng.v(1).out(created)....
2                       created      created               1     collaborator     3       name=stepheng.v(1).out(created)....
Graph Backtracking and Looping
1g.v(1)
2                        created               1g.v(1).out(created)
5                                       imports                                2      imports   6                         ...
5   name=blueprints                                       imports                                2      imports   6   name...
5   name=blueprints                                       imports                                2      imports      6   n...
8                                           imports                                                     5      name=bluepr...
8                                           imports                                                     5      name=bluepr...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                               imports                                         5      name=blueprints   ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                 imports                                                ...
name=neo4j       8                                                     imports                                            ...
name=neo4j       8                                                     imports                                            ...
name=neo4j       8                                                     imports                                            ...
name=neo4j       8                                                 imports                                                ...
mm = [:]
m           name=neo4j       8                                   imports                                             5    ...
m                         name=neo4j       8                                                 imports                      ...
m                         name=neo4j       8                                                 imports                      ...
m                         name=neo4j       8                                                 imports                      ...
v[5]=1 m   v[6]=1     v[7]=1                         name=neo4j       8                                                 im...
v[5]=1 m   v[6]=1     v[7]=1                         name=neo4j       8                                                 im...
v[5]=3     v[6]=2 m   v[7]=1     v[8]=1                         name=neo4j       8                                        ...
v[5]=3     v[6]=2 m   v[7]=1     v[8]=1                         name=neo4j       8                                        ...
v[5]=4     v[6]=2 m   v[7]=1     v[8]=3                         name=neo4j       8                                        ...
v[5]=4     v[6]=2 m   v[7]=1     v[8]=3                         name=neo4j       8                                        ...
v[5]=4     v[6]=2 m   v[7]=1     v[8]=4                         name=neo4j       8                                        ...
v[5]=4     v[6]=2 m   v[7]=1     v[8]=4                         name=neo4j       8                                        ...
mm = [:]
m           name=neo4j       8                                   imports                                             5    ...
m                           name=neo4j       8                                                   imports                  ...
m                           name=neo4j       8                                                   imports                  ...
m                           name=neo4j       8                                                   imports                  ...
m                           name=neo4j       8                                                   imports                  ...
blueprints=1 m     pipes=1      gremlin=1                           name=neo4j       8                                    ...
blueprints=1 m     pipes=1      gremlin=1                           name=neo4j       8                                    ...
blueprints=1 m     pipes=1      gremlin=1                           name=neo4j       8                                    ...
blueprints=1 m     pipes=1      gremlin=1                           name=neo4j       8                                    ...
blueprints=3       pipes=2 m    gremlin=1       neo4j=1                           name=neo4j       8                      ...
blueprints=3       pipes=2 m    gremlin=1       neo4j=1                           name=neo4j       8                      ...
blueprints=3       pipes=2 m    gremlin=1       neo4j=1                           name=neo4j       8                      ...
blueprints=3       pipes=2 m    gremlin=1       neo4j=1                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=3                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=3                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=3                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=3                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=4                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=4                           name=neo4j       8                      ...
blueprints=4       pipes=2 m    gremlin=1       neo4j=4                           name=neo4j       8                      ...
Graph Paths
1g.v(1)
1g.v(1).as(x)
9                        10            child       child                    1g.v(1).as(x).in(child)
9                        10            child       child                    1g.v(1).as(x).in(child).loop(x)
child                    child       9                         10            child        child                     1g.v(1...
child                    child             child                    child       9                         10            ch...
child                    child             child                    child             child                    child      ...
100,000,000                  100,000,001                  child                        child                   ...        ...
100,000,000                  100,000,001                  child                        child                   ...        ...
name=angelina                  name=brad    100,000,000                  100,000,001                  child               ...
name=angelina                  name=brad    100,000,000                  100,000,001                  child               ...
1g.v(1)
child       child                    1g.v(1).inE(child)
thinks="You suck."         thinks="Youre great."               child        child                        1g.v(1).inE(child...
thinks="You suck."               child                        1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)}
9   thinks="You suck."               child                        1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)...
irl."                                    ag                           w   like                      thro              ou  ...
irl."                                    ag                           w   like                      thro              ou  ...
Graph Pattern Matching
name=neo4j       8                               imports                                         5      name=blueprints   ...
SELECT ?x ?y WHERE {  1 created ?x .  ?x imports ?y}                   name=neo4j       8                                 ...
SELECT ?x ?y WHERE {  1 created ?x .  ?x imports ?y}                   name=neo4j       8                                 ...
SELECT ?x ?y WHERE {  1 created ?x .  ?x imports ?y}                   name=neo4j       8                                 ...
SELECT ?x ?y WHERE {                ?x     ?y  1 created ?x .                    v[2]   v[5]                              ...
name=neo4j       8                               imports                                         5      name=blueprints   ...
t                         name=neo4j       8                                                 imports                      ...
t                name=neo4j       8                                        imports                                        ...
t                           name=neo4j       8                                                   imports                  ...
t                           name=neo4j       8                                                   imports                  ...
t                           name=neo4j       8                                                   imports                  ...
t                           name=neo4j       8                                                   imports                  ...
x      y     v[2]   v[5] t   v[2]   v[6]     v[2]   v[7]                           name=neo4j       8                     ...
x      y     v[2]   v[5] t   v[2]   v[6]     v[2]   v[7]                          name=neo4j       8                      ...
x      y     v[2]   v[5] t   v[2]   v[6]     v[2]   v[7]                          name=neo4j       8                      ...
x      y     v[2]   v[5] t   v[2]   v[6]     v[2]   v[7]                          name=neo4j       8                      ...
x         y     v[2]      v[5] t   v[2]      v[6]     v[2]      v[7]                             name=neo4j       8       ...
t                         name=neo4j       8                                                 imports                      ...
t                name=neo4j       8                                        imports                                        ...
t                           name=neo4j       8                                                   imports                  ...
t                            name=neo4j       8                                                    imports                ...
t                            name=neo4j       8                                                    imports                ...
t                            name=neo4j       8                                                    imports                ...
x       y     2    blueprints t   2    pipes     2    gremlin                              name=neo4j       8             ...
g.clear()
Graph Construction
1a = g.addVertex()
name=pierre             1a.name = pierre
name=pierre         city=brussels              1a.city = brussels
name=stephen                                        city=dc                                          2         name=pierre...
name=rexster                    logo=   reXster                                  .                          3             ...
name=rexster                    logo=   reXster                                  .                          3             ...
name=rexster                     logo=   reXster                                   .                            3         ...
name=gremlin                                                   logo= Gremlin                                              ...
name=pipes   logo=  Pipes.        5                                                         name=gremlin                  ...
name=blueprints   name=pipes                     logo= Blueprints .   logo=  Pipes.                                       ...
6      5                          4              3                      2          1g.V
6g.V.count()
blueprints     pipes                                        gremlin                      rexster                          ...
6      5                          4              3                      2          1g.V
Blueprints       Pipes                             Gremlin                                 G = (V, E)               reXste...
4g.V.logo.count()
name=blueprints   name=pipes                            logo= Blueprints .   logo=  Pipes              .                  ...
6g.V.transform{it.map()}.count()
7g.V.transform{it.map()}.count() + 1
8g.V.transform{it.map()}.count() + 1 + 1
4(g.V.transform{it.map()}.count() + 1 + 1) / 2
4 is a number.((g.V.transform{it.map()}.count() + 1 + 1) / 2) +  is a number.
14(((g.V.transform{it.map()}.count() + 1 + 1) / 2) +  is a number.).length()
imports      imports                                     imports                                    created               ...
since=2011        since=2011g.E.transform{it.map()}
g.clear()
Graph Ranking
7        friend   6                         friend                         friend                  8                      ...
m                            7        friend   6                   friend                         friend            8     ...
m                              7        friend   6                     friend                         friendc       0     ...
m                                  7        friend   6                         friend                         friendc     ...
m                                  7        friend   6                         friend                         friendc     ...
v[2]=1m    v[6]=1                                  7        friend   6                         friend                     ...
v[2]=1m    v[6]=1                                  7        friend   6                         friend                     ...
v[2]=1     v[3]=1m    v[6]=2     v[7]=1                                  7        friend   6                         frien...
v[2]=1     v[3]=1m    v[6]=2     v[7]=1                                  7        friend   6                         frien...
v[1]=1     v[2]=1     v[3]=1m    v[4]=1     v[6]=2     v[7]=2     v[8]=1                                  7        friend ...
v[1]=1     v[2]=1     v[3]=1m    v[4]=1     v[6]=2     v[7]=2     v[8]=1                                  7        friend ...
v[1]=3     v[2]=2     v[3]=1     v[4]=1m    v[5]=1     v[6]=3     v[7]=2     v[8]=2                       7        friend ...
v[1]=3     v[2]=2     v[3]=1     v[4]=1m    v[5]=1     v[6]=3     v[7]=2     v[8]=2                       7        friend ...
v[1]=4     v[2]=4     v[3]=3     v[4]=1m    v[5]=1     v[6]=7     v[7]=3     v[8]=2                       7        friend ...
v[1]=4     v[2]=4     v[3]=3     v[4]=1m    v[5]=1     v[6]=7     v[7]=3     v[8]=2                       7        friend ...
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
The Pathology of Graph Databases
Upcoming SlideShare
Loading in...5
×

The Pathology of Graph Databases

23,489

Published on

There is nothing more fascinating and utterly mind-bending than traversing a graph. Those who succumb to this data processing pattern euphorically suffer from graph pathology.

This is a case study of the Graph Addict.

Published in: Technology
6 Comments
34 Likes
Statistics
Notes
No Downloads
Views
Total Views
23,489
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
312
Comments
6
Likes
34
Embeds 0
No embeds

No notes for slide

Transcript of "The Pathology of Graph Databases"

  1. 1. The Pathology of Graph Databases Marko A. Rodriguez Graph Systems Architect http://markorodriguez.com http://twitter.com/twarko http://tinkerpop.com TinkerPop WindyCityDB - Chicago, Illinois – June 25, 2011
  2. 2. AbstractThere is nothing more fascinating and utterly mind-bending than traversing a graph. Those whosuccumb to this data processing pattern euphoricallysuffer from graph pathology.This is a case study of the Graph Addict. Gremlin G = (V, E) What is presented is as of Gremlin 1.1 (Released July 15, 2011)
  3. 3. What you are about to see may disturb you.It has infected Neo4j, OrientDB, DEX, RDF Sail, TinkerGraph, and ReXster. reXster ...it will infect others.
  4. 4. ? ??
  5. 5. ~$ cd /tmp/graphdb
  6. 6. graphdb$ gremlin
  7. 7. ,,,/ (o o)-----o00o(_)-o00o-----gremlin>
  8. 8. The Basics
  9. 9. Gremlin is a Groovy DSL and as such, has native JVM access.Gremlin is a Groovy DSL and as such, has native JVM access.
  10. 10. 31+2
  11. 11. gremlingremlin
  12. 12. emlingremlin.substring(2)
  13. 13. [1,2,3,4,5]list = [1,2,3,4,5]
  14. 14. key1=value key2=123map = [key1:value,key2:123]
  15. 15. <modem sound/>socket = new Socket(127.0.0.1,8182)
  16. 16. trueTextAnalysis.isMean(You are that which is not good.)
  17. 17. Graph Traversing
  18. 18. /tmp/graphdbg = new Neo4jGraph(/tmp/graphdb)
  19. 19. /tmp/graphdbg
  20. 20. 1g.v(1)
  21. 21. name=marko 1g.v(1).name
  22. 22. 1g.v(1)
  23. 23. city=santafe 1g.v(1).city
  24. 24. 1g.v(1)
  25. 25. name=marko city=santafe 1g.v(1).map()
  26. 26. 1g.v(1)
  27. 27. created 1 knows knowsg.v(1).outE
  28. 28. created 1 knows knowsg.v(1).outE
  29. 29. null created since=2010 1 knows since=2005 knowsg.v(1).outE.since
  30. 30. created 1 knows knowsg.v(1).outE
  31. 31. 2 created 1 knows 3 knows 4g.v(1).outE.inV
  32. 32. 2 name=rexster created 1 knows 3 name=stephen knows 4 name=peterg.v(1).outE.inV.name
  33. 33. /tmp/graphdbg
  34. 34. 1g.v(1)
  35. 35. created 1 knows knowsg.v(1).outE
  36. 36. created 1 knows knowsg.v(1).outE[[label:knows]]
  37. 37. 1g.v(1)
  38. 38. created 1 knows knowsg.v(1).outE
  39. 39. created 1 knows knowsg.v(1).outE.filter{it.label==knows}
  40. 40. 2g.v(1).outE.filter{it.label==knows}.count()
  41. 41. created 1 knows knowsg.v(1).outE
  42. 42. created 1 knows knowsg.v(1).outE.filter{it.label==knows & since > 2006}
  43. 43. [OutEdgesPipe, LabelFilterPipe(NOT_EQUAL,knows), InVertexPipe]g.v(1).outE[[label:knows]].inV.toString()
  44. 44. 1g.v(1)
  45. 45. 1 knows knowsg.v(1).outE(knows)
  46. 46. 1 knows 3 knows 4g.v(1).outE(knows).inV
  47. 47. [OutEdgesPipe(knows), InVertexPipe]g.v(1).outE(knows).inV.toString()
  48. 48. 1g.v(1)
  49. 49. 1 knows 3 knows 4g.v(1).out(knows)
  50. 50. 1 knows 3 name=stephen knows 4 name=peterg.v(1).out(knows).name
  51. 51. 1 knows 3 name=stephen knows 4 name=peterg.v(1).out(knows).name.filter{it.startsWith(st)}
  52. 52. 1 knows 3 name=stephen knows 4 name=peterg.v(1).out(knows).name.filter{it.matches(p.{4})}
  53. 53. 1 knows 3 name=stephen knows 4 name=peterg.v(1).out(knows).name.filter{it.matches(p.{4}) & false}
  54. 54. [OutPipe(knows)]g.v(1).out(knows).toString()
  55. 55. 1g.v(1)
  56. 56. o o! o oH W 1g.v(1).filter{new Random().nextBoolean()}
  57. 57. 1g.v(1)
  58. 58. t! A lrigh 1g.v(1).filter{new Random().nextBoolean()}
  59. 59. 1g.v(1)
  60. 60. Doh! 1g.v(1).filter{new Random().nextBoolean()}
  61. 61. 1
  62. 62. 1
  63. 63. 1
  64. 64. 1
  65. 65. Graph Inference
  66. 66. 1g.v(1)
  67. 67. 2 created 1g.v(1).out(created)
  68. 68. 2 name=rexster created 1g.v(1).out(created).name
  69. 69. 1g.v(1)
  70. 70. 2 created 1g.v(1).out(created)
  71. 71. 2 created created 1 3g.v(1).out(created).in(created)
  72. 72. 2 created created 1 3g.v(1).out(created).in(created).except([g.v(1)])
  73. 73. 2 created created 1 3 name=stepheng.v(1).out(created).in(created).except([g.v(1)]).name
  74. 74. 2 created created 1 3 name=stepheng.v(1).out(created).in(created).except([g.v(1)]).name.back(1)
  75. 75. 2 created created 1 collaborator 3 name=stepheng.v(1).out(created).in(created).except([g.v(1)]).name.back(1). sideEffect{g.addEdge(g.v(1),it,collaborator)}
  76. 76. 2 created created 1 collaborator 3 name=stepheng.v(1).out(created).in(created).except([g.v(1)]).name.back(1). sideEffect{g.addEdge(g.v(1),it,collaborator)}.filter{false}
  77. 77. Graph Backtracking and Looping
  78. 78. 1g.v(1)
  79. 79. 2 created 1g.v(1).out(created)
  80. 80. 5 imports 2 imports 6 imports created 7 1g.v(1).out(created).out(imports)
  81. 81. 5 name=blueprints imports 2 imports 6 name=pipes imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name
  82. 82. 5 name=blueprints imports 2 imports 6 name=pipes imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1)
  83. 83. 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports)
  84. 84. 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports)
  85. 85. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports).name
  86. 86. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports).name .back(1)
  87. 87. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports).name .back(1).out(imports)
  88. 88. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports).name .back(1).out(imports).out(imports)
  89. 89. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).name.back(1).out(imports).name .back(1).out(imports).out(imports).out(imports)
  90. 90. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin1
  91. 91. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  92. 92. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  93. 93. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  94. 94. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  95. 95. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  96. 96. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  97. 97. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1 2g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  98. 98. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1 3g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  99. 99. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1 4g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  100. 100. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(imports).loop(1){it.loops < 5}
  101. 101. mm = [:]
  102. 102. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1
  103. 103. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  104. 104. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  105. 105. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  106. 106. v[5]=1 m v[6]=1 v[7]=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  107. 107. v[5]=1 m v[6]=1 v[7]=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  108. 108. v[5]=3 v[6]=2 m v[7]=1 v[8]=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  109. 109. v[5]=3 v[6]=2 m v[7]=1 v[8]=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  110. 110. v[5]=4 v[6]=2 m v[7]=1 v[8]=3 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  111. 111. v[5]=4 v[6]=2 m v[7]=1 v[8]=3 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  112. 112. v[5]=4 v[6]=2 m v[7]=1 v[8]=4 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  113. 113. v[5]=4 v[6]=2 m v[7]=1 v[8]=4 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).groupCount(m).loop(2){true}
  114. 114. mm = [:]
  115. 115. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1
  116. 116. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  117. 117. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  118. 118. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  119. 119. m name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  120. 120. blueprints=1 m pipes=1 gremlin=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  121. 121. blueprints=1 m pipes=1 gremlin=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  122. 122. blueprints=1 m pipes=1 gremlin=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  123. 123. blueprints=1 m pipes=1 gremlin=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  124. 124. blueprints=3 pipes=2 m gremlin=1 neo4j=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  125. 125. blueprints=3 pipes=2 m gremlin=1 neo4j=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  126. 126. blueprints=3 pipes=2 m gremlin=1 neo4j=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  127. 127. blueprints=3 pipes=2 m gremlin=1 neo4j=1 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  128. 128. blueprints=4 pipes=2 m gremlin=1 neo4j=3 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  129. 129. blueprints=4 pipes=2 m gremlin=1 neo4j=3 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  130. 130. blueprints=4 pipes=2 m gremlin=1 neo4j=3 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  131. 131. blueprints=4 pipes=2 m gremlin=1 neo4j=3 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  132. 132. blueprints=4 pipes=2 m gremlin=1 neo4j=4 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  133. 133. blueprints=4 pipes=2 m gremlin=1 neo4j=4 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  134. 134. blueprints=4 pipes=2 m gremlin=1 neo4j=4 name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).out(import).name.groupCount(m).back(2).loop(2){true}
  135. 135. Graph Paths
  136. 136. 1g.v(1)
  137. 137. 1g.v(1).as(x)
  138. 138. 9 10 child child 1g.v(1).as(x).in(child)
  139. 139. 9 10 child child 1g.v(1).as(x).in(child).loop(x)
  140. 140. child child 9 10 child child 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}
  141. 141. child child child child 9 10 child child 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}
  142. 142. child child child child child child 9 10 child child 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}
  143. 143. 100,000,000 100,000,001 child child ... ... child child child child child child 9 10 child child 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}
  144. 144. 100,000,000 100,000,001 child child ... ... child child child child child child 9 10 child child [v[1], v[9], ..., v[100,000,000]] [v[1], v[10], ..., v[100,000,001]] ... 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}.paths
  145. 145. name=angelina name=brad 100,000,000 100,000,001 child child ... ... child child child child child child 9 10 child child 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}.name
  146. 146. name=angelina name=brad 100,000,000 100,000,001 child child ... ... child child child child child child 9 10 child child [v[1], v[9], ..., v[100,000,000], angelina] [v[1], v[10], ..., v[100,000,001], brad] ... 1g.v(1).as(x).in(child).loop(x){it.object.in.count() != 0}.name.paths
  147. 147. 1g.v(1)
  148. 148. child child 1g.v(1).inE(child)
  149. 149. thinks="You suck." thinks="Youre great." child child 1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)}
  150. 150. thinks="You suck." child 1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)}
  151. 151. 9 thinks="You suck." child 1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)}.outV
  152. 152. irl." ag w like thro ou ks="Y thin thinks="No pony!" thi n ks ="Y ou re fat ." thinks="Get a real job." 9 thinks="You suck." child 1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)}.outV.loop(3){true}
  153. 153. irl." ag w like thro ou ks="Y thin thinks="No pony!" thi n ks ="Y ou re fat ." thinks="Get a real job." 9 thinks="You suck." child 1g.v(1).inE(child).filter{TextAnalysis.isMean(it.thinks)}.outV.loop(3){true}
  154. 154. Graph Pattern Matching
  155. 155. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin1
  156. 156. SELECT ?x ?y WHERE { 1 created ?x . ?x imports ?y} name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1
  157. 157. SELECT ?x ?y WHERE { 1 created ?x . ?x imports ?y} name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1
  158. 158. SELECT ?x ?y WHERE { 1 created ?x . ?x imports ?y} name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1
  159. 159. SELECT ?x ?y WHERE { ?x ?y 1 created ?x . v[2] v[5] v[2] v[6] ?x imports ?y v[2] v[7]} name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1
  160. 160. name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin1
  161. 161. t name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1t = new Table()
  162. 162. t name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1)
  163. 163. t name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created)
  164. 164. t name=neo4j 8 imports 5 name=blueprints imports imports x imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).as(x)
  165. 165. t name=neo4j 8 imports 5 name=blueprints imports imports x imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).as(x).out(imports)
  166. 166. t name=neo4j 8 imports y 5 name=blueprints imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1g.v(1).out(created).as(x).out(imports).as(y)
  167. 167. x y v[2] v[5] t v[2] v[6] v[2] v[7] name=neo4j 8 imports y 5 name=blueprints imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1g.v(1).out(created).as(x).out(imports).as(y).table(t)
  168. 168. x y v[2] v[5] t v[2] v[6] v[2] v[7] name=neo4j 8 imports y 5 name=blueprints v[5] imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1t.get(0,1)
  169. 169. x y v[2] v[5] t v[2] v[6] v[2] v[7] name=neo4j 8 imports y 5 name=blueprints v[2] imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1t.get(0,x)
  170. 170. x y v[2] v[5] t v[2] v[6] v[2] v[7] name=neo4j 8 imports y 5 name=blueprints v[5] v[6] imports v[7] y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1t.getColumn(y)
  171. 171. x y v[2] v[5] t v[2] v[6] v[2] v[7] name=neo4j 8 imports y 5 name=blueprints [x, y] imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1t.getColumnNames()
  172. 172. t name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1t = new Table()
  173. 173. t name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1)
  174. 174. t name=neo4j 8 imports 5 name=blueprints imports imports imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created)
  175. 175. t name=neo4j 8 imports 5 name=blueprints imports imports x imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).as(x)
  176. 176. t name=neo4j 8 imports 5 name=blueprints imports imports x imports 2 imports 6 name=pipes imports imports created 7 name=gremlin 1g.v(1).out(created).as(x).out(imports)
  177. 177. t name=neo4j 8 imports y 5 name=blueprints imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1g.v(1).out(created).as(x).out(imports).as(y)
  178. 178. x y 2 blueprints t 2 pipes 2 gremlin name=neo4j 8 imports y 5 name=blueprints imports y imports x imports 2 imports 6 name=pipes imports y imports created 7 name=gremlin 1g.v(1).out(created).as(x).out(imports).as(y).table(t){it.id}{it.name}
  179. 179. g.clear()
  180. 180. Graph Construction
  181. 181. 1a = g.addVertex()
  182. 182. name=pierre 1a.name = pierre
  183. 183. name=pierre city=brussels 1a.city = brussels
  184. 184. name=stephen city=dc 2 name=pierre city=brussels 1b = g.addVertex([name:stephen,city:dc])
  185. 185. name=rexster logo= reXster . 3 name=stephen city=dc 2 name=pierre city=brussels 1c = g.addVertex([name:rexster,logo:[a12f04b312bc...]])
  186. 186. name=rexster logo= reXster . 3 since=2011 created name=stephen city=dc 2 name=pierre city=brussels 1g.addEdge(b,c,created,[since:2011])
  187. 187. name=rexster logo= reXster . 3 since=2011 created name=stephen since=2011 city=dc reviews 2 name=pierre city=brussels 1g.addEdge(a,c,reviews,[since:2011])
  188. 188. name=gremlin logo= Gremlin G = (V, E) . 4 name=rexster imports logo= reXster . 3 since=2011 created name=stephen since=2011 city=dc reviews 2 name=pierre city=brussels 1g.addEdge(c,g.addVertex([name:gremlin,logo:[ab1346f47...]),imports)
  189. 189. name=pipes logo= Pipes. 5 name=gremlin logo= Gremlin G = (V, E) . imports 4 name=rexster imports logo= reXster . 3 since=2011 created name=stephen since=2011 city=dc reviews 2 name=pierre city=brussels 1g.addEdge(c,g.addVertex([name:pipes,logo:[12cbef46...]]),imports)
  190. 190. name=blueprints name=pipes logo= Blueprints . logo= Pipes. 6 5 name=gremlin logo= Gremlin imports . G = (V, E) imports 4 name=rexster imports logo= reXster . 3 since=2011 created name=stephen since=2011 city=dc reviews 2 name=pierre city=brussels 1g.addEdge(c,g.addVertex([name:blueprints,logo:[f13cd1467...]]),imports)
  191. 191. 6 5 4 3 2 1g.V
  192. 192. 6g.V.count()
  193. 193. blueprints pipes gremlin rexster stephen pierreg.V.name
  194. 194. 6 5 4 3 2 1g.V
  195. 195. Blueprints Pipes Gremlin G = (V, E) reXsterg.V.logo
  196. 196. 4g.V.logo.count()
  197. 197. name=blueprints name=pipes logo= Blueprints . logo= Pipes . name=gremlin logo= Gremlin G = (V, E) . name=rexster logo= reXster . name=stephen city=dc name=pierre city=brusselsg.V.transform{it.map()}
  198. 198. 6g.V.transform{it.map()}.count()
  199. 199. 7g.V.transform{it.map()}.count() + 1
  200. 200. 8g.V.transform{it.map()}.count() + 1 + 1
  201. 201. 4(g.V.transform{it.map()}.count() + 1 + 1) / 2
  202. 202. 4 is a number.((g.V.transform{it.map()}.count() + 1 + 1) / 2) + is a number.
  203. 203. 14(((g.V.transform{it.map()}.count() + 1 + 1) / 2) + is a number.).length()
  204. 204. imports imports imports created reviewsg.E
  205. 205. since=2011 since=2011g.E.transform{it.map()}
  206. 206. g.clear()
  207. 207. Graph Ranking
  208. 208. 7 friend 6 friend friend 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.loadGraphML(loopy-lou-and-the-loops.xml)
  209. 209. m 7 friend 6 friend friend 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3m = [:]
  210. 210. m 7 friend 6 friend friendc 0 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3c = 0
  211. 211. m 7 friend 6 friend friendc 0 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  212. 212. m 7 friend 6 friend friendc 0 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  213. 213. v[2]=1m v[6]=1 7 friend 6 friend friendc 0 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  214. 214. v[2]=1m v[6]=1 7 friend 6 friend friendc 2 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  215. 215. v[2]=1 v[3]=1m v[6]=2 v[7]=1 7 friend 6 friend friendc 2 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  216. 216. v[2]=1 v[3]=1m v[6]=2 v[7]=1 7 friend 6 friend friendc 5 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  217. 217. v[1]=1 v[2]=1 v[3]=1m v[4]=1 v[6]=2 v[7]=2 v[8]=1 7 friend 6 friend friendc 5 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  218. 218. v[1]=1 v[2]=1 v[3]=1m v[4]=1 v[6]=2 v[7]=2 v[8]=1 7 friend 6 friend friendc 9 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  219. 219. v[1]=3 v[2]=2 v[3]=1 v[4]=1m v[5]=1 v[6]=3 v[7]=2 v[8]=2 7 friend 6 friend friendc 9 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  220. 220. v[1]=3 v[2]=2 v[3]=1 v[4]=1m v[5]=1 v[6]=3 v[7]=2 v[8]=2 7 friend 6 friend friendc 15 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  221. 221. v[1]=4 v[2]=4 v[3]=3 v[4]=1m v[5]=1 v[6]=7 v[7]=3 v[8]=2 7 friend 6 friend friendc 15 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  222. 222. v[1]=4 v[2]=4 v[3]=3 v[4]=1m v[5]=1 v[6]=7 v[7]=3 v[8]=2 7 friend 6 friend friendc 25 8 5 friend friend friend friend friend friend 1 4 friend friend 2 friend 3g.v(1).out.groupCount(m).loop(2){c++ < 35}.filter{false}
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×