Seminaive Materialisation in DatalogMTL

Dingmin Wang, Przemyslaw Andrzej Walega, Bernardo Cuenca GrauRuleML+RR 2022

TL;DR

This paper introduces a "seminaïve" materialisation procedure for DatalogMTL, a temporal logic for reasoning about data with time intervals. By adapting the classical seminaïve algorithm from Datalog, they significantly reduce redundant computations, leading to much faster materialisation times for temporal knowledge bases.

What Problem Does This Paper Address?

Reasoning with temporal data, especially in complex systems like temporal ontology-based data access and stream reasoning, often relies on "materialisation." This process involves deriving all possible temporal facts from a set of rules and initial data. However, existing materialisation methods for DatalogMTL, a language that extends Datalog with metric temporal operators (like "within the last 2 days"), suffer from significant inefficiencies due to redundant computations. These redundancies arise because temporal facts can be derived multiple times through different rule applications, especially when dealing with the infinite nature of rational timelines and complex temporal relationships. This makes efficient processing of large temporal datasets challenging.

Methods

The core contribution is a seminaïve materialisation procedure for DatalogMTL. This approach builds upon the established seminaïve algorithm for standard Datalog, which aims to avoid recomputing derivations that have already been made.

Here's how it works:

  • Keeping Track of "New" Facts: The procedure maintains a set of "newly derived" facts from the previous materialisation step.
  • Targeted Rule Application: In each step, rule applications are restricted to only those instances that involve at least one of these "new" facts. This prevents redundant derivations that only use already established information.
  • Coalescing Intervals: Temporal facts are represented with intervals. A "coalescing" phase merges overlapping or adjacent intervals for the same fact to ensure maximality and consistency.
  • Optimised Seminaïve Evaluation: An enhanced version further optimizes by identifying and discarding rules that can no longer derive new information, particularly by distinguishing between recursive and non-recursive predicates. This is achieved by monitoring when non-recursive predicates are fully materialised and by using temporal bounds for forward-propagating rules.

Datasets

The paper uses the temporal extension of the Lehigh University Benchmark (LUBM) for evaluation. This benchmark includes a DatalogMTL program with 56 Datalog rules and 29 temporal rules, covering various metric operators. They also used an extension of the LUBM data generator to create nine datasets (D1-D9) with increasing numbers of constants, simulating large temporal knowledge bases.

Key Insights and Ideas

  • Seminaïve for Temporal Logic is Tricky: Lifting the seminaïve strategy from Datalog to DatalogMTL is not straightforward. The presence of metric temporal operators and the need to coalesce temporal intervals introduce significant challenges in identifying truly "new" information and relevant rule instances.
  • Redundancy is a Major Bottleneck: The paper clearly demonstrates that naïve materialisation leads to substantial redundant computations, especially as materialisation progresses. This is a critical issue for scalability.
  • Optimisation by Rule Discarding: The idea of discarding rules once their contribution is exhausted is a powerful optimisation. This is particularly effective for non-recursive predicates and forward-propagating rules, where materialisation can be proven to be complete up to certain time points.
  • Practical Impact: The experimental results highlight that the seminaïve and optimised seminaïve approaches offer significant speedups and memory reductions compared to the naïve method, making temporal reasoning more feasible for large-scale applications.

Key Results

  • The seminaïve procedure significantly outperforms the naïve approach in terms of both running time and memory consumption, especially as materialisation progresses.
  • The optimised seminaïve approach further improves performance by discarding rules, leading to even greater efficiency, particularly after a certain number of materialisation steps.
  • Experiments show that the seminaïve approaches can quickly disregard irrelevant instances, leading to much less noticeable increases in time and memory compared to the naïve approach, even with increasing dataset sizes. For instance, the optimized seminaïve approach starts outperforming the basic seminaïve approach after 9 materialisation steps.

Limitations and Future Work

  • Termination: The paper notes that, similar to the naïve approach, the seminaïve procedure does not guarantee termination on all programs (e.g., programs with "recursion through time"). However, it is a key component of algorithms that do guarantee termination.
  • Stratified Negation-as-Failure: The authors suggest extending the seminaïve procedure to handle stratified negation-as-failure, which is a common extension in Datalog.
  • Alternative Semantics: Exploring seminaïve evaluation for DatalogMTL under alternative semantics (e.g., integer semantics, point-wise semantics) is an interesting future direction.
  • Blocking Conditions: Research into blocking conditions that exploit the periodic structure of canonical models to ensure termination of materialisation-based reasoning is ongoing.
  • Incremental Reasoning: Lifting incremental materialisation-based reasoning, studied for Datalog, to the DatalogMTL setting is another promising avenue.
  • Backwards-Propagating Programs: The optimisation for forward-propagating programs can be modified to account for backwards-propagating programs, as these cases are symmetric.

Summary updated

BibTeX
@inproceedings{wang2022seminaive,
  author = {Dingmin Wang and Przemyslaw Andrzej Walega and Bernardo Cuenca Grau},
  title = {{Seminaive Materialisation in DatalogMTL}},
  booktitle = {RuleML+RR},
  year = {2022},
  url = {https://openreview.net/forum?id=FRiqo3N5n27},
}
Figure