use of org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies 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);
}
use of org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies in project janusgraph by JanusGraph.
the class JanusGraphAssert method assertOptimization.
public static void assertOptimization(Traversal<?, ?> expectedTraversal, Traversal<?, ?> originalTraversal, TraversalStrategy... optimizationStrategies) {
final TraversalStrategies optimizations = new DefaultTraversalStrategies();
for (final TraversalStrategy<?> strategy : optimizationStrategies) {
optimizations.addStrategies(strategy);
}
originalTraversal.asAdmin().setStrategies(optimizations);
originalTraversal.asAdmin().applyStrategies();
assertEquals(expectedTraversal.asAdmin().getSteps().toString(), originalTraversal.asAdmin().getSteps().toString());
}
use of org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies in project janusgraph by JanusGraph.
the class JanusGraphStepStrategyTest method doTest.
@ParameterizedTest
@MethodSource("generateTestParameters")
public void doTest(Traversal original, Traversal optimized, Collection<TraversalStrategy> otherStrategies) {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(JanusGraphStepStrategy.instance());
for (final TraversalStrategy strategy : otherStrategies) {
strategies.addStrategies(strategy);
}
original.asAdmin().setStrategies(strategies);
original.asAdmin().applyStrategies();
assertEquals(optimized, original);
}
use of org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies in project unipop by unipop-graph.
the class StandardStrategyProvider method get.
@Override
public TraversalStrategies get() {
DefaultTraversalStrategies traversalStrategies = new DefaultTraversalStrategies();
traversalStrategies.addStrategies(new UniGraphStepStrategy(), new UniGraphVertexStepStrategy(), new EdgeStepsStrategy(), new UniGraphPropertiesStrategy(), new UniGraphCoalesceStepStrategy(), new UniGraphWhereStepStrategy(), new UniGraphRepeatStepStrategy(), new UniGraphOrderStrategy());
TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList().forEach(traversalStrategies::addStrategies);
return traversalStrategies;
}
use of org.apache.tinkerpop.gremlin.process.traversal.util.DefaultTraversalStrategies in project janusgraph by JanusGraph.
the class JanusGraphStepStrategyTest method doMultiQueryTest.
@ParameterizedTest
@MethodSource("generateMultiQueryTestParameters")
public void doMultiQueryTest(Traversal original, Traversal expected, Collection<TraversalStrategy> otherStrategies) {
final TraversalStrategies strategies = new DefaultTraversalStrategies();
strategies.addStrategies(JanusGraphStepStrategy.instance());
for (final TraversalStrategy strategy : otherStrategies) {
strategies.addStrategies(strategy);
}
// Can't add explicitly add JanusGraphVertexStep or JanusGraphMultiQueryStep to the expected traversal so add them now
Traversal.Admin<?, ?> optimized = expected.asAdmin();
applyMultiQueryTraversalSteps(optimized);
original.asAdmin().setStrategies(strategies);
original.asAdmin().applyStrategies();
// Tried using assertEquals(optimized, original), but if the traversal has any steps of type SideEffectStep that fails
assertEquals(optimized.toString(), original.toString());
}
Aggregations