G-CORE: A Core for Future Graph Query Languages

Renzo Angles, Marcelo Arenas, Pablo Barceló, Peter Boncz, George H. L. Fletcher, Claudio Gutierrez, Tobias Lindaaker, Marcus Paradies, Stefan Plantikow, Juan Sequeda, Oskar van Rest, Hannes Voigt

TL;DR

G-CORE is a powerful new graph query language design that bridges the gap between academic theory and industrial practice. Its two defining innovations are composability—ensuring queries take graphs as input and return graphs as output—and treating paths as first-class citizens that can have their own labels and properties.

What Problem Does This Paper Address?

Despite the explosion of graph database management systems (GDBMS), the industry lacks a unified, standard query language comparable to SQL for relational databases. Existing languages like Cypher, PGQL, and Gremlin have significant differences in semantics and capabilities.

The authors identify three main challenges in the current landscape:

  1. Lack of Composability: Most current languages return tables of values, nodes, or edges. This "breaks" the graph model, making it difficult to pipe the output of one query into another or to create complex views.
  2. Paths as Second-Class Citizens: While paths are fundamental to graph data, they are often difficult to manipulate, annotate, or return directly within the query language.
  3. The Complexity-Expressivity Gap: There is a constant tension between making a language expressive enough for complex navigation and keeping it computationally tractable (i.e., ensuring queries don't take an eternity to run on large datasets).
Graph database usage characteristics showing the demand for features like reachability and path finding.

Methods

G-CORE introduces the Path Property Graph (PPG) model. Unlike the standard property graph model, a PPG explicitly includes a collection of paths. These paths are not just metadata; they have identities, labels, and property-value pairs, just like nodes and edges.

Key technical components include:

  • The CONSTRUCT Clause: Every G-CORE query begins with a CONSTRUCT clause. This ensures the language is "closed"—the result of any query is always a graph, enabling full composability.
  • Shortest-Path Semantics: To ensure tractability, G-CORE defaults to shortest-path semantics for regular path expressions. This avoids the NP-complete complexity associated with "simple path" semantics (paths without repeated nodes) used in some other languages.
  • Formal Semantics: The paper provides a rigorous mathematical definition for the language's syntax and evaluation, ensuring that implementations can be consistent and predictable.
Fig. 2. A small social network. A Path Property Graph (PPG) is a Property Graph that can have “Stored Paths”.

Datasets

The authors demonstrate G-CORE’s features using the LDBC Social Network Benchmark (SNB). This is a standard industry benchmark designed to simulate the complex, highly connected data found in social networks.

Fig. 3. Social Network Benchmark schema (simplified).

Key Insights and Ideas

  • Graphs In, Graphs Out: By forcing queries to return graphs, G-CORE allows for modular query design. You can build a "view" of a graph (e.g., a graph of "weighted friendships") and then run a second query on that view.
  • Paths with Properties: Treating paths as first-class citizens allows for sophisticated analysis. For example, a query can find the shortest path between two people and then attach a "cost" or "trust" score to that path, which can be queried later.
  • Tractability by Design: The authors carefully restricted certain features to ensure that every G-CORE query can be evaluated in polynomial time relative to the data size. This makes the language practically usable on massive, real-world graphs.
  • Identity Preservation: When constructing new graphs, G-CORE can preserve the identities of nodes and edges from the input graph. This allows for efficient memory sharing between the input and the result.

Key Results

The primary result is the design of G-CORE itself, which successfully integrates:

  • Path Queries: Support for regular path expressions, including weighted shortest paths.
  • Graph Composition: The ability to union, intersect, and subtract graphs.
  • Aggregation: Support for grouping and aggregating data during graph construction.
  • Tractability: A formal proof/argument that the language remains efficient (polynomial time) even with its advanced path-handling capabilities.

Limitations and Future Work

  • Tabular Output: In its pure form, G-CORE only returns graphs. The authors acknowledge that many applications need tabular data (like a list of names) and suggest a SELECT extension for future work.
  • Update Language: G-CORE is currently a query language, not a data manipulation language. It doesn't define how to insert, update, or delete data in a persistent database.
  • Integration with Other Models: While the paper discusses how G-CORE relates to RDF and SPARQL, a full integration or mapping between these models remains a task for the future.

Summary updated

BibTeX
@inproceedings{angles2018g,
  author = {Renzo Angles and Marcelo Arenas and Pablo Barceló and Peter Boncz and George H. L. Fletcher and Claudio Gutierrez and Tobias Lindaaker and Marcus Paradies and Stefan Plantikow and Juan Sequeda and Oskar van Rest and Hannes Voigt},
  title = {{G-CORE: A Core for Future Graph Query Languages}},
  booktitle = {SIGMOD},
  year = {2018},
  doi = {10.1145/3183713.3190654},
}
Figure