use of org.janusgraph.graphdb.query.graph.GraphCentricQuery in project janusgraph by JanusGraph.
the class JanusGraphStep method buildGraphCentricQuery.
private GraphCentricQuery buildGraphCentricQuery(JanusGraphQuery query, final QueryProfiler queryProfiler) {
Preconditions.checkArgument(query instanceof GraphCentricQueryBuilder);
final QueryProfiler optProfiler = queryProfiler.addNested(QueryProfiler.CONSTRUCT_GRAPH_CENTRIC_QUERY);
optProfiler.startTimer();
final GraphCentricQueryBuilder centricQueryBuilder = ((GraphCentricQueryBuilder) query);
if (traversal.getEndStep() instanceof CountGlobalStep) {
centricQueryBuilder.disableSmartLimit();
}
final GraphCentricQuery graphCentricQuery = centricQueryBuilder.constructQueryWithoutProfile(Vertex.class.isAssignableFrom(this.returnClass) ? ElementCategory.VERTEX : ElementCategory.EDGE);
optProfiler.stopTimer();
return graphCentricQuery;
}
use of org.janusgraph.graphdb.query.graph.GraphCentricQuery in project janusgraph by JanusGraph.
the class JanusGraphStep method executeGraphCentricQuery.
private void executeGraphCentricQuery(final GraphCentricQueryBuilder builder, final List<Iterator<E>> responses, final Entry<Integer, GraphCentricQuery> entry) {
final GraphCentricQuery query = entry.getValue();
final QueryProfiler profiler = query.getProfiler();
final Class<? extends JanusGraphElement> graphClass = Vertex.class.isAssignableFrom(this.returnClass) ? JanusGraphVertex.class : JanusGraphEdge.class;
final ProfiledIterator iterator = new ProfiledIterator(profiler, () -> builder.iterables(query, graphClass).iterator());
long i = 0;
while (i < entry.getKey() && iterator.hasNext()) {
iterator.next();
i++;
}
responses.add(iterator);
}
Aggregations