use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class JanusGraphTraversalUtil method getJanusGraph.
public static StandardJanusGraph getJanusGraph(final Traversal.Admin<?, ?> traversal) {
Optional<Graph> optionalGraph = traversal.getGraph();
if (!optionalGraph.isPresent()) {
return null;
}
Graph graph = optionalGraph.get();
if (graph instanceof StandardJanusGraph) {
return (StandardJanusGraph) graph;
}
if (graph instanceof StandardJanusGraphTx) {
return ((StandardJanusGraphTx) graph).getGraph();
}
return null;
}
use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class JanusGraphLocalQueryOptimizerStrategy method apply.
@Override
public void apply(final Traversal.Admin<?, ?> traversal) {
if (!traversal.getGraph().isPresent())
return;
final StandardJanusGraph janusGraph = JanusGraphTraversalUtil.getJanusGraph(traversal);
if (janusGraph == null) {
return;
}
boolean batchPropertyPrefetching = janusGraph.getConfiguration().batchPropertyPrefetching();
int txVertexCacheSize = janusGraph.getConfiguration().getTxVertexCacheSize();
applyJanusGraphVertexSteps(traversal, batchPropertyPrefetching, txVertexCacheSize);
applyJanusGraphPropertiesSteps(traversal);
inspectLocalTraversals(traversal);
}
use of org.janusgraph.graphdb.database.StandardJanusGraph in project janusgraph by JanusGraph.
the class JanusGraphMultiQueryStrategy method apply.
@Override
public void apply(final Admin<?, ?> traversal) {
if (!traversal.getGraph().isPresent() || TraversalHelper.onGraphComputer(traversal) || // this strategy should not run on those traversals either, because it can also insert barrier().
!TraversalHelper.getStepsOfAssignableClassRecursively(DropStep.class, traversal).isEmpty()) {
return;
}
final StandardJanusGraph janusGraph = JanusGraphTraversalUtil.getJanusGraph(traversal);
if (janusGraph == null) {
return;
}
final Optional<StandardJanusGraphTx> tx = JanusGraphTraversalUtil.getJanusGraphTx(traversal);
boolean useMultiQuery = tx.isPresent() ? tx.get().getConfiguration().useMultiQuery() : janusGraph.getConfiguration().useMultiQuery();
if (!useMultiQuery) {
return;
}
insertMultiQuerySteps(traversal, janusGraph.getConfiguration().limitBatchSize());
configureMultiQueriables(traversal);
}
Aggregations