Abstract 1 All We Need Is Time 2 Getting Formal with DatalogMTL 3 The Never-Ending Story of Materialisation 4 Taming the Infinite: The Saturation Algorithm 5 Time to Conclude References

Reasoning About Time in DatalogMTL: Course Notes

Przemysław Andrzej Wałęga ORCID Queen Mary University of London, UK
University of Łódź, Poland
Abstract

Many real-world applications, such as those in healthcare, finance, and logistics, require reasoning over temporal data. Standard rule-based languages like Datalog, however, lack explicit mechanisms for handling time and temporal dependencies. In this chapter, we discussDatalogMTL, an extension of Datalog with operators frommetric temporal logic that allow to express complex temporal properties. We focus on reasoning algorithms for DatalogMTL, discussing bothmaterialisation, based on fixpoint applications of the immediate consequence operator, and anovel saturation-based extensionthat detects and halts infinite derivations, ensuring both completeness and termination of reasoning.

Keywords and phrases:
DatalogMTL, Logic Programming, Temporal Reasoning
Category:
Invited Paper
Copyright and License:
[Uncaptioned image] © Przemysław Andrzej Wałęga; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Modal and temporal logics
; Theory of computation Programming logic
Acknowledgements:
These course notes are based on the author’s research on DatalogMTL, previously presented in several co-authored papers [54, 53, 55]. The author is deeply grateful to all colleagues with whom he had the pleasure of collaborating on this topic, in particular Bernardo Cuenca Grau and Michał Zawidzki, whose contributions were essential for establishing the results discussed here.
Funding:
This research is partially funded by the European Union (ERC, ExtenDD, project number: 101054714). Views and opinions expressed are however those of the authors only and do not necessarily reflect those of the European Union or the European Research Council. Neither the European Union nor the granting authority can be held responsible for them.
Editors:
Alessandro Artale, Meghyn Bienvenu, Yazmín Ibáñez García, and Filip Murlak

1 All We Need Is Time

Many application domains, such as healthcare, finance, and logistics are inherently temporal. Events like medical appointments or financial transactions take place in time, and reasoning about them requires explicit consideration of the temporal dimension. Datalog – a state-of-the-art rule-based language for reasoning over structured data [1, 33, 22] – is, however, atemporal. It allows us to write rules such as

NegTest(x)Immune(x)

stating that if a patient x is immune, their test needs to be negative. However, such rules do not allow us to represent the temporal relation between events, for example that a patient needs to be immune continuously in the last five days to be guaranteed to have a negative test. How can we perform temporal reasoning in Datalog?

One approach is to enrich Datalog with numbers representing points of time, and with arithmetic operators allowing to express dependencies between time points. For example one could write the following rule

NegTest(x,t1+5,t2)Immune(x,t1,t2)(t1t2+5)

stating that if a patient is immune continuously within a time interval [t1,t2] of length 5 at least, then they will have a negative result of a test performed within the time interval [t1+5,t2]. Available Datalog engines such as Nemo [27], RDFox [33], and Vadalog [9] often allow for exploiting arithmetic operators, but such an extension quickly leads to undecidability of reasoning.

Another approach, which will be the focus of this course, is to design extensions of Datalog tailored specifically for temporal reasoning. Instead of arithmetic operators, they use temporal operators. For example, we can use an operator [0,5], stating that an event happened continuously for the past interval of length 5, to write the following rule:

NegTest(x)[0,5]Immune(x).

Such temporal languages are carefully crafted to balance expressive power with computational complexity. In particular, they aim to capture rich temporal properties while ensuring that reasoning remains decidable and can be carried out algorithmically.

Among temporal extensions of Datalog, we will focus on DatalogMTL [12, 46], which augments Datalog with operators from Metric Temporal Logic (MTL) [29] such as already presented [0,5]. Such operators have high expressive power, and so, DatalogMTL subsumes many other temporal dialects of Datalog. DatalogMTL provides a versatile temporal reasoning language with applications in areas such as Semantic Web, Stream Reasoning, and Knowledge Graphs. Among others, DatalogMTL has been applied in ontology-based data access [11], economic fact-checking [31], human movement description [35], and verification of banking agreements [34].

To provide a better intuition about DatalogMTL, let us illustrate the language with some examples of facts and rules. DatalogMTL facts are annotated with time points (or time intervals) in which they hold, and rules allow us to express temporal dependencies between events.

Example 1.

Consider an exemplary DatalogMTL dataset, denoted by 𝒟𝖾𝗑, which we will use throughout this paper. It contains two facts:

Vaccinated(𝖡𝖾𝗇)@19923, NoSympt(𝖡𝖾𝗇)@(181,32012],

stating that Ben got vaccinated at the time point 19923 and that he had no symptoms continuously within the interval (181,32012].

Note that the timeline in DatalogMTL is an abstract sequence of rational time points. Nevertheless, it is easy to give it an intuitive interpretation. For instance if we assume that the first day (of the current year) in our database corresponds to the interval (0,1], the second day to (1,2], and so on, then facts in 𝒟𝖾𝗑 state that Ben was vaccinated at 4 p.m. on July 19 and that he had no symptoms since midnight on July 1 until noon on August 30.

Rules in DatalogMTL, in turn, extend classical Datalog with temporal operators, which enable reasoning over the temporal dimension of data. These operators are indexed by time intervals capturing the metric dependencies. In what follows we will provide examples of temporal operators that can be used in DatalogMTL. First, we present the “diamond” operators – for “sometime in the future” and – for “sometime in the past”. With such operators we can write the following expressions:

  • [1,2]Vaccinated, which states that Vaccinated will hold at some point between 1 and 2 time units in the future. More precisely, this expression is true at a time point t if there exists a moment within the interval [t+1,t+2] at which Vaccinated holds.

  • [1,2]Vaccinated, which uses the past version of . The formula [1,2]Vaccinated holds at all time points t such that Vaccinated holds at some time point in the interval [t2,t1].

DatalogMTL allows also to use “box” versions of the above “diamond” operators, for instance:

  • [1,2]Vaccinated holds true at time points t such that Vaccinated holds continuously in the interval [t+1,t+2].

  • [1,2]Vaccinated holds true at time points t such that Vaccinated holds continuously in the interval [t2,t1].

Finally, there are also metric version of “until” and “since” operators as presented below:

  • NoSympt𝒰[1,2]Vaccinated holds true at time points t such that Vaccinated holds at some time point t[t+1,t+2] and NoSympt holds from t until this t.

  • NoSympt𝒮[1,2]Vaccinated holds true at time points t such that Vaccinated holds at some time point t[t2,t1] and NoSympt holds from t since this t.

We will provide formal semantics of all these operators in the following section, but it is already worth presenting what kind of reasoning scenarios DatalogMTL allows us to express. To this end, consider the following example that models how immunity may arise either from vaccination or from prior exposure to a disease.

Example 2.

Consider a scenario where evidence suggests that immunity to a disease lasts for at least 90 days under the following conditions: an individual has been vaccinated and, within 3–4 weeks afterwards, either remained asymptomatic or tested negative. Also, an individual is immune if they were infected within the past six months (183 days), excluding the most recent ten days during which they showed no symptoms. In addition, individuals who have been immune for at least five days are observed to test negative. These conditions can be formalised in a DatalogMTL program Π𝖾𝗑 consisting of the following rules:

[0,90]Immune(x) NoSympt(x)𝒮[21,28]Vaccinated(x), (1)
[0,90]Immune(x) NegTest(x)[21,28]Vaccinated(x), (2)
Immune(x) (10,183]Infected(x)[0,10]NoSympt(x), (3)
NegTest(x) [0,5]Immune(x). (4)

In particular, Rule (1) checks whether an individual remained without symptoms between 21 and 28 days since receiving vaccination (using the “since” operator 𝒮[21,28]); Rule (2) checks whether they received a negative test and got vaccinated at some point in the last 21 to 28 days (using the “diamond past” operator [21,28]). Rule (3) checks whether an individual infected at some point in the last six months excluding the last 10 days (operator (10,183]) remained continuously without symptoms in the last 10 days (using the “box past” operator [0,10]). Finally, Rule (4) states that if an individual was immune continuously for the last 5 days (operator [0,5]), they will have a negative test.

As the example above shows, DatalogMTL allows us to express quite complex temporal rules. The main question we will consider is how to construct reasoning algorithms for this language?

We will begin in Section 2 with a formal presentation of the syntax and semantics of DatalogMTL. In Section 3, we study materialisation as a reasoning mechanism for DatalogMTL and identify the cases where it yields a complete reasoning procedure. However, materialisation alone often proves insufficient. This motivates Section 4, where we present the technically most challenging result: a saturation mechanism that detects loops in infinite derivations and thereby enables complete reasoning even when pure materialisation fails. Finally, in Section 5, we discuss related work on DatalogMTL, provide references for further reading, and highlight several interesting open problems in this research area.

2 Getting Formal with DatalogMTL

In this section, we will provide a formal definition of syntax and semantics of DatalogMTL, as well as introduce the standard reasoning tasks in this setting. For crucial notions, we will provide examples and illustrations to help the reader become familiar with them, as their understanding is essential for the subsequent sections.

2.1 Timeline and Time Intervals

We focus on the original setting for DatalogMTL, where the timeline is dense and consists of rational numbers. However, it is worth noting that DatalogMTL was also considered over the discrete integer timeline [47]. Formally, we let the (rational) timeline be the set of rational (both positive and negative) numbers and we will call each element of the timeline a time point. An interval ϱ is a non-empty subset of satisfying the following standard properties:

  • for all t1,t2,t3 with t1<t2<t3 and t1,t3ϱ, it is the case that t2ϱ, and

  • both the greatest lower bound ϱ and the least upper bound ϱ+ of ϱ belong to {,}.

The bounds ϱ and ϱ+ are called the left and right endpoints of ϱ, respectively, and ϱ+ϱ is the length of ϱ. An interval ϱ is punctual if it contains exactly one number, it is positive if it does not contain negative numbers (i.e., ϱ0), and it is bounded if both its left and right endpoints are rational numbers.

We use the standard representation ϱ,ϱ+ for intervals ϱ, where the left bracket is either [ or (, the right bracket is either ] or ), and ϱ and ϱ+ are representations of the left and right endpoints of ϱ, respectively. For example, the following represent three different intervals: [212,4], (212,4], and [212,4). As usual, brackets [ and ] indicate that the corresponding endpoints are included in the interval, whereas ( and ) indicate that they are not included. We abbreviate a punctual interval [t,t] as t. For example instead of [212,212] we may simply write 212.

2.2 Syntax of DatalogMTL

We let a relational atom be of the form P(𝐬), with P an n-ary predicate and 𝐬 an n-ary tuple of terms (i.e., constants and variables). For example Vaccinated(𝖡𝖾𝗇) is a relational atom with a predicate Vaccinated of arity 1 and with a single constant 𝖡𝖾𝗇, whereas Vaccinated(x) is a relational atom using a variable x instead of a constant. We allow also for predicates of arity 0, such as Sunny, which do not require terms. A metric atom is an extension of a relational atom with metric temporal operators. In particular, a metric atom is an expression given by the following grammar, where P(𝐬) ranges over relational atoms and ϱ over positive non-empty intervals:

MP(𝐬)ϱMϱMϱMϱMM𝒮ϱMM𝒰ϱM.

For example (10,183]Infected(x) is a metric atom. Notice that the definition allows also for arbitrary nesting of temporal operators, so [11,14](10,183]Infected(x) is also a metric atom.

A rule is an expression built from metric atoms as follows:

MM1Mn,for n1, (5)

where each Mi is a metric atom and M is a metric atom allowing only for “boxes” among temporal operators, namely M is generated by the following grammar:111Notice that we disallow in M, which ensures that no inconsistency can occur; DatalogMTL is often considered with rules allowing for in M, but to simplify the setting we will not consider such rules.

MP(𝐬)ϱMϱM.

The fact that we disallow some temporal operators in M is dictated by complexity results; if we allow for M being an arbitrary metric atom, reasoning would become undecidable. The conjunction M1Mn in Expression (5) is the rule’s body, each Mi is a body atom, and M is the rule’s head. As an example of DatalogMTL rules, consider Rules (1)–(4) from Π𝖾𝗑 in Example 2. A program, like Π𝖾𝗑, is a finite set of rules222Precisely speaking we require also that rules are safe, namely each variable mentioned in the head of a rule occurs also in its body, and this occurrence is not in a left operand of 𝒮 or 𝒰; without this restriction we could write rules like Q(x)P, which are usually disallowed in Datalog..

An expression (e.g. a metric atom, rule, or program) is ground if it mentions no variables. Hence Vaccinated(𝖡𝖾𝗇) is ground, but Vaccinated(x) is not. A fact over an interval ϱ is an expression M@ϱ, with M a ground relational atom. A dataset, for example 𝒟𝖾𝗑 from Example 1, is a finite set of facts.

The grounding of a program Π, written as 𝗀𝗋𝗈𝗎𝗇𝖽(Π), is the ground program obtained as the set of all ground rules that can be obtained by assigning constants to variables in Π. The grounding of Π with respect to a dataset 𝒟, written as 𝗀𝗋𝗈𝗎𝗇𝖽(Π,𝒟), is the restriction of 𝗀𝗋𝗈𝗎𝗇𝖽(Π) rules which do mention only those constants which are present in Π or 𝒟.

2.3 Semantics of DatalogMTL

We will focus in this course on the standard continuous semantics of DatalogMTL, as opposed to the alternative pointwise semantics [36]. In the standard setting an interpretation is a function which specifies, for each ground relational atom P(𝐬) and each time point t, whether P(𝐬) is satisfied at t, in which case we write ,tP(𝐬). This notion extends to complex ground metric atoms as given in Table 1.

Table 1: Semantics of ground metric atoms.
,t for each t
,t for no t
,tϱM iff ,tM for some t with ttϱ
,tϱM iff ,tM for some t with ttϱ
,tϱM iff ,tM for all t with ttϱ
,tϱM iff ,tM for all t with ttϱ
,tM1𝒮ϱM2 iff ,tM2 for some t with ttϱ and ,t′′M1 for all t′′(t,t)
,tM1𝒰ϱM2 iff ,tM2 for some t with ttϱ and ,t′′M1 for all t′′(t,t)

The meaning of past operators , , and 𝒮 is additionally visualised in figures below. The first figure shows that [1,2]P holds at 3110 if P holds at some time point located within the interval [1110,2110]. The second figure indicates that [1,2]P holds at 3110 if P holds continuously in the interval [1110,2110]. The third figure, in turn, shows that Q𝒮[1,2]P holds at 3110 if P holds at some time point within [1110,2110] and Q holds continuously from this time point up to the time point 3110. The meaning of future operators , , and 𝒰 is symmetric to the meaning of the corresponding past operators , , and 𝒮, respectively.

To illustrate the notion of satisfaction in an interpretation, consider the following example.

Example 3.

Consider an interpretation represented by the dataset 𝒟𝖾𝗑 from Example 1, that is, ,19923Vaccinated(𝖡𝖾𝗇) and ,tNoSympt(𝖡𝖾𝗇), for all t(181,32012]. By the semantics of metric operators in Table 1, the following hold (as depicted in the figure below):

  • ,t[21,28]Vaccinated(𝖡𝖾𝗇) for all t[22023,22723], since for each of these time points t, Vaccinated(𝖡𝖾𝗇) holds in some time point within the interval [t28,t21].

  • ,t[0,10]NoSympt(𝖡𝖾𝗇) for all t(191,32012], as for any such t, NoSympt(𝖡𝖾𝗇) holds continuously in the interval [t10,t0].

  • ,tNoSympt(𝖡𝖾𝗇)𝒮[21,28]Vaccinated(𝖡𝖾𝗇) for all t[22023,22723], as for all these t, Vaccinated(𝖡𝖾𝗇) holds in some time point in [t28,t21] such that NoSympt(𝖡𝖾𝗇) holds continuously between this time point and t.

We say that an interpretation satisfies a fact M@ϱ, written M@ϱ, if ,tM for all tϱ. Moreover, satisfies a ground rule r if, whenever satisfies each body atom of r at a time point t, then also satisfies the head of r at t. Furthermore, satisfies a rule r if it satisfies its every ground instance, that is, each rule in 𝗀𝗋𝗈𝗎𝗇𝖽({r}). We say that is a model of a program Π if satisfies each rule in Π. An interpretation is a model of a dataset 𝒟 if satisfies each fact in 𝒟. A dataset 𝒟 entails a fact M@ϱ if each model of 𝒟 is also a model of M@ϱ. A program Π and a dataset 𝒟 entail a fact M@ϱ, written (Π,𝒟)M@ϱ, if each model of both Π and 𝒟 is also a model of M@ϱ.

An interpretation contains an interpretation , written , if ,tP(𝐬) implies ,tP(𝐬), for each ground relational atom P(𝐬) and each time point t. We say that is the least interpretation in a set X of interpretations if , for every X. Each dataset 𝒟 admits the least interpretation 𝒟 among all models of 𝒟; we say that a dataset 𝒟 represents an interpretation if =𝒟.

The immediate consequence operator TΠ, for a program Π, is a function mapping an interpretation to the least interpretation containing and satisfying the following property for each r𝗀𝗋𝗈𝗎𝗇𝖽(Π): whenever satisfies each body atom of r at a time point t, then TΠ() satisfies the head of r at t. The successive application of TΠ to 𝒟 defines a transfinite sequence of interpretations TΠα(𝒟), for ordinals α, as follows:

TΠ0(𝒟) =𝒟,
TΠα(𝒟) =TΠ(TΠα1(𝒟)), for α a successor ordinal,
TΠα(𝒟) =β<αTΠβ(𝒟), for α a limit ordinal.

The canonical interpretation Π,𝒟 of Π and 𝒟 is the interpretation TΠω1(𝒟), where ω1 is the first uncountable ordinal. It is known that Π,𝒟 is the least model of Π and 𝒟 [11]. In other words, to compute the least model of Π and 𝒟, we can apply TΠ until a fixpoint is reached, that is, no more information can be derived.

To illustrate the process of applying TΠ, which is the basic reasoning mechanism in DatalogMTL, let us consider the following example.

Example 4.

Consider the program Π𝖾𝗑 and dataset 𝒟𝖾𝗑 from Examples 2 and 1. The interpretations TΠ𝖾𝗑α(𝒟𝖾𝗑) obtained by applying TΠ correspond to the following datasets:

TΠ𝖾𝗑0(𝒟𝖾𝗑): Vaccinated(𝖡𝖾𝗇)@19923, NoSympt(𝖡𝖾𝗇)@(181,32012]
TΠ𝖾𝗑1(𝒟𝖾𝗑): Vaccinated(𝖡𝖾𝗇)@19923, NoSympt(𝖡𝖾𝗇)@(181,32012],
Immune(𝖡𝖾𝗇)@[22023,31723]
Vaccinated(𝖡𝖾𝗇)@19923, NoSympt(𝖡𝖾𝗇)@(181,32012],
TΠ𝖾𝗑2(𝒟𝖾𝗑): Immune(𝖡𝖾𝗇)@[22023,31723], NegTest(𝖡𝖾𝗇)@[22523,31723]
TΠ𝖾𝗑3(𝒟𝖾𝗑): same facts as in TΠ𝖾𝗑2(𝒟𝖾𝗑)

Since TΠ𝖾𝗑2(𝒟𝖾𝗑)=TΠ𝖾𝗑3(𝒟𝖾𝗑), the fixpoint is reached, and so further applications of TΠ cannot derive any new information. Therefore, we obtain that TΠ𝖾𝗑2(𝒟𝖾𝗑)=TΠ𝖾𝗑α(𝒟𝖾𝗑), for any ordinal α2. Hence TΠ𝖾𝗑2(𝒟𝖾𝗑)=Π𝖾𝗑,𝒟𝖾𝗑 is the canonical interpretation of Π𝖾𝗑 and 𝒟𝖾𝗑.

2.4 Reasoning Problems

The main reasoning problem in DatalogMTL we will consider is fact entailment: the problem of checking whether a program and a dataset entail a given relational fact. For instance, Example 4 shows that Π𝖾𝗑 and 𝒟𝖾𝗑 logically entail NegTest(𝖡𝖾𝗇)@[22523,31723], because this fact holds in the canonical interpretations Π𝖾𝗑,𝒟𝖾𝗑. Indeed, it was derived after two applications of the immediate consequence operator.

Another standard problem is consistency checking, which is to check whether a given program and a dataset admit a common model. Notice that our definition of a DatalogMTL rule does not allow for to occur in a head. As a result, in our setting every program Π, together with any dataset 𝒟 admit a common model, and the canonical interpretation Π,𝒟 is the minimal among their models. However, if we allowed for in rule heads, which is often considered in the literature, some pairs of a program and dataset would not admit models. For instance this would be the case for a dataset with a single fact P@[0,1] and a program with a single rule P, which clearly leads to inconsistency (derivation of ).

In the passing, we observe that if we allow for in rule heads, then consistency checking and fact entailment in DatalogMTL reduce to the complements of each other. Specifically, to check whether a program Π and a dataset 𝒟 are inconsistent, it suffices to check whether they entail fact P@0, for P a fresh atom occurring neither in Π nor in 𝒟. Indeed, P@0 is entailed, that is P@0 holds in all models of Π and 𝒟 only if Π and 𝒟 have no models, that is, if Π and 𝒟 are not consistent. In turn, to check whether Π and 𝒟 entail a fact P(𝐜)@ϱ, it suffices to check whether the following program and dataset are inconsistent, with P a fresh predicate of the same arity as P, 𝐱 a tuple of distinct variables, and t an arbitrary time point belonging to the interval ϱ:

Π=Π{P(𝐱)ϱ1P(𝐱)ϱ2P(𝐱)}, 𝒟=𝒟{P(𝐜)@t}.

Intervals ϱ1 and ϱ2 are constructed using ϱ and t; for example, if ϱ=[t1,t2), then ϱ1=[0,tt1] and ϱ2=[0,t2t), whereas if t2=, then t2t stands for . As an exercise, we invite the reader to verify the correctness of the reduction when ϱ=[t1,t2), namely that Π and 𝒟 entail P(𝐜)@ϱ if and only if Π and 𝒟 are inconsistent.

It is also worth to mention known computational complexity results. Fact entailment in DatalogMTL is of high complexity; it is ExpSpace-complete [12] and PSpace-complete when measured with respect to the size of a dataset, that is, in data complexity [46]. Tractability in data complexity can be achieved by disallowing certain metric operators and restricting the form of rules [48].

In the remaining sections we will focus on algorithms for checking entailment. In particular, we will be interested in constructing the canonical interpretation Π,𝒟 for a given program Π and dataset 𝒟. Once this is done, entailment of any fact can be checked by simply verifying if Π,𝒟 contains this fact or not. However, as we will show in the next section, construction of the canonical interpretation in DatalogMTL is a very non-trivial task.

3 The Never-Ending Story of Materialisation

In this section, we examine the application of standard naïve materialisation as a reasoning technique for DatalogMTL. While materialisation is highly efficient, unlike in classical Datalog it is not guaranteed to terminate in DatalogMTL. We complement this negative result with a positive one, identifying classes of DatalogMTL programs for which materialisation is guaranteed to terminate and thus yields a complete reasoning algorithm.

3.1 Naïve Materialisation

Materialisation-based reasoning is the most common technique of choice implemented in scalable Datalog reasoners [13, 32, 19, 9]. Facts entailed by a program and a dataset are derived in successive rounds of rule applications, mimicking applications of the immediate consequence operator. The process continues until a fixpoint is reached and a full materialisation – representing the canonical interpretation – has been computed. At this point, entailment (or answer to more complicated queries) can be checked directly over the computed materialisation.

In this section, we formulate a (possibly non-terminating) generic reasoning procedure for DatalogMTL based on materialisation. In this process, rules are applied by first identifying maximal intervals in which all ground body atoms of a rule hold simultaneously, and then determining intervals in which the head atoms should be derived. Details of this process are presented in Algorithm 1, which performs a single round of rule applications for a given input program and dataset.

To familiarise the reader with this algorithm, let us consider the following example.

Example 5.

Given the program Π𝖾𝗑 and dataset 𝒟𝖾𝗑, Algorithm 1 applies Rule (1) by first identifying ϱ=[22023,22723] as the subset-maximal interval such that we have 𝒟𝖾𝗑NoSympt(x)𝒮[21,28]Vaccinated(x)@ϱ. Hence, the application of the rule derivesImmune(𝖡𝖾𝗇)@[22023,31723], as shown in the table from Example 4.

Algorithm 1 𝖠𝗉𝗉𝗅𝗒𝖱𝗎𝗅𝖾𝗌.

The result of applying Algorithm 1 to Π and 𝒟 is always a dataset (i.e., a finite object), and the following proposition establishes that this dataset represents the interpretation obtained by a single application of the immediate consequence operator associated to Π to the dataset 𝒟. Thus, Algorithm 1 provides a syntactic counterpart to the application of the immediate consequence operator.

Proposition 6.

On input Π and 𝒟, Algorithm 1 outputs a dataset representing TΠ(𝒟).

Proof.

In each iteration of the loop, Algorithm 1 extends (in Line 9) the dataset 𝒩 with {P(𝐜)@ϱϱ𝖨P(𝐜)}. Thus, to prove that the output 𝒟𝒩 of Algorithm 1 represents TΠ(𝒟), it suffices to show that, after performing one iteration of the loop (Lines 39) for a rule r𝗀𝗋𝗈𝗎𝗇𝖽(Π,𝒟), the dataset 𝒟{P(𝐜)@ϱϱ𝖨P(𝐜)} represents T{r}(𝒟).

Indeed, for each body atom Mi of r, set 𝖨Mi (computed in Line 6) consists of intervals containing exactly those time points for which Mi holds in 𝒟. Thus, 𝖨M (computed in Line 7) consists of intervals containing exactly those time points in which all the body atoms of r simultaneously hold in 𝒟. Then intervals in 𝖨P(𝐜) (computed in Line 8) contain exactly those time points for which the head atom P(𝐜) of r is entailed by M holding in intervals from 𝖨M. Therefore, 𝒟{P(𝐜)@ϱϱ𝖨P(𝐜)} represents T{r}(𝒟), as required.

We next introduce Procedure 2 which, given a program Π and a dataset 𝒟 as input, performs materialisation by iteratively calling Algorithm 1 to compute a sequence 𝒟0,𝒟1, of datasets, where each 𝒟i represents the interpretation TΠi(𝒟).

Algorithm 2 Materialisation-based reasoning.

The following Proposition 7 is a direct consequence of Proposition 6.

Proposition 7.

After k iterations of the loop from Algorithm 2 on input Π and 𝒟, the dataset 𝒟𝗇𝖾𝗐 represents TΠk(𝒟).

If 𝒟i=𝒟i+1 at some point in the sequence 𝒟0,𝒟1, computed by Procedure 2, then Procedure 2 outputs 𝒟i. In particular, if we consider our exemplary program Π𝖾𝗑 and dataset 𝒟𝖾𝗑 as input, Procedure 2 will stop after three iterations and return the dataset representing TΠ𝖾𝗑2(𝒟𝖾𝗑), as shown in Example 4.

In general, however, the procedure may not terminate. This is why we refer to it as a Procedure rather than an Algorithm. Indeed, for some programs and datasets, the construction of the canonical interpretation requires infinitely many applications of the immediate consequence operator. To illustrate such a behaviour consider the following example.

Example 8.

Consider a program Π={[0,1]PP} and a dataset 𝒟={P@[0,1]}. If the proposition P holds at some time point t, then Π ensures that P holds also in the interval [t,t+1]. It follows that TΠi(𝒟)P@[i,i+1], for each i, and that the canonical interpretation Π,𝒟 is reached only after ω (recall that ω is the first infinite ordinal, corresponding to the order type of the natural numbers ) applications of TΠ to 𝒟.

An interesting question arises: for which DatalogMTL programs and datasets, application of the immediate consequence operator reaches a fixpoint in finitely many steps? In other words, when Procedure 2 is guaranteed to terminate, and so, it becomes an algorithm? Notice that this is an important question, as the answer would allow us to determine in which cases the procedure computes the full materialisation and becomes a decision procedure that can be used for checking entailment.

3.2 Finite Materialisability

To answer the questions from the end of the previous subsection, we will introduce the notion of finitely materialisable DatalogMTL programs. Intuitively, those are programs for which applications of the immediate consequence operator (or equivalently materialisation steps) allow us to obtain a fixpoint in a finite number of steps.

Definition 9.

Let Π be a program and α an ordinal number. We say that the immediate consequence operator TΠ converges for a dataset 𝒟 in α steps if TΠα(𝒟)=Π,𝒟.

Program Π is finitely materialisable for a dataset 𝒟 if TΠ converges for 𝒟 in some finite number of steps (or, equivalently, if Procedure 2 terminates in finite number of steps on input Π and 𝒟).

It follows from Proposition 7 that, for each program Π that is finitely materialisable for a dataset 𝒟, there exists a dataset representing the canonical interpretation Π,𝒟. The converse, however, does not hold: the canonical interpretation of a program Π and a dataset 𝒟 may admit a finite representation, but Π may be not finitely materialisable for 𝒟, as we show next.

Example 10.

As shown in Example 4, program Π𝖾𝗑 is finitely materialisable for dataset 𝒟𝖾𝗑, and the dataset representing TΠ𝖾𝗑2(𝒟𝖾𝗑) also represents the canonical interpretation. In contrast, if we consider program Π={[0,1]PP} and dataset 𝒟={P@[0,1]} from Example 8, we can observe that the canonical interpretation can be represented by a single fact P@[0,), whereas the operator TΠ does not converge for 𝒟 in a finite number of steps.

The notion of finite materialisability in Definition 9 is data dependent, in that a given program could be finitely materialisable for a given dataset, but perhaps not for a different dataset. We next provide a data-independent notion of finite materialisability.

Definition 11.

A program Π is called finitely materialisable if Π is finitely materialisable for all dataset.

Which programs satisfy this stronger notion of finite materialisability? As we show next, any non-recursive DatalogMTL program is guaranteed to be finitely materialisable.

Intuitively non-recursive programs are programs whose rules do not contain derivation loops such as in the rules QP and PQ, where derivation of P allows to derive Q, which allows to derive P again, etc. Formally, (non)recursive programs are defined using the notion of the dependency graph of a program. The dependency graph of Π is a directed graph with a vertex vP for each predicate P in Π and an edge (vQ,vR) if there is a rule mentioning Q in its body and R in its head. For example the dependency graph of our Π𝖾𝗑 is depicted below.

A program is said to be recursive, if its dependency graph is cyclic. Clearly the dependency graph above is cyclic, which implies that Π𝖾𝗑 is a recursive program.

Next, we will show that each non-recursive program Π is finitely materialisable, by establishing a bound on the number of rounds of rule applications until the canonical interpretation is reached. In particular, we will show that this bound is given by the number 𝗉𝗋𝖾𝖽(Π) of predicates occurring in Π

Proposition 12.

For any non-recursive program Π and for any dataset 𝒟, it holds that TΠ𝗉𝗋𝖾𝖽(Π)1(𝒟)=Π,𝒟.

Proof.

For each predicate P in Π or 𝒟, we let d(P) be the length of a longest path in the dependency graph of Π, which ends in vP (or 0 if no such path exists). Note that since Π is non-recursive, its dependency graph has no cycles, and so, d(P)𝗉𝗋𝖾𝖽(Π)1, for each P. Thus, it suffices to show that, for each relational fact P(𝐜)@t, if Π,𝒟P(𝐜)@t, then TΠd(P)(𝒟)P(𝐜)@t. We proceed by induction on d(P).

For the base case, assume that Π,𝒟P(𝐜)@t, for some P with d(P)=0. Since d(P)=0, either P does not occur in Π, or P occurs in Π and vP has no incoming edges. In both cases Π,𝒟P(𝐜)@t implies that 𝒟P(𝐜)@t, and so, TΠ0(𝒟)P(𝐜)@t.

For the inductive step, assume that Π,𝒟P(𝐜)@t, where d(P)>0. If 𝒟P(𝐜)@t, then TΠ0(𝒟)P(𝐜)@t, and so, TΠd(P)(𝒟)P(𝐜)@t. Otherwise, there exists a rule r in 𝗀𝗋𝗈𝗎𝗇𝖽(Π,𝒟) and a time point t such that all the body atoms of r are satisfied at t and the head of r being satisfied at t entails P(𝐜)@t. By the definition of the dependency graph, we have d(Q)<d(P) for each predicate Q occurring in the body of r. Therefore, by the inductive assumption, all the body atoms of r must be satisfied at t in TΠd(P)1(𝒟). Consequently, T{r}(TΠd(P)1(𝒟))P(𝐜)@t, and so, TΠd(P)(𝒟)P(𝐜)@t.

Moreover, the following example shows that the bound on the number of applications of the immediate consequence operator in Proposition 12 is optimal.

Example 13.

Consider an arbitrary n and a program Πn comprising the rules

1P1P0,1P2P1,1P3P2,,1PnPn1.

Clearly, Πn is non-recursive and 𝗉𝗋𝖾𝖽(Π)1=n. Now, consider a dataset 𝒟={P0@0}. We obtain that, for each in, the interpretation TΠni(𝒟) entails {Pj@jji}. Thus, TΠnn(𝒟)=Πn,𝒟, so the bound on the number of rounds of rule application to materialise a non-recursive program, established in Proposition 12, cannot be decreased.

Both data-dependent and data-independent notions of finite materialisability in DatalogMTL have been studied in depth, giving rise to a number of interesting results. It is worth mentioning that tight complexity bounds and algorithms for finite materialisability checking have been established. Moreover, efficiently verifiable sufficient conditions for finite materialisability has been provided [53, 54].

To conclude this section, let us recall that materialisation is an iterative procedure that applies the immediate consequence operator repeatedly to the input dataset. Unlike in atemporal Datalog, materialisation in DatalogMTL is not guaranteed to terminate. Nevertheless, one can check whether a given program is finitely materialisable, that is, whether materialisation on this program is guaranteed to halt after finitely many steps. In particular, as we have shown, all non-recursive DatalogMTL programs enjoy this property.

In the next section, we turn to a different reasoning approach for DatalogMTL. Rather than restricting the language to ensure termination of materialisation, we show a more sophisticated mechanism that can detect infinite derivations and exploit this information to compute the full materialisation using a terminating algorithm.

4 Taming the Infinite: The Saturation Algorithm

In this section we present a more sophisticated reasoning algorithm for DatalogMTL. This algorithm [55, 3] will perform standard materialisation steps, but instead of running until a fixpoint is reached, it halts once a partial materialisation satisfies a condition we call saturation. As we will show, saturation is guaranteed to occur after a bounded number of materialisation steps, and the full canonical interpretation can then be reconstructed from the saturated partial materialisation. As a result, we will obtain a terminating procedure that is both sound and complete.

A key advantage of this approach is that it does not require syntactic restrictions on the interplay of rules, such as the absence of recursion discussed in the previous section, nor does it rely on the assumption that the program is finitely materialisable. The only requirement is that all intervals in the program and dataset are bounded, that is, they do not use or as interval endpoints. This restriction still captures a large and expressive fragment of DatalogMTL. Notice, in particular, that our Π𝖾𝗑 from Example 2 is a bounded program. Moreover, it is known that complexity-wise reasoning in bounded DatalogMTL is as hard as reasoning in the unrestricted language [53]. Extending the algorithm to the setting of unbounded intervals remains an interesting open challenge.

In the following subsections we will observe that canonical interpretations have a regular form. Then we will introduce the concept of saturated interpretations and their unfoldings into canonical interpretations. Finally, we will show a full reasoning algorithm.

4.1 (𝚷,𝓓)-ruler and (𝚷,𝓓)-intervals

The aim of this short subsection is to show an interesting result about the regular form of the canonical interpretation Π,𝒟 [46]. The main concepts that we will use to describe this regularity are those of a (Π,𝒟)-ruler and the corresponding (Π,𝒟)-intervals.

Definition 14.

For a program Π and a dataset 𝒟, we let the (Π,𝒟)-ruler be the set of all time points of the form t+i𝖽𝗂𝗏(Π), for t a time point mentioned in 𝒟 (as an endpoint of some interval), i, and 𝖽𝗂𝗏(Π)=1m, where m is the product of all denominators occurring in the representation of the rational endpoints of the intervals mentioned in Π (if Π has no intervals with rational endpoints, then m=1, and hence, 𝖽𝗂𝗏(Π)=1). A (Π,𝒟)-interval, in turn, is either a punctual interval over a time point on the (Π,𝒟)-ruler, or an interval of the form (t1,t2), where t1 and t2 are consecutive time points on the (Π,𝒟)-ruler.

Example 15.

Consider the program Π𝖾𝗑 and the dataset 𝒟𝖾𝗑 from Example 2. Since all rational numbers occurring in Π𝖾𝗑 are integers, 𝖽𝗂𝗏(Π𝖾𝗑)=1. Furthermore, as 181, 19923, and 32012 are the only numbers occurring in 𝒟𝖾𝗑, the (Π𝖾𝗑,𝒟𝖾𝗑)-ruler consists of all rational numbers of the form i, 12+i, and 23+i, for any integer i. Hence, (Π𝖾𝗑,𝒟𝖾𝗑)-intervals are, for example, [0,0], (0,12), [12,12], and (12,23), as depicted below.

Now, we say that an interpretation is a (Π,𝒟)-interpretation if, for every fact M@t, it holds that M@t implies M@ϱ, where ϱ is the (Π,𝒟)-interval containing t. In other words, relational atoms hold uniformly over the (Π,𝒟)-intervals. The main result, we will need in the remaining parts of this section, is that the canonical interpretation and all partial materialisations are (Π,𝒟)-interpretations [46] as stated next.

Theorem 16.

The canonical interpretation Π,𝒟 of a program Π and a dataset 𝒟, as well as the interpretations TΠα(𝒟) for any ordinal α, are (Π,𝒟)-interpretations.

The proof of this statement is not hard – it can be obtained by induction on α, by showing that 𝒟 is a (Π,𝒟)-interpretation, and each application of the immediate consequence operator leads to a (Π,𝒟)-interpretation. We invite the reader to write a full proof as an exercise.

In the next subsection we will use the above observation about the canonical intepretation structure to define saturated interpretations.

4.2 Saturated Interpretations and Their Unfoldings

The main aim of this subsection is to present saturation conditions stating the properties that a partial materialisation TΠk(𝒟) needs to satisfy so that the it can be used to recover the full canonical interpretation. We call an interpretation satisfying these conditions saturated and show how to compute relevant periods and exploit them to unfold the interpretation into the canonical interpretation of Π and 𝒟.

For convenience of presentation, we fix for the remainder of this subsection an arbitrary bounded program Π, bounded dataset 𝒟, and natural number k. To make the first observation we need to introduce additional notions. We let the depth of a rule r, written as 0ptr, be the sum of the right endpoints in all intervals occurring in r (or 0 if r mentions no intervals). For example, the depth of Rule (3) is 183+10=193. The depth of a program Π, written as 0ptΠ, is the maximum depth of its rules; hence, bounded programs have finite depth. Moreover, for an interpretation and an interval ϱ, we let the projection ϱ of over ϱ be the interpretation that coincides with on ϱ and makes all relational atoms false outside ϱ.

As shown in the following proposition, the depth of a bounded rule determines the time points that can be “affected” by an application of this rule.

Proposition 17.

For every interpretation , time point t, and bounded rule r, it holds that satisfies r at t if and only if so does [t0ptr,t+0ptr].

Proof.

By definition, satisfies r at t if and only if the body of r does not hold at t or the head of r holds at t. By the definition of 0ptr, all the facts corresponding to the satisfaction of the body and the head of r at t are over intervals contained in [t0ptr,t+0ptr]. This implies the claim in the proposition.

Our next aim is to define a saturated interpretation. For this, however, we will need to introduce additional concepts.

For a dataset 𝒟, we let t𝒟 and t𝒟+ be the minimal and maximal numbers mentioned as interval endpoints in 𝒟 (if 𝒟 does not mention any numbers, we let both t𝒟 and t𝒟+ be 0). We say that an interpretation satisfies Π in an interval ϱ if, for each r𝗀𝗋𝗈𝗎𝗇𝖽(Π) and each tϱ, whenever satisfies each body atom of r at t, then satisfies the head of r at t. Furthermore, we say that an interpretation is a shift of if there exists a rational number q such that M@ϱ if and only if M@(ϱ+q), for each fact M@ϱ.

With the above concepts introduced, we are ready to present the definition of a saturated interpretation.

Definition 18.

Interpretation TΠk(𝒟) is saturated if there exist closed intervals ϱ1, ϱ2, ϱ3, and ϱ4 of length 20ptΠ, whose endpoints are located on the (Π,𝒟)-ruler and satisfy ϱ1+<ϱ2+<t𝒟 and t𝒟+<ϱ3<ϱ4, and such that the following properties hold:

  • TΠk(𝒟) satisfies Π in [ϱ1,ϱ4+];

  • TΠk(𝒟)ϱ1 and TΠk(𝒟)ϱ3 are shifts of TΠk(𝒟)ϱ2 and TΠk(𝒟)ϱ4, respectively.

Any pair of intervals [ϱ1,ϱ2) and (ϱ3+,ϱ4+], for ϱ1, ϱ2, ϱ3, ϱ4 as above, will be referred to as periods of TΠk(𝒟).

Intuitively, a saturated interpretation contains a “central fragment” [ϱ1,ϱ4+] which satisfies 𝒟 and such that a single application of TΠ does not derive any new facts within this fragment (i.e., the interpretation satisfies Π within [ϱ1,ϱ4+]). In the left segment of this “central fragment” there are two intervals ϱ1 and ϱ2 – each of length 20ptΠ – in which TΠk(𝒟) satisfies the same relational facts modulo a shift. Analogously, in the right segment of the “central fragment” there are intervals ϱ3 and ϱ4 also with repeating contents.

It is worth emphasising that in the definition of a saturated interpretation (first item), we consider only a single materialisation step, which can be effectively checked. As we will show in Theorem 21, rather surprisingly, this condition is enough to guarantee that a saturated interpretation can be unfolded into the canonical interpretation.

We next define the unfolding of a saturated interpretation relatively to a pair (ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍) of its periods. Although there can be many such pairs of intervals, the key properties of the unfolding are independent of the choice of periods.

Definition 19.

The (ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍)-unfolding, of a saturated interpretation TΠk(𝒟) with periods (ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍), is the interpretation such that:

  • [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+]=TΠk(𝒟)[ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+],

  • ϱ𝗅𝖾𝖿𝗍n|ϱ𝗅𝖾𝖿𝗍| is a shift of TΠk(𝒟)ϱ𝗅𝖾𝖿𝗍, for any n,

  • ϱ𝗋𝗂𝗀𝗁𝗍+n|ϱ𝗋𝗂𝗀𝗁𝗍| is a shift of TΠk(𝒟)ϱ𝗋𝗂𝗀𝗁𝗍, for any n.

We observe that the unfolding is unique and can be obtained from the least interpretation coinciding with TΠk(𝒟) on [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+] by subsequently copying the fragment of this interpretation that spans ϱ𝗅𝖾𝖿𝗍 infinitely many times to the left and the fragment of this interpretation that spans ϱ𝗋𝗂𝗀𝗁𝗍 infinitely many times towards the right on the timeline.

In Theorem 21 we will show that the unfolding of a saturated interpretation coincides with the canonical interpretation. The proof of this theorem exploits the following technical lemma.

Lemma 20.

Let ϱ be a closed interval of length 0ptΠ and 𝒟 a dataset representing Π,𝒟ϱ. Then both of the following hold:

  1. 1.

    If ϱ+t𝒟+, then Π,𝒟(ϱ+,)=Π,𝒟(ϱ+,).

  2. 2.

    If ϱt𝒟, then Π,𝒟(,ϱ)=Π,𝒟(,ϱ).

Proof sketch.

Both items have similar proofs, so we focus on the first one. The inclusion Π,𝒟(ϱ+,)Π,𝒟(ϱ+,) follows from the fact that Π,𝒟𝒟, so Π,𝒟Π,𝒟. To show that Π,𝒟(ϱ+,)Π,𝒟(ϱ+,) it suffices to prove inductively that, for every ordinal α and relational fact M@t with t>ϱ+, if TΠα(𝒟)M@t, then TΠα(𝒟)M@t.

Theorem 21.

The (ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍)-unfolding of a saturated interpretation TΠk(𝒟) with periods (ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍) coincides with the canonical interpretation Π,𝒟.

Proof sketch.

We first show that Π,𝒟. Since Π,𝒟 is the least model of Π and 𝒟, it suffices to show that is a model of Π and 𝒟. As [t𝒟,t𝒟+][ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+], we obtain that the projection of TΠk(𝒟) over [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+] is a model of 𝒟. However, by Definition 19, and TΠk(𝒟) coincide on [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+], so is also a model of 𝒟. To show that satisfies Π in ϱ=[ϱ𝗅𝖾𝖿𝗍+0ptΠ,ϱ𝗋𝗂𝗀𝗁𝗍+0ptΠ], it suffices, by Proposition 17, to show that the projection of over [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+] satisfies Π in ϱ; this holds since and TΠk(𝒟) coincide on [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+] and TΠk(𝒟) satisfies Π in [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+], as it is saturated. It remains to argue that satisfies Π at each t outside ϱ. Assume that t<ϱ, so t<ϱ𝗅𝖾𝖿𝗍+0ptΠ. Then, there exists a unique pair of n and t[ϱ𝗅𝖾𝖿𝗍+0ptΠ,ϱ𝗅𝖾𝖿𝗍++0ptΠ) such that t+n|ϱ𝗅𝖾𝖿𝗍|=t. This, by the definition of , implies that [t0ptΠ,t+0ptΠ] is a shift of [t0ptΠ,t+0ptΠ]. Thus, by Proposition 17, satisfies Π at t if and only if satisfies Π at t. The latter holds since tϱ and, as we already showed, satisfies Π in ϱ. The proof for t>ϱ𝗋𝗂𝗀𝗁𝗍0ptΠ is similar, so Π,𝒟.

We show that Π,𝒟. The projection of over [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+] is in Π,𝒟 since and TΠk(𝒟) coincide on this interval and TΠk(𝒟)Π,𝒟. To show that the projection of over (,ϱ𝗅𝖾𝖿𝗍] is in Π,𝒟, we argue that [ti,ϱ𝗋𝗂𝗀𝗁𝗍+]Π,𝒟[ti,ϱ𝗋𝗂𝗀𝗁𝗍+] by induction on consecutive timepoints ti on the (Π,𝒟)-ruler, with t0=ϱ𝗅𝖾𝖿𝗍. The base holds since and TΠk(𝒟) coincide on [ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍+]. For the inductive step, let ϱA=[ti,ti1), ϱB=[ti1,ti1+0ptΠ], ϱA=ϱA+|ϱ𝗅𝖾𝖿𝗍|, and ϱB=ϱB+|ϱ𝗅𝖾𝖿𝗍|. Hence, it suffices to show that ϱAΠ,𝒟ϱA. We note that ϱB is a shift of ϱB by the construction of and the fact that (ϱB)+ϱ𝗅𝖾𝖿𝗍++0ptΠ. Thus, by the inductive assumption and Π,𝒟, we obtain that Π,𝒟ϱB is a shift of Π,𝒟ϱB. By the construction of we know that ϱA is a shift of ϱA and since the lengths of ϱB and ϱB equal 0ptΠ, we can use Lemma 20 to show that Π,𝒟ϱA is a shift of Π,𝒟ϱA. By the inductive assumption, ϱAΠ,𝒟ϱA and so, ϱAΠ,𝒟ϱA. The proof of the inclusion [ϱ𝗋𝗂𝗀𝗁𝗍+,)Π,𝒟[ϱ𝗋𝗂𝗀𝗁𝗍+,) is symmetric; thus, Π,𝒟.

Theorem 21 states that the unfolding of a saturated interpretation around any pair of its periods coincides with the canonical interpretation. Thus, we can refer to an unfolding of a saturated interpretation without explicitly referring to its periods.

We conclude this section by establishing a bound k𝗆𝖺𝗑, depending on Π and 𝒟, which ensures that TΠk(𝒟) is saturated for some kk𝗆𝖺𝗑. Intuitively, k𝗆𝖺𝗑 is the number of facts that we can construct by combining atoms relevant to Π and 𝒟 with (Π,𝒟)-intervals contained in a sufficiently large interval ϱ. The interval ϱ is chosen so that [t𝒟,t𝒟+]ϱ, and such that its fragments [ϱ,t𝒟) and (t𝒟+,ϱ+] to the left and right of 𝒟, respectively, contain so many intervals of length 20ptΠ with endpoints on the (Π,𝒟)-ruler, that their contents need to repeat. These repetitions guarantee the existence of intervals ϱ1,,ϱ4 from Definition 18.

Theorem 22.

There exists kk𝗆𝖺𝗑 such that TΠk(𝒟) is saturated, where the bound k𝗆𝖺𝗑 is as follows.

Let A be the number of ground relational atoms in the grounding of Π with constants from Π and 𝒟, let B be the number of (Π,𝒟)-intervals within [t𝒟,t𝒟+20ptΠ], and let ϱ=[tw20ptΠ,tw+20ptΠ], where <t2<t1<t𝒟 and t𝒟+<t1<t2< are sequences of consecutive time points on the (Π,𝒟)-ruler, while w=1+B(2A)B. Then k𝗆𝖺𝗑 is the product of A and the number of (Π,𝒟)-intervals contained in ϱ.

Proof sketch.

The canonical interpretation Π,𝒟 satisfies at most k𝗆𝖺𝗑 relational facts over (Π,𝒟)-intervals contained in ϱ. Since each application of TΠ (before reaching a fixpoint) introduces at least one new relational fact over a (Π,𝒟)-interval, there needs to exist kk𝗆𝖺𝗑 such that TΠk(𝒟)ϱ=TΠk+1(𝒟)ϱ. We argue that TΠk(𝒟) is saturated for such k by showing that ϱ contains intervals ϱ1,,ϱ4 satisfying the conditions from Definition 18. To show the existence of ϱ1 and ϱ2, we observe that ϱ contains w=1+B(2A)B intervals of length 20ptΠ whose endpoints are located on the (Π,𝒟)-ruler to the left of t𝒟. We can show that there must exist amongst them two distinct intervals ϱ1 and ϱ2 such that TΠk(𝒟)ϱ1 is a shift of TΠk(𝒟)ϱ2. Indeed, each interval of the form [t,t+20ptΠ], for t on the (Π,𝒟)-ruler, contains the same number of (Π,𝒟)-intervals as [t𝒟,t𝒟+20ptΠ] does, which equals B. In each of these (Π,𝒟)-intervals there can hold at most 2A combinations of relational atoms, which gives rise to (2A)B different contents of an interval of the form [t,t+20ptΠ]. Additionally, these intervals can differ depending on the location of (Π,𝒟)-intervals they contain. By the definition of the (Π,𝒟)-ruler, there are at most B different layouts of (Π,𝒟)-intervals contained in an interval of the form [t,t+20ptΠ]. Hence, in total, there are at most B(2A)B intervals of the form [t,t+20ptΠ] with different contents. Thus, in a set of w=1+B(2A)B such intervals, there needs to be a pair of distinct intervals ϱ1 and ϱ2 such that TΠk(𝒟)ϱ1 is a shift of TΠk(𝒟)ϱ2. Analogously, we can show the existence of required ϱ3 and ϱ4 to the right of t𝒟+, so the second item from Definition 18 holds. Moreover, since [ϱ1,ϱ4+]ϱ and TΠk(𝒟)ϱ=TΠk+1(𝒟)ϱ, we obtain that TΠk(𝒟) satisfies Π in [ϱ1,ϱ4+]. Thus, the first item from Definition 18 holds as well, and so, TΠk(𝒟) is saturated.

The bound k𝗆𝖺𝗑 from Theorem 22 is doubly exponential in the size of Π and 𝒟, but only exponential in the size of 𝒟. This bound shows us how much time is needed to perform reasoning, which is consistent with the computational complexity of reasoning in DatalogMTL, namely ExpSpace in combined complexity [11] and PSpace in data complexity [46].

In the next section we will exploit the obtained results to provide a terminating reasoning algorithm.

4.3 Reasoning Algorithm Based on Saturation

The results from the previous section suggest the reasoning procedure formalised in Algorithm 3, which checks if a bounded program Π and a dataset 𝒟 entail a fact M@ϱ.

Algorithm 3 Reasoning via Periods Detection.

The algorithm successively applies the rules of Π to the dataset (Line 8) until one of two stopping conditions hold. The first condition (Line 3) detects if the materialisation 𝒟𝗇𝗈𝗐 constructed thus far entails the input fact M@ϱ, in which case the algorithm reports that the input fact is entailed. The second condition checks if 𝒟𝗇𝗈𝗐 is saturated (i.e., represents a saturated interpretation). To this end, the algorithm computes in Line 4 two non-empty intervals which are periods of 𝒟𝗇𝗈𝗐 (if 𝒟𝗇𝗈𝗐 is saturated), or introduces two empty intervals (if 𝒟𝗇𝗈𝗐 is not saturated). If 𝒟𝗇𝗈𝗐 is saturated, the algorithm exploits 𝒟𝗇𝗈𝗐 and its periods to check whether M@ϱ is entailed (Lines 67).

We next describe in detail the computations of the algorithm and establish its correctness. In what follows, we fix an arbitrary input Π, 𝒟, and M@ϱ to Algorithm 3 and assume that the notions of a saturated interpretation and its periods are relative to Π and 𝒟. We also let the projection 𝒟ϱ of a dataset 𝒟 over an interval ϱ be the dataset obtained by intersecting all intervals in facts from 𝒟 with ϱ.

Rule Application.

In each iteration of the loop, Algorithm 3 applies the procedure 𝖠𝗉𝗉𝗅𝗒𝖱𝗎𝗅𝖾𝗌 (Line 8), which implements a single round of rule applications to 𝒟𝗇𝗈𝗐, and thus, mimics an application of the immediate consequence operator TΠ to 𝒟𝗇𝗈𝗐. Hence, in the beginning of a (k+1)st iteration of the loop, the dataset 𝒟𝗇𝗈𝗐 in Algorithm 3 represents TΠk(𝒟).

First Stopping Condition.

In Line 3, Algorithm 3 checks whether the materialisation 𝒟𝗇𝗈𝗐 constructed so far entails the input fact M@ϱ. Since facts in 𝒟𝗇𝗈𝗐 are stored in a coalesced form, to check if 𝒟𝗇𝗈𝗐M@ϱ, it suffices to scan 𝒟𝗇𝗈𝗐 and verify whether there is M@ϱ𝒟𝗇𝗈𝗐 with ϱϱ.

Second Stopping Condition.

Algorithm 3 calls the 𝖯𝖾𝗋𝗂𝗈𝖽𝗌 procedure in Line 4 to check, in an iteration k+1 of the loop, if TΠk(𝒟) is saturated. The procedure searches for intervals ϱ1,,ϱ4 satisfying the conditions in Definition 18 and returns the periods of the interpretation TΠk(𝒟) if it is saturated or a pair of empty intervals otherwise. To this end, the procedure performs one round of rule applications to 𝒟𝗇𝗈𝗐, computing 𝒟𝗇𝖾𝗑𝗍. Then, it computes an interval ϱ𝗆𝖺𝗑 as either the empty interval (if 𝒟𝗇𝗈𝗐 and 𝒟𝗇𝖾𝗑𝗍 do not coincide on [t𝒟,t𝒟+]), or otherwise as the maximal interval containing [t𝒟,t𝒟+] and such that 𝒟𝗇𝗈𝗐 and 𝒟𝗇𝖾𝗑𝗍 coincide on ϱ𝗆𝖺𝗑. Interval ϱ𝗆𝖺𝗑 is next used to search for ϱ1 and ϱ2, namely all pairs of intervals contained in ϱ𝗆𝖺𝗑, located to the left of t𝒟, with endpoints on the (Π,𝒟)-ruler, and of lengths 20ptΠ, are compared. The first pair of such intervals with the same contents in 𝒟𝗇𝗈𝗐 is set as ϱ1 and ϱ2; otherwise ϱ1 and ϱ2 are empty intervals. In a similar way intervals ϱ3 and ϱ4 are computed. Finally, the procedure outputs a pair of intervals ([ϱ1,ϱ2),(ϱ3+,ϱ4+]), or (,) if any of the intervals ϱ1,,ϱ4 is empty.

Fact Entailment Checking after Saturation.

After constructing a saturated dataset 𝒟𝗇𝗈𝗐 (representing TΠk(𝒟), for some k) with periods (ϱ𝗅𝖾𝖿𝗍,ϱ𝗋𝗂𝗀𝗁𝗍), Algorithm 3 calls the procedure 𝖤𝗇𝗍𝖺𝗂𝗅𝗌 (Line 6) to check whether the input fact M@ϱ holds in the unfolding of TΠk(𝒟). This can be easily checked by exploiting Definition 19 of unfolding.

From our theoretical results in the previous subsection it follows that the algorithm is sound and complete:

Theorem 23.

Algorithm 3 outputs 𝖳𝗋𝗎𝖾 if (Π,𝒟)M@ϱ, otherwise it outputs 𝖥𝖺𝗅𝗌𝖾. Moreover, the algorithm terminates after at most k𝗆𝖺𝗑+1 (c.f. Theorem 22) iterations of its main loop.

We conclude this section with an example illustrating the execution of Algorithm 3.

Example 24.

Consider Π={[0,1]PP,[1,1]QQ}, 𝒟={P@0,Q@1.5}, and a query fact M@t=Q@4.5. After 5 iterations of the loop in Algorithm 3, the dataset 𝒟𝗇𝗈𝗐 consists of facts P@[0,5] and Q@t, for all t{3.5,2.5,1.5,0.5,0.5,1.5}. The stopping condition from Line 3 does not hold, but the condition in Line 5 does. Indeed, 𝒟𝗇𝗈𝗐 is saturated and its periods computed in Line 4 are ϱ𝗅𝖾𝖿𝗍=[3.5,2.5) and ϱ𝗋𝗂𝗀𝗁𝗍=(4.0,4.5]. The unfolding of 𝒟𝗇𝗈𝗐 is the canonical interpretation of Π and 𝒟 depicted in the figure below. Then, in Line 6, Algorithm 3 can exploit 𝒟𝗇𝗈𝗐, ϱ𝗅𝖾𝖿𝗍, and ϱ𝗋𝗂𝗀𝗁𝗍 to detect entailment of any fact. In particular, the input fact Q@4.5 is entailed, and so, Algorithm 3 returns 𝖳𝗋𝗎𝖾 in Line 6.

5 Time to Conclude

We have introduced DatalogMTL, as an expressive rule-based language for temporal reasoning. After presenting formal syntax and semantics of DatalogMTL, we have discussed its reasoning algorithms. In particular, we have discussed two ways to perform reasoning. The first is based on iterative application of rules of a DatalogMTL program until no further facts can be derived. Such a procedure can be easily implemented, but it does not guarantee termination. Then, we have presented an algorithm which extends materialisation with checking an additional condition – which we call saturation. A saturated partial materialisation can always be constructed in a bounded number of steps, and can be used to construct the full canonical interpretation.

In what follows we will present a list of further research topics and papers on DatalogMTL, as well as some interesting open problems.

5.1 Further Reading and Related Work

DatalogMTL was first introduced under the continuous semantics and over the rational timeline [11]. The complexity of standard reasoning tasks in DatalogMTL and its fragments was further investigated [12, 46, 48, 8]. DatalogMTL has also been studied over the integer timeline [47] and under the event-based semantics [36]. DatalogMTL has recently been extended with negation-as-failure under the stable model semantics, first for stratified programs [38] and subsequently for the general case [52]. It was also studied in the setting of existential rules [30]. Very recently, inconsistency handling in DatalogMTL has been studied, by introducing temporal versions of conflicts and repairs, as well as establishing the computational complexity of their generation [10].

MeTeoR [41] is the first reasoner to support the full DatalogMTL language by combining materialisation-based and automata-based techniques, and has been successfully applied for solving stream reasoning tasks [37]. It has been further optimised with several techniques such as seminaive materialisation [40, 42] and magic sets [45]. Earlier systems with DatalogMTL support, such as the Ontop platform [28], performed reasoning via rewriting into SQL and were restricted to non-recursive programs. Reasoning methods based on solving linear inequalities for a language similar to DatalogMTL were also introduced [14]. Another reasoning approach has been recently introduced by extending the Datalog system Vadalog [7]. DatalogMTL has proved useful for temporal stream reasoning [49, 37, 50], temporal ontology-based data access [11], specification and verification of banking agreements [34], fact-checking economic claims [31], and for describing dance movements [35], among others. DatalogMTL has been also studied in the context of learning temporal rules from datasets [43] and to study the ability of LLMs to perform temporal reasoning [20, 44].

Extensions of DatalogMTL with non-monotonic negation are closely related to temporal extensions of answer set programming (ASP) [2]. Particularly relevant is a recently introduced extension of ASP with MTL operators [16]. Previously, ASP was also extended with LTL operators, giving rise to temporal equilibrium logic TEL [18, 23, 15], which has been implemented in the Telingo system [17]. Additionally, LARS [6] combines ASP and MTL operators for reasoning over data streams. It is worth observing that, unlike DatalogMTL, all these temporal extensions of ASP are interpreted over the integer timeline. Bidirectional ASP programs provide another related extension of ASP with functional symbols – they allow for modeling the integer timeline while ensuring decidability of reasoning [24, 25]. Operators from MTL have also been exploited in temporal extensions of description logics (DLs) [26, 5, 39, 4].

5.2 Open Problems

Research on DatalogMTL has opened a number of interesting directions and left several important questions unanswered. We highlight some of them below:

  • Algorithms: The saturation-based algorithm presented in Section 4 is designed only for the bounded setting, namely for programs and datasets that do not use or as interval endpoints. Extending this approach to the full language of DatalogMTL remains an open problem. Such an extension appears to require not just the computation of a single saturated interpretation, but rather a sequence of them. Developing such an algorithm and establishing its correctness constitutes a significant technical challenge of high theoretical and practical importance.

  • Computational Complexity: A number of tight complexity bounds for DatalogMTL and its fragments are already known. However, one fragment whose complexity remains unresolved – despite substantial effort – is DatalogMTL𝖼𝗈𝗋𝖾, which allows only core rules (rules with head or at most one body atom) and restricts temporal operators to . Interestingly, similar “core box” fragments also lack tight complexity results in other temporal logics, such as interval temporal logics. This suggests the existence of a broader complexity challenge. Progress on DatalogMTL could provide insights that extend beyond this language, potentially unlocking solutions to analogous problems in other temporal frameworks.

  • Characterisation of Neural Models: Recent work has established a close correspondence between the expressive power of Datalog and Graph Neural Networks (GNNs) – neural architectures designed for processing graph-structured data [21]. In parallel, temporal extensions of GNNs have emerged [51]. This naturally raises the question of whether the expressive power of such temporal architectures can be captured by temporal extensions of Datalog, such as DatalogMTL.

The open problems we have listed illustrate just some of the many directions in which the study of DatalogMTL can advance. They range from fundamental algorithmic challenges, through unresolved complexity questions, to emerging connections with neural models. This list is by no means exhaustive, and together these questions highlight exciting opportunities for future research.

References

  • [1] Serge Abiteboul, Richard Hull, and Victor Vianu. Foundations of Databases. Addison-Wesley, 1995.
  • [2] Felicidad Aguado, Pedro Cabalar, Martín Diéguez, Gilberto Pérez, Torsten Schaub, Anna Schuhmann, and Concepción Vidal. Linear-time temporal answer set programming. Theory and Practice of Logic Programming, pages 1–55, 2021.
  • [3] Wałęga Przemysław Andrzej, Michał Zawidzki, and Christoph Haase. Computing all facts entailed by an ltl specification. In Proceedings of the International Conference on Principles of Knowledge Representation and Reasoning, volume 19, pages 679–689, 2023.
  • [4] Alessandro Artale and Enrico Franconi. A temporal description logic for reasoning about actions and plans. Journal of Artificial Intelligence Research, 9:463–506, 1998. doi:10.1613/JAIR.516.
  • [5] Franz Baader, Stefan Borgwardt, Patrick Koopmann, Ana Ozaki, and Veronika Thost. Metric temporal description logics with interval-rigid names. ACM Trans. Comput. Log., 21(4):30:1–30:46, 2020. doi:10.1145/3399443.
  • [6] Harald Beck, Minh Dao-Tran, Thomas Eiter, and Christian Folie. Stream reasoning with LARS. KI - Künstliche Intelligenz, 32(2):193–195, 2018. doi:10.1007/S13218-018-0537-9.
  • [7] Luigi Bellomarini, Livia Blasi, Markus Nissl, and Emanuel Sallinger. The temporal vadalog system: Temporal datalog-based reasoning. Theory and Practice of Logic Programming, 25(2):168–196, 2025. doi:10.1017/S1471068425000018.
  • [8] Luigi Bellomarini, Markus Nissl, and Emanuel Sallinger. Query evaluation in DatalogMTL – taming infinite query results. CoRR, abs/2109.10691, 2021. arXiv:2109.10691.
  • [9] Luigi Bellomarini, Emanuel Sallinger, and Georg Gottlob. The Vadalog system: Datalog-based reasoning for knowledge graphs. Proceedings of the VLDB Endowment, 11(9):975–987, 2018. doi:10.14778/3213880.3213888.
  • [10] Meghyn Bienvenu, Camille Bourgaux, and Atefe Khodadaditaghanaki. Inconsistency handling in datalogmtl. arXiv preprint arXiv:2505.10394, 2025. doi:10.48550/arXiv.2505.10394.
  • [11] Sebastian Brandt, Elem Güzel Kalayci, Roman Kontchakov, Vladislav Ryzhikov, Guohui Xiao, and Michael Zakharyaschev. Ontology-based data access with a Horn fragment of metric temporal logic. In Proc. of AAAI, pages 1070–1076, 2017. doi:10.1609/AAAI.V31I1.10696.
  • [12] Sebastian Brandt, Elem Güzel Kalaycı, Vladislav Ryzhikov, Guohui Xiao, and Michael Zakharyaschev. Querying log data with metric temporal logic. J. Artif. Intell. Res., 62:829–877, 2018. doi:10.1613/JAIR.1.11229.
  • [13] François Bry, Norbert Eisinger, Thomas Eiter, Tim Furche, Georg Gottlob, Clemens Ley, Benedikt Linse, Reinhard Pichler, and Fang Wei. Foundations of rule-based query answering. In Reasoning Web, volume 4636, pages 1–153, 2007. doi:10.1007/978-3-540-74615-7_1.
  • [14] Christoph Brzoska. Programming in metric temporal logic. Theoretical Computer Science, 202(1-2):55–125, 1998. doi:10.1016/S0304-3975(97)00139-4.
  • [15] Pedro Cabalar. Temporal ASP: From logical foundations to practical use with telingo. In Mantas Šimkus and Ivan Varzinczak, editors, Reasoning Web. Declarative Artificial Intelligence, pages 94–114, 2022.
  • [16] Pedro Cabalar, Martín Diéguez, Torsten Schaub, and Anna Schuhmann. Towards metric temporal answer set programming. Theory and Practice of Logic Programming, 20(5):783–798, 2020. doi:10.1017/S1471068420000307.
  • [17] Pedro Cabalar, Roland Kaminski, Philip Morkisch, and Torsten Schaub. telingo = asp + time. In Marcello Balduccini, Yuliya Lierler, and Stefan Woltran, editors, Logic Programming and Nonmonotonic Reasoning, pages 256–269, 2019. doi:10.1007/978-3-030-20528-7_19.
  • [18] Pedro Cabalar and Gilberto Pérez Vega. Temporal equilibrium logic: A first approach. In Roberto Moreno Díaz, Franz Pichler, and Alexis Quesada Arencibia, editors, Computer Aided Systems Theory, pages 241–248, 2007. doi:10.1007/978-3-540-75867-9_31.
  • [19] David Carral, Irina Dragoste, Larry González, Ceriel J. H. Jacobs, Markus Krötzsch, and Jacopo Urbani. Vlog: A rule engine for knowledge graphs. In The Semantic Web - ISWC, volume 11779, pages 19–35, 2019. doi:10.1007/978-3-030-30796-7_2.
  • [20] Andrea Colombo, Teodoro Baldazzi, Luigi Bellomarini, Andrea Gentili, and Emanuel Sallinger. Llm-based datalogmtl modelling of micar-compliant crypto-assets markets. In Datalog in Academia and Industry (Datalog-2.0 2024), volume 3801, pages 17–22, 2024. URL: https://ceur-ws.org/Vol-3801/short1.pdf.
  • [21] David Jaime Tena Cucala, Bernardo Cuenca Grau, Egor V. Kostylev, and Boris Motik. Explainable GNN-based models over knowledge graphs. In International Conference on Learning Representations ICLR, 2022.
  • [22] Evgeny Dantsin, Thomas Eiter, Georg Gottlob, and Andrei Voronkov. Complexity and expressive power of logic programming. ACM Computing Surveys, 33(3), 2001. doi:10.1145/502807.502810.
  • [23] Martín Diéguez. Temporal answer set programming. In Agostino Dovier and Vítor Santos Costa, editors, International Conference on Logic Programming, ICLP, volume 17, pages 445–450, 2012. doi:10.4230/LIPICS.ICLP.2012.445.
  • [24] Thomas Eiter and Mantas Simkus. Bidirectional answer set programs with function symbols. In International Joint Conference on Artificial Intelligence, IJCAI, pages 765–771, 2009. URL: http://ijcai.org/Proceedings/09/Papers/132.pdf.
  • [25] Thomas Eiter and Mantas Simkus. FDNC: decidable nonmonotonic disjunctive logic programs with function symbols. ACM Transactions on Computational Logic, 11(2):14:1–14:50, 2010. doi:10.1145/1656242.1656249.
  • [26] Víctor Gutiérrez-Basulto, Jean Christoph Jung, and Ana Ozaki. On metric temporal description logics. In European Conference on Artificial Intelligence ECAI, volume 285, pages 837–845, 2016. doi:10.3233/978-1-61499-672-9-837.
  • [27] Alex Ivliev, Lukas Gerlach, Simon Meusel, Jakob Steinberg, and Markus Krötzsch. Nemo: your friendly and versatile rule reasoning toolkit. In International Conference on Principles of Knowledge Representation and Reasoning KR, pages 743–754, 2024.
  • [28] Elem Güzel Kalayci, Sebastian Brandt, Diego Calvanese, Vladislav Ryzhikov, Guohui Xiao, and Michael Zakharyaschev. Ontology–based access to temporal data with Ontop: A framework proposal. Int. J. Appl. Math., 29(1):17–30, 2019. doi:10.2478/AMCS-2019-0002.
  • [29] Ron Koymans. Specifying real-time properties with metric temporal logic. Real-Time Syst., 2(4):255–299, 1990. doi:10.1007/BF01995674.
  • [30] Matthias Lanzinger, Markus Nissl, Emanuel Sallinger, and Przemysław Andrzej Wałęga. Temporal datalog with existential quantification. In Proc. of IJCAI, pages 3277–3285, 2023.
  • [31] Marco Mori, Paolo Papotti, Luigi Bellomarini, and Oliver Giudice. Neural machine translation for fact-checking temporal claims. In Extraction and VERification Workshop (FEVER), pages 78–82, 2022.
  • [32] Boris Motik, Yavor Nenov, Robert Piro, Ian Horrocks, and Dan Olteanu. Parallel materialisation of Datalog programs in centralised, main-memory RDF systems. In Conference on Artificial Intelligence AAAI, pages 129–137, 2014. doi:10.1609/AAAI.V28I1.8730.
  • [33] Yavor Nenov, Robert Piro, Boris Motik, Ian Horrocks, Zhe Wu, and Jay Banerjee. Rdfox: A highly-scalable rdf store. In International Semantic Web Conference, pages 3–20. Springer, 2015. doi:10.1007/978-3-319-25010-6_1.
  • [34] Markus Nissl and Emanuel Sallinger. Modelling smart contracts with DatalogMTL. In Proc. of EDBT/ICDT, 2022.
  • [35] Katerina El Raheb, Theofilos Mailis, Vladislav Ryzhikov, Nicolas Papapetrou, and Yannis E. Ioannidis. Balonse: Temporal aspects of dance movement and its ontological representation. In International Conference, ESWC, volume 10250, pages 49–64, 2017. doi:10.1007/978-3-319-58451-5_4.
  • [36] Vladislav Ryzhikov, Przemysław Andrzej Wałęga, and Michael Zakharyaschev. Data complexity and rewritability of ontology-mediated queries in metric temporal logic under the event-based semantics. In Proc. of IJCAI, pages 1851–1857, 2019.
  • [37] Patrik Schneider, Daniel Alvarez-Coello, Anh Le-Tuan, Manh Nguyen-Duc, and Danh Le-Phuoc. Stream reasoning playground. In The Semantic Web: 19th International Conference, ESWC, pages 406–424, 2022. doi:10.1007/978-3-031-06981-9_24.
  • [38] David J. Tena Cucala, Przemysław Andrzej Wałęga, Bernardo Cuenca Grau, and Egor V. Kostylev. Stratified negation in Datalog with metric temporal operators. In Proc. of AAAI, pages 6488–6495, 2021.
  • [39] Veronika Thost. Metric temporal extensions of DL-Lite and interval-rigid names. In Principles of Knowledge Representation and Reasoning KR, pages 665–666. AAAI Press, 2018. URL: https://aaai.org/ocs/index.php/KR/KR18/paper/view/18035.
  • [40] Dingmin Wang, Bernardo Cuenca Grau, Przemysław Andrzej Wałęga, and Pan Hu. Practical reasoning in datalogmtl. Theory and Practice of Logic Programming, 25(2):225–255, 2025. doi:10.1017/S1471068424000164.
  • [41] Dingmin Wang, Pan Hu, Przemysław Andrzej Wałęga, and Bernardo Cuenca Grau. MeTeoR: Practical reasoning in Datalog with metric temporal operators. In Proc. of AAAI, pages 5906–5913, 2022.
  • [42] Dingmin Wang, Przemysław Andrzej Wałęga, and Bernardo Cuenca Grau. Seminaive materialisation in DatalogMTL. In International Joint Conference on Rules and Reasoning, pages 183–197. Springer, 2022.
  • [43] Dingmin Wang, Przemysław Andrzej Wałęga, and Bernardo Cuenca Grau. MTLearn: extracting temporal rules using datalog rule learners. In Proceedings of the International Conference on Principles of Knowledge Representation and Reasoning, volume 21, pages 962–973, 2024.
  • [44] Dingmin Wang, Bocheng Zou, and Zhen Han. tBen: Benchmarking and testing the rule-based temporal logic reasoning ability of large language models with datalogmtl, 2024.
  • [45] Shaoyu Wang, Kaiyue Zhao, Dongliang Wei, Przemysław Andrzej Wałęga, Dingmin Wang, Hongming Cai, and Pan Hu. Goal-driven reasoning in datalogmtl with magic sets. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pages 15203–15211, 2025.
  • [46] Przemysław Andrzej Wałęga, Bernardo Cuenca Grau, Mark Kaminski, and Egor V. Kostylev. DatalogMTL: Computational complexity and expressive power. In Proc. of IJCAI, pages 1886–1892, 2019.
  • [47] Przemysław Andrzej Wałęga, Bernardo Cuenca Grau, Mark Kaminski, and Egor V. Kostylev. DatalogMTL over the integer timeline. In Proc. of KR, pages 768–777, 2020.
  • [48] Przemysław Andrzej Wałęga, Bernardo Cuenca Grau, Mark Kaminski, and Egor V. Kostylev. Tractable fragments of Datalog with metric temporal operators. In Proc. of IJCAI, pages 1919–1925, 2020.
  • [49] Przemysław Andrzej Wałęga, Mark Kaminski, and Bernardo Cuenca Grau. Reasoning over streaming data in metric temporal Datalog. In Proc. of AAAI, pages 3092–3099, 2019.
  • [50] Przemysław Andrzej Wałęga, Mark Kaminski, Dingmin Wang, and Bernardo Cuenca Grau. Stream reasoning with DatalogMTL. J. Web Semant., 76:100776, 2023. doi:10.1016/J.WEBSEM.2023.100776.
  • [51] Przemysław Andrzej Wałęga and Michael Rawson. Expressive power of temporal message passing. In Proc. of AAAI, pages 21000–21008, 2025.
  • [52] Przemysław Andrzej Wałęga, David J. Tena Cucala, Egor V. Kostylev, and Bernardo Cuenca Grau. DatalogMTL with negation under stable models semantics. In Proc. of KR, pages 609–618, 2021.
  • [53] Przemysław Andrzej Wałęga, Michał Zawidzki, and Bernardo Cuenca Grau. Finitely materialisable Datalog programs with metric temporal operators. In Proc. of KR, pages 619–628, 2021.
  • [54] Przemysław Andrzej Wałęga, Michał Zawidzki, and Bernardo Cuenca Grau. Finite materialisability of Datalog programs with metric temporal operators. J. Artif. Intell. Res., 76, 2023. doi:10.1613/JAIR.1.14040.
  • [55] Przemysław Andrzej Wałęga, Michał Zawidzki, Dingmin Wang, and Bernardo Cuenca Grau. Materialisation-based reasoning in DatalogMTL with bounded intervals. In AAAI Conference on Artificial Intelligence, pages 6566–6574, 2023.