Advertisement
Guest User

Untitled

a guest
May 25th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
  2. ==>titangraph[berkeleyje:/tmp/test]
  3. gremlin> mgmt = g.getManagementSystem();
  4. ==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@27c04377
  5. gremlin> id = mgmt.makePropertyKey("uid").dataType(Long.class).make()
  6. ==>uid
  7. gremlin> mgmt.buildIndex('byUID',Vertex.class).addKey(id).buildCompositeIndex()
  8. ==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@14f3c6fc
  9. gremlin> mgmt.commit()
  10. gremlin> for (int i=0;i<200;i++) { v = g.addVertex([uid:(int)Math.floor(i/2)])}
  11. ==>null
  12. gremlin> g.commit()
  13. ==>null
  14. gremlin> g.shutdown()
  15. ==>null
  16. gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
  17. ==>titangraph[berkeleyje:/tmp/test]
  18. gremlin> def times(c) { t = System.currentTimeMillis(); c.call(); return System.currentTimeMillis()-t;}
  19. ==>true
  20. gremlin> def execute(g) {
  21. for (int i=0;i<100;i++) {
  22. c = 0;
  23. for (Vertex v : g.getVertices('uid',i)) c++;
  24. }
  25. }
  26. ==>true
  27. gremlin> times{execute(g)}
  28. ==>91
  29. gremlin> times{execute(g)}
  30. ==>13
  31. gremlin> g.commit()
  32. ==>null
  33. gremlin> times{execute(g)}
  34. ==>28
  35. gremlin> times{execute(g)}
  36. ==>8
  37. gremlin> g.commit()
  38. ==>null
  39. gremlin> times{execute(g)}
  40. ==>20
  41. gremlin> times{execute(g)}
  42. ==>8
  43. gremlin> g.commit()
  44. ==>null
  45. gremlin> times{execute(g)}
  46. ==>28
  47. gremlin> times{execute(g)}
  48. ==>3
  49. gremlin> g.commit()
  50. ==>null
  51. gremlin> times{execute(g)}
  52. ==>16
  53. gremlin> times{execute(g)}
  54. ==>4
  55. gremlin> g.shutdown()
  56. ==>null
  57. gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
  58. ==>titangraph[berkeleyje:/tmp/test]
  59. gremlin> times{execute(g)}
  60. ==>30
  61. gremlin> times{execute(g)}
  62. ==>5
  63. gremlin> g.commit()
  64. ==>null
  65. gremlin> times{execute(g)}
  66. ==>9
  67. gremlin> g.shutdown()
  68. ==>null
  69. gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
  70. ==>titangraph[berkeleyje:/tmp/test]
  71. gremlin> times{execute(g)}
  72. ==>21
  73. gremlin> g.shutdown()
  74. ==>null
  75. gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
  76. ==>titangraph[berkeleyje:/tmp/test]
  77. gremlin> times{execute(g)}
  78. ==>20
  79. gremlin> g.commit()
  80. ==>null
  81. gremlin> times{execute(g)}
  82. ==>11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement