Package org.apache.tinkerpop.gremlin.gql
Class DefaultGqlExecutor
java.lang.Object
org.apache.tinkerpop.gremlin.gql.DefaultGqlExecutor
- All Implemented Interfaces:
GqlExecutor
Executes a
GqlMatchPlan against any TinkerPop Graph using a DFS
backtracking pattern matching algorithm.
Algorithm
- Seed iteration — vertices are scanned from the graph (or looked up
via
Graph.Indexwhen available), filtered by the seed label and seed property predicates. Each matching vertex is bound to the seed variable and used as the starting point for DFS extension. - DFS extension —
extend(org.apache.tinkerpop.gremlin.structure.Element[], org.apache.tinkerpop.gremlin.gql.GqlMatchPlan, java.util.Map<java.lang.String, java.lang.Object>, java.util.List<org.apache.tinkerpop.gremlin.gql.ExtensionStep>, java.util.ArrayDeque<org.apache.tinkerpop.gremlin.structure.Element[]>)is called recursively with a sharedElement[]binding array. Steps are selected from the remaining list using DAG eligibility (anchor variable already bound), with BFS order as the tiebreaker. - Lazy delivery —
execute(org.apache.tinkerpop.gremlin.gql.GqlMatchPlan)returns anIteratorthat advances the DFS one seed vertex at a time.
Index access is provided via Graph.index(). When
Graph.Index.countVertexIndex(String, Object) returns a value less than
Long.MAX_VALUE for a seed predicate key, an index lookup replaces the full vertex
scan. When all counts equal Long.MAX_VALUE (no index), a full scan is used.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultGqlExecutor
-
-
Method Details
-
execute
Returns a lazyIteratorof result rows using an empty params map.- Specified by:
executein interfaceGqlExecutor- Parameters:
plan- the compiled execution plan- Returns:
- a lazy iterator of binding arrays
-
execute
Returns a lazyIteratorof result rows. Each row is anElement[]whose indices correspond to the variable index defined in theGqlMatchPlan.- Specified by:
executein interfaceGqlExecutor- Parameters:
plan- the compiled execution planparams- parameter bindings for$namereferences in property predicates; may be empty if the query contains no parameter references- Returns:
- a lazy iterator of binding arrays
-