We have covered a lot of territory in GSQL 102:

  • Showed how to invoke GSQL Pattern Matching syntax

  • Explained how Pattern Matching extends the classic FROM clause grammar:

    • Each hop can be a choice of multiple, individually directed edge types

    • The Kleene star and a min...max range enable each hop to be repeated.

    • GSQL automatically finds the shortest paths that satisfy a variable length path.

    • A virtual match table has a column for each vertex or edge alias in a multi-hop path, and a row for each graph path that satisfies the pattern.

    • The ACCUM clause iterates on each row in the match table.

    • A POST-ACCUM clause iterates on one vertex alias; a query can have multiple POST-ACCUM clauses.

  • Described the improvements to Pattern Matching in TigerGraph 3.0:

    • The source (leftmost) vertex set can be specified with the same flexibility as the other vertex sets: a vertex type, an alteration of types, or omitted. Explicit seed sets are no longer needed

    • Restrictions on which vertex aliases may be used in the ACCUM clause have been lifted.

    • Described three major advanced options:

      • The PER <vertex alias> clause enables users to fine tune the ACCUM iteration.

      • Data modification (insert, update, delete) are now supported.

      • Conjunctive Pattern Matching let users express a complex pattern as a set of path patterns which must all be satisfied.

  • Provided best practices for writing queries, especially pattern matching queries:

    • Put the smaller vertex set on the left end.

    • Specify all vertex and edge types explicitly.

    • Use the PER clause to reduce the match table size

  • Provided numerous examples and the full set of LDBC Social Network benchmark queries.

With a little practice, you will be writing GSQL pattern matching queries to efficiently solve real-world problems.