Class AdjacentToIncidentStrategy
java.lang.Object
org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy>
org.apache.tinkerpop.gremlin.process.traversal.strategy.optimization.AdjacentToIncidentStrategy
- All Implemented Interfaces:
Serializable,Comparable<Class<? extends TraversalStrategy>>,TraversalStrategy<TraversalStrategy.OptimizationStrategy>,TraversalStrategy.OptimizationStrategy
public final class AdjacentToIncidentStrategy
extends AbstractTraversalStrategy<TraversalStrategy.OptimizationStrategy>
implements TraversalStrategy.OptimizationStrategy
This strategy looks for vertex- and value-emitting steps followed by a
CountGlobalStep and replaces the
pattern with an edge- or property-emitting step followed by a CountGlobalStep. Furthermore, if a vertex-
or value-emitting step is the last step in a .has(traversal), .and(traversal, ...) or
.or(traversal, ...) child traversal, it is replaced by an appropriate edge- or property-emitting step.
Performing this replacement removes situations where the more expensive trip to an adjacent graph element (e.g.
the vertex on the other side of an edge) can be satisfied by trips to incident graph elements (e.g. just the edge
itself).- Author:
- Daniel Kuppitz (http://gremlin.guru)
- See Also:
- Example:
__.out().count() // is replaced by __.outE().count() __.in().limit(3).count() // is replaced by __.inE().limit(3).count() __.values("name").count() // is replaced by __.properties("name").count() __.where(__.out()) // is replaced by __.where(__.outE()) __.where(__.values()) // is replaced by __.where(__.properties()) __.and(__.in(), __.out()) // is replaced by __.and(__.inE(), __.outE())
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy
TraversalStrategy.DecorationStrategy, TraversalStrategy.FinalizationStrategy, TraversalStrategy.OptimizationStrategy, TraversalStrategy.ProviderOptimizationStrategy, TraversalStrategy.VerificationStrategy -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(Traversal.Admin<?, ?> traversal) The transformation the strategy applies to the traversal.Set<Class<? extends TraversalStrategy.OptimizationStrategy>>The set of strategies that must be executed before this strategy is executed.static AdjacentToIncidentStrategyinstance()Methods inherited from class org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy
equals, hashCode, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy
getConfigurationMethods inherited from interface org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy.OptimizationStrategy
applyPost, compareTo, getTraversalCategory
-
Method Details
-
apply
Description copied from interface:TraversalStrategyThe transformation the strategy applies to the traversal.- Specified by:
applyin interfaceTraversalStrategy<TraversalStrategy.OptimizationStrategy>
-
applyPrior
Description copied from interface:TraversalStrategyThe set of strategies that must be executed before this strategy is executed. If there are no ordering requirements, the default implementation returns an empty set.- Specified by:
applyPriorin interfaceTraversalStrategy<TraversalStrategy.OptimizationStrategy>- Returns:
- the set of strategies that must be executed prior to this one.
-
instance
-