• Keine Ergebnisse gefunden

6.3 First-Order Rewritings of r-Satisfiability

8.1.3 Canonical Models and Rewritability

We finally provide the properties we assume the logics and queries we consider to satisfy next to the decidability of consistency. First, we focus on canonical models as mentioned above. We tailor the corresponding property however to the reasoning problem of query answering.

Definition 8.9 (Canonical Model Property) A logic L has the canonical model property w.r.t. a query language QLif, for each consistent knowledge base Kwritten in L, there is a countably infinitecanonical model IKofK such that, for allQLqueriesϕ,

Cert(ϕ,K) =Ans(ϕ,IK). ♦

8.1 Preliminaries

L QL shown in

EL++ subs. [BBL05]

ELH UCQ [Ros07, Lem. 1]

ELIf CQ [KL07, Lem. 5]

ELHdr CQ [LTW09, Prop. 4]

ELHI¬ CQ [PMH10, Lem. 10]

DL-Lite[R|F] UCQ [Cal+07b, Thm. 29]

DL-Lite(HNhorn) UCQ [BAC10, Thm. 9]

DL-Litehorn PEQ [Kon+11, Thm. 3]

DL-LiteR C2RPQ [BOS15, Lem. 3.2]

Horn-ALCHIQ CQ [Eit+12, Thm. 3], [Kaz09]

Horn-ALCHOIQDisjSelf C2RPQ [ORˇS11, Thm. 2]

Figure 8.1: DLsL and query languagesQLw.r.t. which they have the canonical model property.

The restriction to countably infinite interpretations is again technical and ensures that all these models have the same cardinality. This is however only a minor restriction since canonical models are often explicitly constructed in a countable way. Moreover, in case the canonical model is finite, it can usually be extended by (countably infinite) replications without affecting the semantics (i.e., the answers to queries are the same w.r.t. both models). Example 8.10 presents logics, particularly DLs, that have this property.

Example 8.10 Figure 8.1 lists several DLs L and query languages QL that have the canonical model property. The canonical model is usually constructed by applying the axioms of the knowledge base K=hT,Aiascompletion rules to the facts inA in order to obtain a model of K.6

In [BBL05], the focus is on subsumption queries. A canonical model is not explicitly constructed, but it can be easily obtained by regarding the application of the completion rules (see Table 2 in that paper). This is also the case for [Kaz09] (see Table 3 in that paper).

Note that the result from [BOS15] also holds forELH. Further, the one from [Eit+12]

also holds for the more expressive DL Horn-SHIQif the CQs only containsimple roles (i.e., roles without transitive subroles).

Regarding a Datalog program obtained from K (i.e., the facts in A are regarded as rules with empty body), [PMH10; Eit+12] construct a canonical model based on the

least Herbrand model of the program. ♦

Recently, so-called rewriting approaches—in the spirit of the rewriting from data integration (e.g., (1.2) in Chapter 1)—for computing the set of certain answers to a given query have become popular. They are usually based on a kind of canonical

6The procedure of applying the completion rules as well as the model are also called chase in the literature [DNR08].

model: the idea is to rewrite a query that is to be answered over a KB such that it can be evaluated over a single and finite interpretation. We specify a corresponding property of rewritability that is more general than the FO rewritability considered in Chapter 2 (see Definition 2.22).

Observe that the rewritten query, calledrewriting, usually belongs to a more expres-sive query language. Next to the type of this language, rewriting approaches can be discerned regarding the information that is used for constructing the rewriting and the interpretation, respectively. Strict rewriting approaches construct the rewriting based on the theory and the original query, and consider the interpretation to be the (unmod-ified) fact base, interpreted under the closed-world assumption. Since this technique is considered to be very efficient, it is employed in many works (e.g., in [Cal+05; Cal+07b;

CGL09]). More general approaches, such as thecombined approach [Kon+10; Kon+11], are different in that they allow the interpretation to also be influenced by the theory.

Note that, in practice, the data given then has to be preprocessed before query answering can be performed.

Definition 8.11 (Rewritable)LetLbe a logic andQL1andQL2be query languages.

Then, QL1 queries areQL2 rewritable w.r.t. L if the following can be computed:

• for every QL1 query ϕ and theory T written in L, a QL2 query ϕT such that NFV(ϕ) =NFVT);

• for everyL theory T, a finite set ∆T such that Ω⊆∆T;

• for every consistent knowledge baseKwritten inL, a finite interpretationDKover the domain ∆T such thatcDK =cfor all c∈Ω (standard name assumption);

such that, for allconsistent knowledge basesK=hT,Aiwritten inLandQL1queriesϕ,

we have Cert(ϕ,K) =Ans(ϕT,DK). ♦

In summary, QL2 rewritability means that finding certain answers to QL1 queries w.r.t. L KBs can be reduced to finding (ordinary) answers to QL2 queries in finite in-terpretations. Our last requirement is therefore that the set of answers to a QL2 query w.r.t. a finite interpretation must be computable. This means that QL2 rewritability of QL1 queries w.r.t.L implies that the set of answers to a QL1 query w.r.t. a knowl-edge base is also computable. Focusing on data complexity, observe that Definition 8.11 does not only abstract from but also extend Definition 2.22 in order to capture more existing rewriting approaches. The latter definition regards a finite interpretation that is independent of the theory and the query. In contrast, we here require DK only to be independent of a concrete query. The rewriting ϕT must however still not depend on knowledge from a fact base. Definition 8.11 again includes technical restrictions that are needed to lift the atemporal approach to the temporal setting (i.e., the assumption that ∆T is independent of the data, and the standard name assumption). But all of them are satisfied by the logics and query languages described in the following example, for which rewritability is given.

Example 8.12 Figure 8.2 lists several rewritability results for different instances ofL, QL1, and QL2. For the logics of the DL-Lite family and the EL extensions, the finite interpretation DK is usually obtained by viewing the fact base under the closed world

8.1 Preliminaries

L QL1 QL2 shown in

EL++ subs. subs. [BBL05]

ELHdr CQ FO= [LTW09, Thm. 5]

ELHI¬ CQ Datalog )[PMH10,

Thm. 2, Lem. 16]

DL-Lite+ CQ UCQ+

DL-LiteR CQ UCQ [Cal+07b, Lem. 39]

DL-LiteR UCQ PEQ [RA10, Thm. 2]

DL-LiteNhorn CQ FO= [Kon+10, Thm. 10]

DL-Lite(HNhorn) UCQ UCQ [BAC10, Lem. 10]

DL-LiteR C2RPQ C2RPQ [BOS15, Prop. 6.3]

DL-Lite+ CQ CRPQ [Dim+16, Thm. 3]

Horn-ALCHIQ CQ UCQ [Eit+12, Thm. 4]

LDL+ IQ IQ [HEX10, Cor. 11]

SROEL(u,×) IQ IQ [Kr¨o11, Thm. 1]

Datalog± family CQ UCQ [GOP11, Thm. 1]

Figure 8.2: Rewritability results for different instances of L, QL1, and QL2; FO= de-notes first-order queries with equality and UCQ+ a combination of a UCQ with a linear Datalog program.

assumption, but sometimes additional constant symbols are introduced (e.g., prototyp-ical elements as in Definitions 2.10 and 2.11). In the other cases, DK is based on the least Herbrand model of a suitable Datalog program that is based on K.

Again, the rewritability result from [BBL05] is only implicitly given in that paper (see Lemma 3).

As in Example 8.10, the result from [BOS15] also holds for ELH; and the one from [Eit+12] also holds for Horn-SHIQif the CQs do not contain non-simple roles.

In the constructions forLDL+ andSROEL(u,×), the original query is not adapted, and therefore these logics also have the canonical model property.

To ensure the termination of the rewriting algorithm in [GOP11], the theories have to be restricted (e.g., to linear rules or sticky sets). ♦ Many works suggest to consider rewritability as a decision problem as follows: Given a logicL, aQL1query, and a query languageQL2, decide if the query isQL2 rewritable w.r.t. L [Bie+14; CR15; Han+15; Bie+16]. The assumption behind this approach is that, in practice, concrete query answering problems for expressive logics are actually rewritable because many features of the logics are rarely used for modeling. Indeed, in the experiments of [Han+15], efficient7 FO rewritings of instance queries inELHdrwere obtained in most cases and turned out to be very performant. Based on these results, our approach extends to more expressive logics, too: instead of QL1, we can consider

7Many of the rewriting approaches proposed in the past are based on backward chaining and rewriting into UCQs, which requires a lot of optimization to obtain feasibility in applications.

only those elements of QL1 that have this property, and thus obtain another instance of Definition 8.11.

Lastly, note that finiteness of DK is obviously not sufficient in practice, where the interpretations DK additionally should be small, so that QL2 queries can be evaluated efficiently. Indeed, many rewritability results have subsequently been refined into that direction. However, in this final (technical) chapter, we investigate rewritability in a very general temporal setting and consider theoretical complexity considerations to be out of scope.