Search in sources :

Example 1 with TraversalStrategies

use of org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies in project janusgraph by JanusGraph.

the class JanusGraphStepStrategyTest method doTest.

@Test
public void doTest() {
    final TraversalStrategies strategies = new DefaultTraversalStrategies();
    strategies.addStrategies(JanusGraphStepStrategy.instance());
    for (final TraversalStrategy strategy : this.otherStrategies) {
        strategies.addStrategies(strategy);
    }
    this.original.asAdmin().setStrategies(strategies);
    this.original.asAdmin().applyStrategies();
    assertEquals(this.optimized, this.original);
}
Also used : TraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies) DefaultTraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies) TraversalStrategy(org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy) DefaultTraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies) Test(org.junit.Test)

Example 2 with TraversalStrategies

use of org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies in project grakn by graknlabs.

the class TxFactoryJanus method newJanusGraph.

private synchronized JanusGraph newJanusGraph(boolean batchLoading) {
    JanusGraph JanusGraph = configureGraph(batchLoading);
    buildJanusIndexes(JanusGraph);
    JanusGraph.tx().onClose(Transaction.CLOSE_BEHAVIOR.ROLLBACK);
    if (!strategiesApplied.getAndSet(true)) {
        TraversalStrategies strategies = TraversalStrategies.GlobalCache.getStrategies(StandardJanusGraph.class);
        strategies = strategies.clone().addStrategies(new JanusPreviousPropertyStepStrategy());
        // TODO: find out why Tinkerpop added these strategies. They result in many NoOpBarrier steps which slowed down our queries so we had to remove them.
        strategies.removeStrategies(PathRetractionStrategy.class, LazyBarrierStrategy.class);
        TraversalStrategies.GlobalCache.registerStrategies(StandardJanusGraph.class, strategies);
        TraversalStrategies.GlobalCache.registerStrategies(StandardJanusGraphTx.class, strategies);
    }
    return JanusGraph;
}
Also used : TraversalStrategies(org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies) StandardJanusGraph(org.janusgraph.graphdb.database.StandardJanusGraph) JanusGraph(org.janusgraph.core.JanusGraph)

Aggregations

TraversalStrategies (org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies)2 TraversalStrategy (org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy)1 DefaultTraversalStrategies (org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies)1 JanusGraph (org.janusgraph.core.JanusGraph)1 StandardJanusGraph (org.janusgraph.graphdb.database.StandardJanusGraph)1 Test (org.junit.Test)1