query rewriting under existential rules
play

Query Rewriting Under Existential Rules Andreas Pieris School of - PowerPoint PPT Presentation

Query Rewriting Under Existential Rules Andreas Pieris School of Informatics, University of Edinburgh, UK based on joint work with Pablo Barcel, Gerald Berger, Andrea Cal, Georg Gottlob, Marco Manna, Giorgio Orsi and Pierfrancesco Veltri DL


  1. Query Rewriting Under Existential Rules Andreas Pieris School of Informatics, University of Edinburgh, UK based on joint work with Pablo Barceló, Gerald Berger, Andrea Calì, Georg Gottlob, Marco Manna, Giorgio Orsi and Pierfrancesco Veltri DL Workshop, Montpellier, France, July 18 - 21, 2017

  2. this talk is about first-order rewritability under the basic decidable classes of existential rules

  3. Ontology-Based Query Answering S -database (ABox) knowledge base D h D,O i ontology (TBox) D database query (CQ) Ο q(x 1 ,…,x n ) = { (c 1 ,…,c n ) 2 dom(D) n | D ^ Ο ² q(c 1 ,…,c n ) } Certain-Answers(q, D, Ο )

  4. Ontology-Mediated Queries S -database (ABox) D ontology-mediated query (OMQ) Q = ( S , O, q(x 1 ,…,x n )) Q(D) = Certain-Answers(q, D, Ο )

  5. Scalability in OMQ Evaluation S -database (ABox) D ontology-mediated query (OMQ) ? Q = ( S , O, q(x 1 ,…,x n )) Exploit standard RDBMSs - efficient technology for answering queries

  6. Query Rewriting Q = ( S , O, q(x 1 ,…,x n )) rewrite Q rew (x 1 ,…,x n ) a query that can be executed by a standard DBMS - first-order query for every S -database D : Q(D) = Q rew (D) [Calvanese, De Giacomo, Lembo, Lenzerini & Rosati, AAAI 2005, J. Autom. Reasoning 2007]

  7. Query Rewriting: An Example { 8 x (Person(x)  9 y HasFather(x,y) ^ Person(y)) ≡ Person v 9 HasFather.Person } { Person( ¢ ), HasFather( ¢ , ¢ ) } 9 x Person(x) ^ HasFather(John,x) Q = ( S , O, q()) rewrite Q rew = 9 x Person(x) ^ HasFather(John,x) _ Person(John)

  8. First-Order Rewritability (FO-Rewritability) ( OL,QL ) an ontology language a database query language (fragment of first-order logic) (sublanguage of first-order queries) Definition: An OMQ language O is FO-Rewritable if every Q 2 O is FO-Rewritable

  9. FO-Rewritability: The Main Questions 1. Can we isolate meaningful OMQ languages that are FO-Rewritable? 2. For non-FO-Rewritable languages, can we decide FO-Rewritability? 3. What is the size of the FO rewritings? Can we do better? ...have been extensively studied for DL- and rule-based OMQ languages

  10. Existential Rules (a.k.a. tuple-generating dependencies) 8 x 8 y ( ' ( x , y )  9 z à ( x , z )) 8 x (Person(x)  9 y HasFather(x,y) ^ Person(y)) ≡ Person v 9 HasFather.Person 8 x 8 y (HasChild(x,y) ^ Human(y)  Human(x)) ≡ 9 HasChild.Human v Human

  11. Existential Rules (a.k.a. tuple-generating dependencies) ' ( x , y )  9 z à ( x , z ) Person(x)  9 y HasFather(x,y), Person(y) ≡ Person v 9 HasFather.Person HasChild(x,y), Human(y)  Human(x) ≡ 9 HasChild.Human v Human

  12. Existential Rules (a.k.a. tuple-generating dependencies) ' ( x , y )  9 z à ( x , z ) ( 9 Rules , CQ )

  13. Guardedness Frontier-Guarded R( x ), ' ( x , y )  9 z à ( x , z ) one body-atom contains all [Baget, Leclère, Mugnier & Salvat, IJCAI 2009, Artif. Intell. 2011] the 8 -variables in the head Guarded R( x , y ), ' ( x , y )  9 z à ( x , z ) one body-atom contains [Calì, Gottlob & Kifer, KR 2008, J. Artif. Intell. Res. 2013] all the 8 -variables Linear  9 z à ( x , z ) R( x , y ) one body-atom [Calì, Gottlob & Lukasiewicz, PODS 2009, J. Web Sem. 2012]

  14. Acyclicity (…or, non -recursive - the predicate graph is acyclic) R(x,y), R(y,z)  9 w P(x), S(x,w) T(x)  P(x) P T R S

  15. Stickiness (…or, do not forget the joins) R(x,y), P(y,z)  9 w T(x,y,w) R(x,y), P(y,z)  9 w T(x,y,w) T(x,y,z)  9 w S(y,w) T(x,y,z)  9 w S(x,w)   R(x 1 ,…,x n ), P(y 1 ,…,y m )  T(x 1 ,…,x n ,y 1 ,…,y m )  [Calì, Gottlob & P., PVLDB 2010, Artif. Intell. 2012]

  16. Classes of Existential Rules (a.k.a. Datalog § languages) Weakly-Frontier-Guarded Frontier-Guarded Guarded Weakly-Acyclic Weakly-Sticky Linear Acyclic Sticky

  17. Classes of Existential Rules (a.k.a. Datalog § languages) What about FO-Rewritability? Weakly-Frontier-Guarded Frontier-Guarded Guarded Weakly-Acyclic Weakly-Sticky Linear Acyclic Sticky

  18. Classes of Existential Rules (a.k.a. Datalog § languages) Dangerous zone! Weakly-Frontier-Guarded DATALOG Frontier-Guarded Guarded Weakly-Acyclic Weakly-Sticky Linear Acyclic Sticky

  19. Guardedness and FO-Rewritability Theorem: ( Guarded , CQ ) is not FO-Rewritable Q = ({P, R}, {R(x,y), P(y)  P(x)}, P(c n )) D ¶ {P(c 1 )}, and contains no other P-atom Q rew has to check for the existence of an R-path in D of unbounded length R R R R R … c n c 1 # n-1 # n-2 # 2 compute the transitive closure of R - not possible via a first-order query

  20. FO-Rewritable OMQ Languages Theorem: ( L , CQ ), where L 2 { Linear , Acyclic , Sticky }, is FO-Rewritable Via the Bounded Derivation Depth Property (BDDP) [Calì, Gottlob & Lukasiewicz, PODS 2009, J. Web Sem. 2012] + [ Calì, Gottlob & P., PVLDB 2010, Artif. Intell. 2012]

  21. Bounded Derivation Depth Property (BDDP) Definition: ( L , CQ ) enjoys the BDDP if: for every Q = ( S , O, q) 2 ( L , CQ ), there exists δ ≥ 0 such that, for every S -database D, Q(D) = q(chase δ (D,O)) D chase δ (D,O) depth δ q [Calì, Gottlob & Lukasiewicz, PODS 2009, J. Web Sem. 2012]

  22. Bounded Derivation Depth Property (BDDP) Proposition: BDDP ) FO-Rewritability β δ atoms D each atom is obtained by depth δ at most β atoms … … … ) to entail a CQ q we need at most |q| ¢ β δ database atoms

  23. Bounded Derivation Depth Property (BDDP) Proposition: BDDP ) FO-Rewritability Given an OMQ ( S , O, q): • D β,δ, q be the set of all possible S -databases of size at most |q| ¢ β δ • C = { D 2 D β,δ, q | q(chase(D,O)) is non-empty } • Convert C into a UCQ …in fact, the other direction also holds - FO-Rewritability , BDDP

  24. FO-Rewritable OMQ Languages Theorem: ( L , CQ ), where L 2 { Linear , Acyclic , Sticky }, is FO-Rewritable Via the Bounded Derivation Depth Property (BDDP) but, the BDDP-based algorithm is very expensive can we do better? [Calì, Gottlob & Lukasiewicz, PODS 2009, J. Web Sem. 2012] + [ Calì, Gottlob & P., PVLDB 2010, Artif. Intell. 2012]

  25. Perfect Reformulation Applicability → Soundness rewriting step Reduction → C ompleteness reduction step [Calvanese, De Giacomo, Lembo, Lenzerini & Rosati, AAAI 2005, J. Autom. Reasoning 2007]

  26. Perfect Reformulation for Existential Rules R(y,x), P(y)  9 z T(z,x,x) 9 u 9 v 9 w T(u,v,w), P(w) g = {u → z, v → x, w → x} T(z,x,x) thus, we can simulate a chase step by applying a backward resolution step 9 u 9 v 9 w T(u,v,w), P(w) _ 9 x 9 y R(y,x), P(y), P(x)

  27. Perfect Reformulation for Existential Rules R(y,x), P(y)  9 z T(z,x,x) 9 u 9 v 9 w T(u,v,w), P(u) g = {u → z, v → x, w → x} T(z,x,x)  thus, we can simulate a chase step by applying a backward resolution step 9 u 9 v 9 w T(u,v,w), P(u) _ 9 x 9 y 9 u R(x,y), P(x), P(u) unsound rewriting

  28. Perfect Reformulation for Existential Rules R(y,x), P(y)  9 z T(z,x,x) 9 u 9 v 9 w T(u,v,w), P(u) g = {u → z, v → x, w → x} T(z,x,x) Applicability condition: constants, join variables and free variables in the query do NOT unify with 9 -variables …but, it may destroy completeness

  29. Perfect Reformulation for Existential Rules R(y,x), P(y)  9 z T(z,x,x) 9 u 9 v 9 w T(u,v,w), P(u) T(x,y,z)  P(x) 9 u 9 v 9 w T(u,v,w), P(u) _ 9 u 9 v 9 w 9 y 9 z T(u,v,w), T(u,y,z) _ (by the reduction step) 9 u 9 v 9 w T(u,v,w) _ (by the rewriting step) 9 x 9 y R(x,y), P(x)

  30. XRewrite applicability condition for existential rules apply only useful reduction steps [Gottlob, Orsi & P., ICDE 2011, ACM Trans. Database Syst. 2014]

  31. FO-Rewritable OMQ Languages Theorem: ( L , CQ ), where L 2 { Linear , Acyclic , Sticky }, is FO-Rewritable Via the Bounded Derivation Depth Property (BDDP) but, the BDDP-based algorithm is very expensive can we do better? use the XRewrite algorithm Piece-based rewriting - based on a refined notion of unification [König, Leclère, Mugnier & Thomazo, RR 2012, Semantic Web 2015]

  32. Recap What about deciding FO-Rewritability? Frontier-Guarded non-FO-Rewritable Guarded Linear Acyclic Sticky FO-Rewritable

  33. Deciding FO-Rewritability { R(x,y), S(y)  S(x), R(x,y), P(x)  S(y) } { P( ¢ ), R( ¢ , ¢ ), S( ¢ ) } P(x) ^ R(x,y) ^ S(y) Q = ( S , O, q(x,y)) rewrite P(x) ^ R(x,y)

  34. Deciding FO-Rewritability { R(x,y), S(y)  S(x), R(x,y), P(x)  S(y) } { P( ¢ ), R( ¢ , ¢ ), S( ¢ ) } S(y) Q = ( S , O, q(y)) rewrite 

  35. Deciding FO-Rewritability FORew(L,QL) Input: an OMQ Q 2 ( L , QL ) Question: is Q FO-Rewritable? What is the complexity of FORew(Guarded,CQ) and FORew(Frontier-Guarded,CQ) ?

  36. Deciding FO-Rewritability FORew(L,QL) Input: an OMQ Q 2 ( L , QL ) Question: is Q FO-Rewritable? Theorem: FORew(L,CQ) , where L 2 { Guarded , Frontier-Guarded } is in 3EXPTIME, and 2EXPTIME-hard even for bounded arity [Barceló, Berger & P., 2017]

  37. Deciding FO-Rewritability Theorem: FORew(Guarded , BCQ) is in 3EXPTIME and 2EXPTIME-hard even for bounded arity Upper Bound: • Characterize FO-Rewritability via the finiteness of a set of certain • “tree - like” databases • Construct an alternating tree automaton A , with double-exponentially many states, such that the OMQ is FO-Rewritable iff the language of A is finite Lower Bound: Inherited from FORew(ELI ,CQ ) • [Bienvenu, Hansen, Lutz & Wolter, IJCAI 2016] [Barceló, Berger & P., 2017]

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend