A GQL query typically begins with theDocumentation Index
Fetch the complete documentation index at: https://gql.ch/llms.txt
Use this file to discover all available pages before exploring further.
MATCH clause, which identifies a graph pattern to search for in the data. It is the foundation for querying nodes, relationships, and their properties. The MATCH clause specifies the structural shape of the subgraph being queried.
u, e) are labeled with semantic roles, and the relationship [:PERFORMED] describes the interaction between them.
Patterns can include multiple relationships and variable-length traversals using the {m,n} quantifier. For example, [:FOLLOWS]->{,3} matches up to 3 levels of consecutive FOLLOWS relationships. The MATCH clause is frequently used in combination with WHERE, RETURN, and WITH clauses to build complex queries.
Variable Binding in GQL
Retrieve all the teachers who liked a comment made by students who they know since 2021 or earlier::teacher-labelled node to the variable x and requiring there be a :likes-labelled edge to a node representing a comment. In GQL ASCII-art syntax, round brackets represent nodes, while square brackets represent edges. We then require this comment to have been made by a student (represented by an :author edge to a node with the label student). Finally, we require this student to have any edge to the original node bound to x, that this edge is labelled with :knows and that the value of its since attribute is greater than 2021
Shortest Path
Find shortest pathpath, from a user u1 to user u2 traversing :knows edges 1+ ({1,}) times.
Expressing complex queries using Multiple Paths
Find a pair of friends in the same city ((y.city = x.city)) who transfer money ((account_x)−[t1:transfer]−>(account_z)−[t2:transfer]−>(account_y)) to each other using a common friend who lives elsewhere ((x.city<>z.city)).