/**
* Instantiates a new graph traversal query engine.
*
- * @param graphEngine the graph engine
+ * @param g graph traversal source to traverse the graph
*/
public GraphTraversalQueryEngine(GraphTraversalSource g) {
super(g);
*/
@Override
public List<Vertex> findDeletable(Vertex start) {
- @SuppressWarnings("unchecked")
- GraphTraversal<Vertex, Vertex> pipe = this.g
- .V(start).emit(v -> true).repeat(
- __.union(
- __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
- __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
- )
- ).dedup();
+ try {
+ StopWatch.conditionalStart();
+ @SuppressWarnings("unchecked")
+ GraphTraversal<Vertex, Vertex> pipe = this.g
+ .V(start).emit(v -> true).repeat(
+ __.union(
+ __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
+ __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
+ )
+ ).dedup();
- return pipe.toList();
+ return pipe.toList();
+ } finally {
+ dbTimeMsecs += StopWatch.stopIfStarted();
+ }
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public List<Vertex> findDeletable(List<Vertex> startVertexes) {
+ try {
+ StopWatch.conditionalStart();
+ Vertex[] vertices = new Vertex[startVertexes.size()];
+ vertices = startVertexes.toArray(vertices);
+ GraphTraversal<Vertex, Vertex> pipe = this.g
+ .V(vertices).emit(v -> true).repeat(
+ __.union(
+ __.outE().has(DELETE_OTHER_V.toString(), OUT.toString()).inV(),
+ __.inE().has(DELETE_OTHER_V.toString(), IN.toString()).outV()
+ )
+ ).dedup();
+
+ return pipe.toList();
+ }
+ finally {
+ dbTimeMsecs += StopWatch.stopIfStarted();
+ }
+ }
+
/**
* {@inheritDoc}
*/