Conjunctive Query Answering with OWL 2 QL

Conjunctive Query Answering with OWL 2 QL

Proceedings of the Thirteenth International Conference on Principles of Knowledge Representation and Reasoning Conjunctive Query Answering with OWL 2 QL Stanislav Kikot and Roman Kontchakov and Michael Zakharyaschev Department of Computer Science and Information Systems Birkbeck, University of London, U.K. –kikot,roman,michael˝@dcs.bbk.ac.uk Abstract tional constants and predicates. Optimised (but still expo- nential) pure rewritings to nonrecursive Datalog were sug- We present a novel rewriting technique for conjunctive gested by Rosati and Almatelli (2010) and Gottlob, Orsi, query answering over OWL 2 QL ontologies. In gen- and Pieris (2011). The combined approach of Kontchakov eral, the obtained rewritings are not necessarily cor- rect and can be of exponential size in the length of the et al. (2010) was developed for OWL 2 QL without role in- query. We argue, however, that in most, if not all, prac- clusions; it uses a simple polynomial rewriting over the data tical cases the rewritings are correct and of polynomial expanded by applying the ontology axioms and introducing size. Moreover, we prove some sufficient conditions, a small number of new individuals. imposed on queries and ontologies, that guarantee cor- The diversity of approaches to query rewriting prompts rectness and succinctness. We also support our claim by another question: what is the type/shape/size of rewritings experimental results. we should aim at to make OBDA with OWL 2 QL efficient? When trying to answer this question, we should bear in Introduction mind that (i) the OBDA paradigm relies on the proven ef- ficiency of RDBMSs, but (ii) database query answering is OWL 2 QL, one of three profiles of the Web Ontology Lan- not tractable in the size of queries (PSPACE-complete for guage OWL 2, was designed with the aim of supporting FO queries and NP-complete for CQs). High efficiency of ontology-based data access (OBDA). The key idea is that RDBMSs in practice appears to indicate only that answering data, ‘stored in a standard relational database management real-world queries over real-world databases turns out to be system (RDBMS), can be queried through an OWL 2 QL tractable. As rewritings can turn a standard query to some- ontology via a simple rewriting mechanism, i.e., by rewrit- thing ‘out of this world,’ a first rule of thumb could be as fol- ing the query into an SQL query that is then answered by lows: the rewritten query should look similar to the original the RDBMS, without any changes to the data’ (www.w3.org/ one. In this respect, as Gottlob and Schwentick (2011) re- TR/owl2-profiles). The rewritability property ensures, in par- mark, their polynomial rewriting is of rather ‘theoretical na- ticular, that the data complexity of answering queries over ture’ (it uses the extra constants, predicates and existentially OWL 2 QL ontologies matches the complexity of database 0 quantified variables to encode, by making nondeterminis- query answering, which is in AC . tic guesses, a relevant part of the chase, aka the canonical It has been observed, however, that the available ‘rewrit- model; see the discussion in Conclusions for more details). ing mechanisms’ for OWL 2 QL (Calvanese et al. 2007a; The aim of this paper is to investigate what causes ex- Perez-Urbina,´ Motik, and Horrocks 2009; Rosati and Al- ponentially long pure rewritings of CQs over OWL 2 QL matelli 2010; Chortaras, Trivela, and Stamou 2011; Got- ontologies and to check experimentally whether those ‘bad tlob, Orsi, and Pieris 2011) are actually not so ‘simple.’ guys’ occur in real-world queries and ontologies. As a result In fact, the rewritten queries are often too long to be exe- of this analysis, we suggest some short (polynomial-size) cuted by modern RDBMSs, and the question whether ‘short’ rewritings that cover most, if not all, practical cases. rewritings exist has attracted considerable attention over the We think of a CQ as a labelled directed multigraph. For last two years. For example, Kikot, Kontchakov, and Za- example, the query ‘find x ; x ; x for which kharyaschev (2011) showed that no polynomial algorithm 1 2 3 can construct a ‘pure rewriting’ of a conjunctive query (CQ) 9y ; y ; y A (x ) ^ A (x ) ^ B (y ) ^ T (x ; y ) ^ q over an OWL 2 QL ontology T . Here by a pure rewriting 1 2 3 1 1 3 3 3 3 1 1 we mean any first-order (FO) rewriting with the same sig- R(x1; x2) ^ T (x2; x3) ^ S(x3; y2) ^ S(y3; y2) nature (predicates and constants) as q and T , possibly with equality. On the other hand, Gottlob and Schwentick (2011) holds’ can be represented as the graph gave a polynomial-time (‘impure’) rewriting using addi- A1 A3 B3 Copyright c 2012, Association for the Advancement of Artificial y T x R x T x S y S y Intelligence (www.aaai.org). All rights reserved. 1 1 2 3 2 3 275 To answer a CQ q(~x) over data A and ontology T , we seek of existential quantifiers. Our experiments with a number homomorphisms from q to the structure, called the canoni- of standard OWL 2 QL ontologies and queries demonstrate cal model and obtained by expanding A (extensional data) that the sufficient conditions always apply, the queries nor- with knowledge in T (intensional data). Thus, we have to mally contain very few pieces of type (B), if any, and more- find possible cuts of q into a number of pieces: some of over, these pieces are never in conflict. Thus, in practice the them—say, of type (A)—are mapped to individuals in A, rewritings qc and qp are both short and correct. while the others—of type (B)—may only have some of their Omitted proofs can be found in the full version of the pa- terms (‘roots’) in A, whereas the remaining part is implied per at www.dcs.bbk.ac.uk/˜kikot. by the knowledge in T . For example, the query above can be cut, for a suitable T , into 3 pieces of which only the middle OWL 2 QL one is of type (A), and the right piece has two roots x3; y3: The language of OWL 2 QL contains individual names ai, concept names A , and role names P (i ≥ 1). Roles R, ba- A1 A3 B3 i i sic concepts B and concepts C are defined by the grammar: y T x R x T x S y S y 1 1 2 3 2 3 − R ::= Pi j Pi ; If q(~x) does not have existentially quantified variables then B ::= ? j Ai j 9R; the whole q forms the only possible cut of type (A), because C ::= B j 9R:B the answer variables ~x must be mapped to individuals in A. If T does not contain role inclusion axioms then, as shown A TBox, T , is a finite set of inclusions of the form by Kontchakov et al. (2010; 2011), every root determines a B v C; R v R ; unique piece of type (B). However, in general, q may have 1 2 exponentially many pieces of type (B). One can encode the B1 u B2 v ?;R1 u R2 v ?: intuition above as a pure positive existential rewriting qe, (Note that concepts of the form 9R:B can only occur in the which is, roughly speaking, a disjunction over all possible right-hand side of concept inclusions in OWL 2 QL. An in- cuts of q, and so is exponential in jqj in the worst case. clusion B0 v 9R:B can be regarded as an abbreviation for A slightly different approach to checking possible cuts of 0 − three inclusions: B v 9RB, 9RB v B and RB v R, q is to consider, for every edge in q, whether it belongs to where RB is a fresh role name.) An ABox, A, is a finite set an (A) piece, or generates a (B) piece itself, or lies inside of assertions of the form Ak(ai) and Pk(ai; aj). T and A the (B) piece generated by some other edge. This ‘local’ together constitute the knowledge base (KB) K = (T ; A). view gives another rewriting, a conjunction of disjunctions The semantics for OWL 2 QL is defined in the usual way I I qc, which may still be exponential as the same edge may based on interpretations I = (∆ ; · ); consult (Baader et generate exponentially many distinct (B) pieces. (Two (B) al. 2003) for details. The set of individual names in A pieces are different if their domains or roots are different.) will be denoted by ind(A). For concepts or roles E1 and Moreover, the new rewriting is not necessarily correct be- E2, we write E1 vT E2 if T j= E1 v E2; and we set 0 0 0 cause some (B) pieces may not be realised together in the [E] = fE j E vT E and E vT Eg. canonical model; we call such pieces conflicting. A conjunctive query (CQ) q(~x) is a first-order formula We analyse—both theoretically and experimentally— 9~y'(~x;~y), where ' is constructed, using ^, from atoms conditions under which the number of (B) pieces is polyno- of the form Ak(t1) and Pk(t1; t2), where each ti is a term mial and they are not in conflict with each other. In particu- (an individual or a variable from ~x or ~y). Variables in ~x lar, we develop techniques to ensure that rewritings are not are called answer variables, and those in ~y bound vari- affected by conflicting pieces. For example, one simple— ables.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    11 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us