Package org.apache.tinkerpop.gremlin.gql
Class QueryGraph
java.lang.Object
org.apache.tinkerpop.gremlin.gql.QueryGraph
The logical graph structure produced by parsing a GQL MATCH clause. A
QueryGraph
holds the complete set of QueryVertex and QueryEdge objects that represent
the pattern to match, preserving the variable-identity relationships across multiple
comma-separated path patterns.
Variable identity is enforced: if the same variable name appears in multiple patterns,
the corresponding QueryVertex instances are shared (reference-equal) in the
resulting graph.
Use parse(String) to construct a QueryGraph from a GQL MATCH string.
-
Method Summary
Modifier and TypeMethodDescriptiongetEdges()Returns the ordered list of all edges in this pattern graph.getNodes()Returns the ordered list of all nodes in this pattern graph.static QueryGraphParses a GQL MATCH string and returns the correspondingQueryGraph.toString()
-
Method Details
-
getNodes
Returns the ordered list of all nodes in this pattern graph. -
getEdges
Returns the ordered list of all edges in this pattern graph. -
parse
Parses a GQL MATCH string and returns the correspondingQueryGraph.The input must begin with the
MATCHkeyword followed by one or more comma-separated path patterns. Example:MATCH (a:Person)-[:KNOWS]->(b:Person) MATCH (a:Person)-[:KNOWS]->(b:Person), (b)-[:WORKS_AT]->(c:Company)
- Parameters:
gqlMatchString- a GQL MATCH expression- Returns:
- the constructed
QueryGraph - Throws:
IllegalArgumentException- if the string cannot be parsed
-
toString
-