Java Code Examples for org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#close()

The following examples show how to use org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal#close() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestOutE.java    From sqlg with MIT License 6 votes vote down vote up
@Test
   public void testOutEWithAttributes() throws Exception {
    Vertex v1 = this.sqlgGraph.addVertex(T.label, "Person", "name", "p1");
       Vertex v2 = this.sqlgGraph.addVertex(T.label, "Person", "name", "p2");
       Vertex v3 = this.sqlgGraph.addVertex(T.label, "Person", "name", "p3");
       Vertex v4 = this.sqlgGraph.addVertex(T.label, "Person", "name", "p4");
       Vertex v5 = this.sqlgGraph.addVertex(T.label, "Person", "name", "p5");
       
       v1.addEdge("aaa", v2,"real",true);
       v1.addEdge("aaa", v3,"real",false);
       v1.addEdge("aaa", v4,"real",true,"other","one");
       v1.addEdge("aaa", v5,"real",false);
       
       this.sqlgGraph.tx().commit();
       GraphTraversal<Vertex, Vertex> gt=vertexTraversal(this.sqlgGraph, v1).outE()
              		.where(__.inV().has("name",P.within("p4","p2")))
              		.inV();
       assertEquals(2,gt.count().next().intValue());
       gt.close();
      
}
 
Example 2
Source File: TestClosingPreparedStatement.java    From sqlg with MIT License 6 votes vote down vote up
@Test
public void testRead() {
	 Vertex v=this.sqlgGraph.addVertex(T.label, "A");
	 this.sqlgGraph.tx().commit();
  GraphTraversal<Vertex, Vertex> gt = sqlgGraph.traversal().V(v.id());
     try {
    	 Vertex v2= gt.next();
    	 assertEquals(v.id(),v2.id());
    	 assertFalse(this.sqlgGraph.tx().getPreparedStatementCache().isEmpty());
    	 assertFalse(gt.hasNext());
    	 assertTrue(this.sqlgGraph.tx().getPreparedStatementCache().isEmpty());
     } finally {
           try {
                 gt.close(); 
                 gt = null;
           } catch (Exception e) {
        	   e.printStackTrace();
        	   fail(e.getMessage());
           }
     }

	 
}
 
Example 3
Source File: TestTopologyDelete.java    From sqlg with MIT License 5 votes vote down vote up
private void checkCount(GraphTraversal<?, ?> gt, long count) throws Exception {
    try {
        assertEquals(count, gt.count().next().longValue());
    } finally {
        gt.close();
    }
}