Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
- ==>titangraph[berkeleyje:/tmp/test]
- gremlin> mgmt = g.getManagementSystem();
- ==>com.thinkaurelius.titan.graphdb.database.management.ManagementSystem@27c04377
- gremlin> id = mgmt.makePropertyKey("uid").dataType(Long.class).make()
- ==>uid
- gremlin> mgmt.buildIndex('byUID',Vertex.class).addKey(id).buildCompositeIndex()
- ==>com.thinkaurelius.titan.graphdb.database.management.TitanGraphIndexWrapper@14f3c6fc
- gremlin> mgmt.commit()
- gremlin> for (int i=0;i<200;i++) { v = g.addVertex([uid:(int)Math.floor(i/2)])}
- ==>null
- gremlin> g.commit()
- ==>null
- gremlin> g.shutdown()
- ==>null
- gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
- ==>titangraph[berkeleyje:/tmp/test]
- gremlin> def times(c) { t = System.currentTimeMillis(); c.call(); return System.currentTimeMillis()-t;}
- ==>true
- gremlin> def execute(g) {
- for (int i=0;i<100;i++) {
- c = 0;
- for (Vertex v : g.getVertices('uid',i)) c++;
- }
- }
- ==>true
- gremlin> times{execute(g)}
- ==>91
- gremlin> times{execute(g)}
- ==>13
- gremlin> g.commit()
- ==>null
- gremlin> times{execute(g)}
- ==>28
- gremlin> times{execute(g)}
- ==>8
- gremlin> g.commit()
- ==>null
- gremlin> times{execute(g)}
- ==>20
- gremlin> times{execute(g)}
- ==>8
- gremlin> g.commit()
- ==>null
- gremlin> times{execute(g)}
- ==>28
- gremlin> times{execute(g)}
- ==>3
- gremlin> g.commit()
- ==>null
- gremlin> times{execute(g)}
- ==>16
- gremlin> times{execute(g)}
- ==>4
- gremlin> g.shutdown()
- ==>null
- gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
- ==>titangraph[berkeleyje:/tmp/test]
- gremlin> times{execute(g)}
- ==>30
- gremlin> times{execute(g)}
- ==>5
- gremlin> g.commit()
- ==>null
- gremlin> times{execute(g)}
- ==>9
- gremlin> g.shutdown()
- ==>null
- gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
- ==>titangraph[berkeleyje:/tmp/test]
- gremlin> times{execute(g)}
- ==>21
- gremlin> g.shutdown()
- ==>null
- gremlin> g = TitanFactory.open("berkeleyje:/tmp/test")
- ==>titangraph[berkeleyje:/tmp/test]
- gremlin> times{execute(g)}
- ==>20
- gremlin> g.commit()
- ==>null
- gremlin> times{execute(g)}
- ==>11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement