Package org.apache.tinkerpop.gremlin.gql
Class QueryEdge
java.lang.Object
org.apache.tinkerpop.gremlin.gql.QueryEdge
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:
-[:L]->isDirection.OUT— edge goes from source to target<-[:L]-isDirection.IN— edge goes from target to source-[:L]-isDirection.BOTH— undirected, either direction matches
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSentinelgetMaxHops()value denoting an open-ended upper bound, used for the{m,}and+quantifier forms (i.e. -
Constructor Summary
ConstructorsConstructorDescriptionQueryEdge(String variable, String label, Direction direction, QueryVertex source, QueryVertex target) QueryEdge(String variable, String label, Direction direction, QueryVertex source, QueryVertex target, List<PropertyPredicate> predicates) QueryEdge(String variable, String label, Direction direction, QueryVertex source, QueryVertex target, List<PropertyPredicate> predicates, int minHops, int maxHops, boolean quantified) Creates an edge pattern element. -
Method Summary
Modifier and TypeMethodDescriptiongetLabel()Returns the label constraint for this edge, ornullif unconstrained.intReturns the maximum number of hops this edge pattern matches, orUNBOUNDEDfor the open-ended forms ({m,}and+).intReturns the minimum number of hops this edge pattern matches.Returns the property equality predicates on this edge, or an empty list if none were specified.Returns the source (left-hand) vertex of this edge pattern.Returns the target (right-hand) vertex of this edge pattern.Returns the variable name bound to this edge, ornullif anonymous.booleanReturnstrueif this edge's variable is a group variable, which binds an orderedList<Edge>.booleanReturnstrueif this edge pattern carries a quantifier (e.g.toString()
-
Field Details
-
UNBOUNDED
public static final int UNBOUNDEDSentinelgetMaxHops()value denoting an open-ended upper bound, used for the{m,}and+quantifier forms (i.e. "at leastminHops, no ceiling").- See Also:
-
-
Constructor Details
-
QueryEdge
public QueryEdge(String variable, String label, Direction direction, QueryVertex source, QueryVertex target, List<PropertyPredicate> predicates, int minHops, int maxHops, boolean quantified) Creates an edge pattern element.quantifiedrecords whether the pattern carried an explicit quantifier, so{1}and{1,1}are quantified even though their bounds equal those of a plain edge. -
QueryEdge
public QueryEdge(String variable, String label, Direction direction, QueryVertex source, QueryVertex target, List<PropertyPredicate> predicates) -
QueryEdge
public QueryEdge(String variable, String label, Direction direction, QueryVertex source, QueryVertex target)
-
-
Method Details
-
getVariable
Returns the variable name bound to this edge, ornullif anonymous. -
getLabel
Returns the label constraint for this edge, ornullif unconstrained. -
getDirection
-
getSource
Returns the source (left-hand) vertex of this edge pattern. -
getTarget
Returns the target (right-hand) vertex of this edge pattern. -
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 is1. -
getMaxHops
public int getMaxHops()Returns the maximum number of hops this edge pattern matches, orUNBOUNDEDfor the open-ended forms ({m,}and+). For a plain, non-quantified edge this is1. -
isQuantified
public boolean isQuantified()Returnstrueif 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()Returnstrueif this edge's variable is a group variable, which binds an orderedList<Edge>. That is the case exactly when the edge is quantified and named. -
toString
-