Optimised Storage for Datalog Reasoning

Xinyue Zhang, Pan Hu, Yavor Nenov, Ian Horrocks

Abstract

Materialization in Datalog reasoning is often hindered by the massive memory requirements of storing derived facts, particularly for transitive and union rules. This paper introduces a Multi-Scheme Framework that employs specialized, compressed storage structures to mitigate this bottleneck. By utilizing interval-based trees for transitive closure and virtual storage for union rules, the framework achieves memory savings of up to 35x and significant speedups. Experimental results on datasets like DBpedia demonstrate that this approach enables the materialization of billions of facts on a single machine, a task previously requiring terabytes of RAM.

Introduction

In Knowledge Graph management, Datalog serves as a powerful language for inferring new facts through "if-then" rules. The standard approach to query efficiency is materialization: pre-computing and storing all possible consequences of a rule set. However, materialization faces a significant "storage bottleneck." Transitive rules, such as those defining hierarchical relationships, can lead to a combinatorial explosion of facts. For instance, the broader relation in DBpedia generates approximately 8.5 billion facts, which would traditionally require over 500 GB of RAM for storage alone. This paper shifts the focus from optimizing computation speed to addressing the storage constraints that limit large-scale reasoning.

The Multi-Scheme Framework

The authors propose a modular architecture that allows a Datalog engine to employ diverse storage strategies tailored to specific rule types.

  1. Framework Architecture: The system defines standardized interfaces (schedule, derive, merge) that integrate specialized storage schemes into the traditional semi-naïve reasoning algorithm.
  2. Transitive Closure (TC) Storage: To avoid the explicit storage of every pair in a transitive relation, the framework uses interval-based compression. Each node is assigned an index and an interval; reachability is determined by checking if a target node's index falls within the source node's interval. This method was adapted to support the incremental nature of Datalog, allowing the system to distinguish between existing facts and those newly derived in each iteration.
Interval-based indexing for transitive closure compression.
  1. Union Storage Scheme: For union rules (e.g., $A(x,y) \to U(x,y)$), the system avoids physical storage of the union table $U$. Instead, it creates a "virtual" table that redirects queries to the constituent tables $A$ and $B$, eliminating redundant data.

Evaluation and Results

The framework was evaluated using three benchmarks: DBpedia (real-world knowledge graph), DAG-R (synthetic directed acyclic graph), and Relations (biomedical ontologies).

The results highlight a dramatic improvement in both memory efficiency and processing speed:

  • Memory Efficiency: On the full DBpedia dataset, the Multi-Scheme approach completed materialization using only 15 GB of RAM, whereas standard methods were estimated to require over 2,000 GB.
  • Computational Speed: The TC scheme demonstrated speedups of 100x to 1000x over standard semi-naïve algorithms during initial materialization.
  • Scalability: As shown in the performance data, the Multi-Scheme framework successfully processed datasets where standard engines timed out or exceeded memory limits.
Comparative performance metrics on large-scale knowledge graphs.

Key Insights

The core contribution of this work is the realization that physical storage of every fact is not a prerequisite for materialization. If a compressed data structure can provide $O(1)$ or $O(\log n)$ membership testing, it serves as a functional equivalent to a flat table with a fraction of the footprint. Furthermore, the introduction of "margins" in interval assignments allows these structures to handle incremental updates without costly re-indexing.

Limitations and Future Directions

While the framework excels at addition-only reasoning, incremental maintenance for deletions remains a challenge for future work. Additionally, while point queries are highly efficient, the impact of compressed storage on extremely complex graph patterns requires further investigation. Expanding the library of specialized schemes to include other common patterns, such as symmetry or complex chain rules, represents a promising avenue for further optimization.

Summary updated

BibTeX
@inproceedings{zhang2024optimised,
  author = {Xinyue Zhang and Pan Hu and Yavor Nenov and Ian Horrocks},
  title = {{Optimised Storage for Datalog Reasoning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i9.28947},
}
Figure