How horizon12275/dredmtl-for-datalogmtl works
1. This repository is an experiment artifact for the paper on incremental maintenance of DatalogMTL materializations. Its architecture is centered on a Python-based reasoning pipeline that takes benchmark datasets plus DatalogMTL programs, builds canonical representations, and then compares an incremental algorithm against a naive full-recompute baseline.
2. The code is split into four main scripts under code/, each with a distinct role in the pipeline:
- preparation.py prepares benchmark data and precomputes canonical representations.
- DRED_mtl.py contains the DRED<sub>MTL</sub> incremental maintenance logic.
- time_exp.py runs timing experiments for deletion/insertion maintenance.
- count_exp.py runs fact-count experiments after updates.
This separation makes the architecture a two-stage system: preparation first, then experiments.
3. The main data inputs live under data/ and are organized by representation and benchmark. data/original_e/ contains the original benchmark facts, while data/delta_e/ contains update sets for deletion/insertion experiments. The three benchmark families are LUBM<sub>t</sub>, iTemporal, and Weather, with separate files for fixed-size and percentage-based deltas.
4. The rule layer is stored independently under programs/. There is one program file per benchmark: lubm.txt, iTemporal.txt, and weather.txt. These DatalogMTL programs are the logical schemas that the reasoner applies over the input facts.
5. The central intermediate artifact is the canonical representation. The preparation step loads the original dataset, constructs the canonical representation, computes period information, and persists the result under canonical_representations/ as serialized .pkl files. This is a key architectural boundary because later experiment runs reuse these cached objects instead of rebuilding them.
6. The incremental maintenance flow in time_exp.py and count_exp.py is:
- load the precomputed canonical representation,
- load the delta facts for deletion and insertion,
- apply the DRED<sub>MTL</sub> update logic,
- compare against a baseline that recomputes from the updated dataset from scratch.
The baseline is therefore not a separate system, but a control path inside the experiment scripts.
7. The DRED<sub>MTL</sub> algorithm itself sits at the core of the reasoning subsystem. It operates on the canonical representation plus delta inputs, and it appears to maintain auxiliary periodic/interval metadata as part of the update process. The README’s example also indicates that cyclicity checks are part of the runtime path, so the algorithm is not just a set-difference updater; it depends on structural properties of the rule/dataset state.
8. There is an external dependency boundary around MeTeoR. The repository is built on top of the MeTeoR DatalogMTL framework, and the README shows imports from meteor_reasoner.*. So this repo is best understood as an application/benchmark layer plus a custom DRED<sub>MTL</sub> implementation layered on an existing reasoning engine, rather than a standalone reasoner from scratch.
9. The two experiment scripts differ only in what they measure. time_exp.py records execution time for incremental updates versus recomputation, while count_exp.py records the number of facts in the resulting canonical representation after updates. Both use the same data-loading and update pipeline, which means the architecture is shared up to the final measurement sink.
10. Output artifacts are written to experiment-specific result directories, conceptually under results/time_exp/ and results/count_exp/, even though those folders are empty in the tree snapshot. This makes the repository a reproducible pipeline with cached intermediates (canonical_representations/) and final tabular outputs (results/).
11. The repository also contains compressed or partitioned benchmark data, especially for Weather, which indicates the data layer can include large multi-part archives rather than only plain text. That matters for the architecture because dataset preparation is not just parsing files; it also includes unpacking/assembling benchmark inputs before reasoning.
12. For diagramming purposes, the key data flow is: benchmark facts and rules enter preparation → canonical representation and period metadata are generated and cached → delta datasets are loaded for updates → DRED<sub>MTL</sub> or baseline recomputation produces updated materializations → timing/count outputs are saved. The main boundaries are between raw benchmark inputs, cached reasoning state, incremental update logic, and experiment reporting.
Main entry points: preparation.py Preparation · time_exp.py Timing exp · count_exp.py Count exp · DRED_mtl.py DRED_MTL
Components 17
Inputs
Raw benchmark facts, delta sets, and rule programs
- README · Paper-oriented usage and pipeline notes
README.md - LUBM rules · DatalogMTL program for the LUBM benchmark
programs/lubm.txt - iTemporal rules · DatalogMTL program for the iTemporal benchmark
programs/iTemporal.txt - Weather rules · DatalogMTL program for the Weather benchmark
programs/weather.txt - Original data · Base benchmark facts and source datasets
data/original_e - Delta data · Deletion and insertion inputs for maintenance experiments
data/delta_e - Weather archives · Compressed multipart weather benchmark input
data/original_e/weather_data
Preparation
Builds cached canonical representations
- Preparation · Builds canonical representations and period metadata
code/preparation.py
Reasoning
Incremental maintenance and baseline recomputation
- DRED_MTL · Core incremental update logic over canonical state plus deltas
code/DRED_mtl.py - Naive baseline · Control path that recomputes materialization from updated data
code/time_exp.py - Period metadata · Intervals, periodicity, and cyclicity-related runtime metadata
Experiments
Timing and fact-count measurement runs
- Timing exp · Measures incremental maintenance time versus recomputation
code/time_exp.py - Count exp · Measures fact counts after updates
code/count_exp.py
Outputs
Cached intermediates and reported results
- Canonical cache · Persisted canonical representations reused by later runs
canonical_representations - Time results · Recorded runtime measurements
- Count results · Recorded post-update fact counts
External
Underlying reasoning framework dependency
- MeTeoR · Underlying DatalogMTL reasoning framework
Connections 23
- README → Preparation: describes · Documents the preparation step and cached state
- README → Timing exp: describes · Documents timing experiments and baseline comparison
- README → Count exp: describes · Documents fact-count experiments
- LUBM rules → Preparation: rules for · Program used when building canonical form
- iTemporal rules → Preparation: rules for · Program used when building canonical form
- Weather rules → Preparation: rules for · Program used when building canonical form
- Original data → Preparation: input to · Base facts are normalized during preparation
- Weather archives → Preparation: input to · Multipart weather archives are assembled for preparation
- Preparation → Canonical cache: writes · Persists canonical representations for reuse
- Canonical cache → Timing exp: loaded by · Reused as the starting state for timing runs
- Canonical cache → Count exp: loaded by · Reused as the starting state for count runs
- Delta data → Timing exp: delta input · Provides update facts for timing experiments
- Delta data → Count exp: delta input · Provides update facts for count experiments
- Timing exp → DRED_MTL: invokes · Runs incremental maintenance path
- Count exp → DRED_MTL: invokes · Runs incremental maintenance path
- Timing exp → Naive baseline: compares · Measures against full recomputation control path
- Count exp → Naive baseline: compares · Uses recomputation as a reference path
- DRED_MTL → Period metadata: maintains · Updates interval and cyclicity-related metadata
- Period metadata → Timing exp: feeds · Used during update execution
- MeTeoR → Preparation: framework · Underlying reasoning engine dependency
- MeTeoR → DRED_MTL: framework · Provides core DatalogMTL runtime primitives
- Timing exp → Time results: writes · Stores runtime measurements
- Count exp → Count results: writes · Stores fact-count measurements