NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Modular Materialisation of Datalog Programs

Pan Hu, Boris Motik, Ian Horrocks

Abstract

Datalog is a cornerstone of Semantic Web reasoning, yet standard "seminaïve" evaluation often fails to exploit the specific structure of common rules like transitive closure. This paper introduces a modular framework that allows for the integration of specialized, high-performance algorithms into the Datalog reasoning process. By partitioning programs into modules, the proposed approach achieves significant speedups in both initial materialization and incremental maintenance.

Introduction

The standard approach to computing all possible conclusions in Datalog—a process known as materialization—relies on the seminaïve algorithm. While robust, this algorithm is often inefficient for specific rule types. For instance, computing a transitive closure using seminaïve evaluation typically requires $O(n^3)$ steps, whereas specialized graph algorithms can achieve the same result in $O(n^2)$. The challenge lies in integrating these specialized algorithms into general-purpose reasoning without compromising logical consistency.

The Modular Framework

The authors propose a framework that partitions a Datalog program into disjoint subsets, or modules. Each module is managed by a "plug-in" architecture consisting of four primary functions:

  1. Add: Computes consequences during initial materialization.
  2. Diff: Identifies consequences affected by adding or removing facts.
  3. Del: Handles "overdeletion" by identifying facts that must be removed when an input fact is deleted.
  4. Red: Handles "rederivation" by checking if a fact marked for deletion can be proven through an alternative path.

This architecture allows for specialized implementations for common patterns, such as Transitive Closure (TC) and Symmetric-Transitive Closure (STC). For TC, the algorithm distinguishes between external and internal facts to reduce complexity. For STC, the framework utilizes a connected components approach from graph theory, which is fundamentally more efficient than iterative logic firing.

Experimental Setup

The framework was evaluated using several diverse benchmarks:

  • LUBM-LE & Claros-LE: University and archaeological datasets extended with complex recursive rules.
  • DBpedia-SKOS: A large-scale dataset of Wikipedia categories with numerous transitive properties.
  • DAG-R: A synthetic Directed Acyclic Graph benchmark (10k nodes, 100k edges) designed specifically to test path-relation performance.

Performance Results

The modular approach (Mat-Mod) consistently outperformed the standard seminaïve approach (Mat) across all benchmarks.

Table 1: Materialization performance comparison (Mat-Mod vs. Mat) across benchmarks.

As shown in the data, the modular approach was 35x faster on the DBpedia-SKOS dataset (103s vs 3623s) and over 100x faster on the synthetic DAG-R benchmark (29s vs 3238s).

The framework's advantages are even more pronounced in incremental maintenance. For small deletions in the Claros-LE dataset, the modular maintenance algorithm was over 1,000x faster than the standard DRed algorithm.

Table 2: Incremental update performance comparison for deletions and insertions.

The modular approach effectively addresses the "clique" problem, where deleting a single edge in a highly connected group can cause a cascade of redundant re-computations in standard algorithms.

Theoretical Insights and Future Work

A key insight of this work is that "linearization" of transitive closure rules—ensuring at least one side of a join is an external fact—drastically reduces rule applications. Furthermore, the ability to propagate updates between specialized modules and the general seminaïve engine ensures that the system remains both fast and flexible.

Future work may involve integrating the Backward/Forward (B/F) algorithm into the framework. This would allow the system to check for alternative derivations during the deletion phase more eagerly, potentially eliminating the need for a separate rederivation step and further improving performance on complex datasets like DBpedia.

Summary updated

BibTeX
@inproceedings{hu2019modular,
  author = {Pan Hu and Boris Motik and Ian Horrocks},
  title = {{Modular Materialisation of Datalog Programs}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2019},
  doi = {10.1609/aaai.v33i01.33012859},
}
Figure