Class GqlMatchPlan

java.lang.Object
org.apache.tinkerpop.gremlin.gql.GqlMatchPlan

public final class GqlMatchPlan extends Object
The compiled physical execution plan for a GQL MATCH query. A GqlMatchPlan is an ordered sequence of ExtensionStep objects produced by the TinkerGraphGqlPlanner from a QueryGraph.

The planner selects a seed vertex (lowest-cardinality anchor) and emits one ExtensionStep per edge in the QueryGraph, ordered so each step's anchor variable is bound before the step executes. The executor iterates these steps to perform DFS backtracking pattern matching.

The seed node is described by getSeedVariable(), getSeedLabel(), and getSeedPredicates(). The executor binds the seed variable first (iterating all vertices matching the seed label and property predicates) before processing the extension steps.

  • Field Details

    • ANON_VAR_PREFIX

      public static final String ANON_VAR_PREFIX
      Prefix used for synthetic variable names assigned to anonymous pattern nodes/edges (those written without an explicit variable, e.g. ()-[:knows]->() ). Variables with this prefix are internal bookkeeping and are never exposed in result binding maps or traverser paths.
      See Also:
  • Constructor Details

  • Method Details

    • getSeedVariable

      public String getSeedVariable()
      Returns the effective variable name of the seed node. May be a synthetic name (prefixed with $anon) if the seed node has no explicit variable.
    • getSeedLabel

      public String getSeedLabel()
      Returns the label constraint of the seed node, or null if unconstrained.
    • getSeedPredicates

      public List<PropertyPredicate> getSeedPredicates()
      Returns property equality predicates on the seed node derived from its inline filter map. The executor applies these when iterating seed candidates. Empty if no filter was specified on the seed node.
    • getSteps

      public List<ExtensionStep> getSteps()
      Returns the ordered list of extension steps that the executor will process.
    • getSeedVariableIndex

      public int getSeedVariableIndex()
      Returns the index of the seed variable in the binding array. Always 0.
    • getIndex

      public int getIndex(String variableName)
      Returns the binding-array index for the given variable name.
    • getVariableCount

      public int getVariableCount()
      Returns the total number of variables (= binding array length).
    • getVariables

      public String[] getVariables()
      Returns the variable name at each binding-array index. Used by TinkerGraphMatchStep to iterate result rows by index.
    • isEmpty

      public boolean isEmpty()
      Returns true if the plan has no steps (e.g., a single-node pattern with no edges).
    • toString

      public String toString()
      Overrides:
      toString in class Object