Expressive Power of Property Graph Constraint Languages

This paper presents the first systematic study of the expressive power of the PG-Keys language by establishing a unifying framework to compare it with Graph Functional Dependencies (GFD) and Graph Generating Dependencies (GGD), ultimately revealing a strict hierarchy of expressiveness that clarifies PG-Keys' capabilities within the context of the upcoming GQL standard.

Stefania Dumbrava, Nadime Francis, Victor Marsault, Steven Sailly

Published Wed, 11 Ma
📖 5 min read🧠 Deep dive

Imagine you are the architect of a massive, bustling city called The Property Graph. In this city, every building (node) and every road (edge) has a name tag and a list of attributes (like "owner," "color," or "construction date").

To keep this city from falling into chaos, you need Rules of the Road (constraints). These rules tell you things like: "Every building must have a unique address," or "If two people are in the same club, they must speak the same language."

For a long time, city planners had different rulebooks for different types of cities. Some rulebooks were very strict but simple; others were flexible but hard to read. Recently, a new, popular rulebook called PG-Keys was introduced to help manage this specific type of city. But nobody knew exactly how powerful it was compared to the old rulebooks.

This paper is like a comparative review that puts all these rulebooks side-by-side to see which one can actually do the most.

The Three Main Rulebooks

The authors compare three specific languages used to write these rules:

  1. GFD (The "Strict Accountant"):

    • Analogy: Imagine a rule that says, "If two people are in the same room, they must have the same shirt color."
    • How it works: It looks at a pattern (two people in a room) and forces a relationship (same shirt). It's very precise but can't easily say "There can be only one person in this room."
  2. GGD (The "Generous Builder"):

    • Analogy: This is like a rule that says, "If you see a room with two people, you must build a new bridge connecting them to a third person."
    • How it works: It's very powerful. It can look at a pattern and force the creation of new connections or complex relationships. It's the "big gun" of the group.
  3. PG-Keys (The "New City Planner"):

    • Analogy: This is the new, trendy rulebook designed specifically for modern cities. It has special keywords like MANDATORY (you must have this), EXCLUSIVE (only one of these allowed), and SINGLETON (exactly one of these).
    • The Catch: It has a strict design rule: The "scope" (where the rule applies) and the "descriptor" (what the rule checks) can only share one variable (one common point of reference). It's like saying, "You can only compare the current room to the next room through a single door."

The Big Discovery: The "Shared Variable" Limit

The core of the paper is a deep dive into what happens when you limit how many "doors" (shared variables) you can use to connect the two sides of a rule.

The "One-Door" vs. "Many-Door" Experiment:
The authors realized that GGD (the Generous Builder) is powerful because it can use many doors to connect ideas. PG-Keys (the New Planner) is restricted to one door.

  • The Surprise: The authors found that if you allow the rules to say "these two things are NOT equal" (inequality), the One-Door restriction of PG-Keys isn't actually a weakness!
  • The Metaphor: Imagine you want to check if a room has only one chair.
    • Without "Not Equal": You need to look at every chair and compare it to every other chair (many doors).
    • With "Not Equal": You can just say, "If I find two chairs, they must be different." This single "Not Equal" check is so powerful that it mimics the ability to look at many things at once.

The Verdict: A Strict Hierarchy

The paper builds a "power ladder" to show which languages can do what:

  1. The Bottom Rung (GFD): Good for simple "if-then" rules, but can't handle "exactly one" or "at most one" easily.
  2. The Middle Rung (PG-Keys):
    • If you only use "equals" (=), PG-Keys is stronger than GFD but weaker than GGD. It can do some unique things GFD can't, but it can't do everything GGD can.
    • However, if you allow "not equals" (≠), PG-Keys becomes just as powerful as a restricted version of GGD.
    • The "Syntactic Sugar" Revelation: The authors proved that the fancy keywords in PG-Keys (EXCLUSIVE, SINGLETON) are actually just "syntactic sugar." They look fancy, but they don't add any new power. You can rewrite any PG-Key rule into a standard GGD rule without losing any meaning. The "One-Door" limit is the only real constraint, and it's surprisingly strong.
  3. The Top Rung (Full GGD): The most powerful. It can do everything the others can, plus complex multi-variable connections that even the "Not Equal" trick can't fully replicate in every scenario.

Why Does This Matter?

This research is crucial for the future of database standards (like the upcoming GQL language).

  • For Designers: It tells them that they don't need to invent a whole new, complex language to get "Unique" or "Exclusive" constraints. They can use the existing, simpler logic of GGD and just add a few keywords for user-friendliness.
  • For Users: It clarifies that while PG-Keys looks different, it's not a magic bullet that breaks the laws of logic. It fits neatly into the existing ecosystem of database rules.

In a Nutshell

Think of PG-Keys as a sleek, modern smartphone. It has a beautiful interface with special buttons for "One Person Only" or "Must Have."
The paper proves that under the hood, it's running the same engine as the older, clunkier GGD computer. The special buttons are just shortcuts; they don't give the phone a new superpower, they just make it easier to use. And the only real limit is that you can only connect two thoughts through a single bridge, which turns out to be a very strong bridge indeed.