Expressive Path Queries and Pattern Matching for Graph Data

22 concepts18 papers1 proposal

Traditional databases excel at retrieving data from rigid tables or hierarchical trees. However, as data becomes increasingly interconnected—forming social networks, biological pathways, and knowledge graphs—the challenge shifts from finding specific values to identifying complex relationships. This research direction focuses on extending query languages to support two fundamental operations: graph pattern matching, which finds specific structural "shapes" within a network, and navigational expressions, which follow paths of arbitrary length between nodes.

From Strings to Graph Paths

The intuition behind modern graph querying often stems from string processing. If a path through a graph is viewed as a sequence of edge labels, then searching for a relationship is analogous to searching for a substring. As early as 1973, Mylopoulos et al. in A SNOBOL-Based Programming Language for Artificial Intelligence Applications proposed treating graph paths as sequences that could be matched using string-processing logic. This allowed complex structural queries to be executed by engines originally optimized for text.

In modern systems, this concept evolved into Regular Path Queries (RPQs). By incorporating regular expressions into graph languages, researchers like Motahari‐Nezhad et al. enable the discovery of transitive relationships, such as social influence chains or citation paths, where the exact number of "hops" between nodes is unknown.

Increasing Expressivity with Grammars and Logic

While regular expressions are powerful, they cannot describe all structural patterns. For instance, they cannot identify "balanced" paths, such as finding two nodes at the exact same depth in a hierarchy. To solve this, Zhang et al. introduced Context-Free Path Queries on RDF Graphs, which use context-free grammars to define recursive and symmetrical path patterns.

Beyond just following labels, queries often need to reason about the data stored within the nodes themselves. Barcelo et al. addressed this by proposing Register Logic (RL). This mechanism allows a query to "remember" a value encountered at one node (storing it in a register) and compare it to a value found later in the traversal, enabling the system to filter paths based on data consistency.

Structural Pattern Matching

While navigation focuses on how to get from A to B, pattern matching focuses on the shape of the data. As Angles et al. clarify in their survey, Foundations of Modern Query Languages for Graph Databases, pattern matching identifies substructures that conform to a specific template.

Recent advancements have made these templates more flexible. For example, Terra-Neves et al. proposed Regular Graph Patterns (ReGaPs), which generalize graph isomorphism by allowing wildcard nodes and flexible structural constraints. Similarly, for data that is nominally hierarchical but contains hidden cycles, Wang et al. developed GXQuery, which uses variable bindings to anchor specific nodes, allowing standard tree-based languages to recognize cycles and overlapping structures.

Integrating Graphs into Relational Systems

A major practical hurdle is that most enterprise data still resides in Relational Database Management Systems (RDBMS). Rather than moving all data to specialized graph databases, researchers are extending SQL to handle graph logic natively.

  1. Recursive Processing: Zhao and Yu demonstrated in All-in-One: Graph Processing in RDBMSs Revisited that by extending the SQL WITH clause to support non-linear and mutual recursion, RDBMSs can execute complex graph algorithms like PageRank with high efficiency.
  2. Unified Operators: Lou et al. argue for a converged framework where graph patterns are treated as first-class citizens. By adding a dedicated MATCH operator to the standard Select-Project-Join model, optimizers can preserve structural constraints rather than breaking them down into expensive, generic joins.
  3. Minimal Extensions: Deutsch advocates for minimal SQL extensions that incorporate recursive path expressions, allowing users to leverage the familiarity of SQL while gaining the navigational power of specialized graph languages.

By bridging the gap between formal language theory (grammars and logic) and practical database implementation (SQL extensions and optimized joins), this research direction enables more intuitive and scalable exploration of the world's increasingly connected data.

Key Foundational Work

l.Pak: A SNOBOL-Based Programming Language for Artificial Intelligence Applications (1973) — contributed 2 concept elements to this direction.
l.Pak: A SNOBOL-Based Programming Language for Artificial Intelligence Applications (1973) — contributed 1 concept elements to this direction.
On the Implementation of AMBIT/G: A Graphical Programming Language (1969) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_graph_pattern_matching_adeae9bf,
  title = {graph pattern matching},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/graph-pattern-matching/rdr_adeae9bfbfd2472982bde385b0db2843},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 1, frozen text):

@misc{lacuna_graph_pattern_matching_adeae9bf_v1,
  title = {graph pattern matching},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/graph-pattern-matching/rdr_adeae9bfbfd2472982bde385b0db2843/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-23},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake