Class QueryEdge

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

public final class QueryEdge extends Object
Represents an edge pattern element in a GQL MATCH clause. An edge connects a source QueryVertex to a target QueryVertex with an optional variable name, optional label constraint, a traversal direction, and optional property predicates on the edge itself.

Direction semantics follow the GQL arrow notation:

  • Field Details

    • UNBOUNDED

      public static final int UNBOUNDED
      Sentinel getMaxHops() value denoting an open-ended upper bound, used for the {m,} and + quantifier forms (i.e. "at least minHops, no ceiling").
      See Also:
  • Constructor Details

  • Method Details

    • getVariable

      public String getVariable()
      Returns the variable name bound to this edge, or null if anonymous.
    • getLabel

      public String getLabel()
      Returns the label constraint for this edge, or null if unconstrained.
    • getDirection

      public Direction getDirection()
      Returns the traversal direction: Direction.OUT, Direction.IN, or Direction.BOTH.
    • getSource

      public QueryVertex getSource()
      Returns the source (left-hand) vertex of this edge pattern.
    • getTarget

      public QueryVertex getTarget()
      Returns the target (right-hand) vertex of this edge pattern.
    • getPredicates

      public List<PropertyPredicate> getPredicates()
      Returns the property equality predicates on this edge, or an empty list if none were specified.
    • getMinHops

      public int getMinHops()
      Returns the minimum number of hops this edge pattern matches. For a plain, non-quantified edge this is 1.
    • getMaxHops

      public int getMaxHops()
      Returns the maximum number of hops this edge pattern matches, or UNBOUNDED for the open-ended forms ({m,} and +). For a plain, non-quantified edge this is 1.
    • isQuantified

      public boolean isQuantified()
      Returns true if this edge pattern carries a quantifier (e.g. {1,3}, {1}, +, {2,}), as opposed to a plain edge. This reflects the presence of the quantifier in the query, not the hop bounds, so {1} and {1,1} are quantified.
    • isEdgeVariableGroup

      public boolean isEdgeVariableGroup()
      Returns true if this edge's variable is a group variable, which binds an ordered List<Edge>. That is the case exactly when the edge is quantified and named.
    • toString

      public String toString()
      Overrides:
      toString in class Object