Engineering optimisations in
query rewriting for OBDA
José Mora and Óscar Corcho
{jmora, ocorcho}@fi.upm.es
Facultad de In...
Index
• Background
• Query rewriting (QR) for OBDA
• Approaches
• Clause generation
• Selection function
• Optimisations i...
Q’
Query rewriting for OBDA
3
Query
Q’
Query rewriting for OBDA
3
Q
Rewriting
We use the ontology to
produce a new query (Q’)
We can use this new
query with t...
Main approaches in the state of the art
5
Expressiveness Author System Output Date
ELHIO¬
Pérez-Urbina
et al.
REQUIEM
[R] ...
Main approaches in the state of the art
5
Expressiveness Author System Output Date
ELHIO¬
Pérez-Urbina
et al.
REQUIEM
[R] ...
Clause generation [Pérez-Urbina2010]
6
Selection function [Pérez-Urbina2010]
8José Mora
Optimisations in the rewriting
9José Mora
• The rewriting can be optimised in
several ways
• Ontology preprocessing
• Cons...
A running example
10José Mora
Consider the following ontology:
With the following query:
A running example
11José Mora
We can convert
the ontology to a
set of clauses
A running example (in Datalog)
12José Mora
We can convert
the ontology to a
set of clauses
Note the auxiliary
predicate
Ontology preprocessing
10José Mora
• Ontology preprocessing
• Some of the resolution
steps don’t need a query
to be done
•...
In our example:
14José Mora
We can do some
inferences
(this is only a
small sample)
to obtain a processed
ontology
Preprocessed ontology
15José Mora
We obtain the
preprocessed
ontology
Preprocessed ontology
16José Mora
We obtain the
preprocessed
ontology
Note the lack of
auxiliary
predicates, and
the prese...
Constraining the searches
13José Mora
• There are several searches for clauses that can be
constrained, improving the effi...
Subsumption checks
18José Mora
Due to preprocessing only a few inferences are needed to obtain the Datalog program:
Note t...
Consider the following example:
Subsumption checks
11
José Mora
Consider the following example:
Subsumption checks
11
José Mora
the inferred clause subsumes the main premise
If we keep t...
Datalog program
21José Mora
There are some clauses that could participate in inferences
Subsumption checks
11
José Mora
the inferred clause subsumes the main premise
This way we can avoid a set of inferences th...
Rewritten query
23José Mora
In the end, the rewritten query is only this:
Prioritizing some inferences
12José Mora
Deleting subsumed clauses reduces
the number of clauses handled
it’s more efficie...
Prioritizing some inferences
12José Mora
Deleting subsumed clauses reduces
the number of clauses handled
it’s more efficie...
Prioritizing some inferences
12José Mora
Deleting subsumed clauses reduces
the number of clauses handled
it’s more efficie...
Evaluation (1/2)
27José Mora
Evaluation (2/2)
28José Mora
Full results at: http://www.oeg-upm.net/files/jmora/
Questions, comments, sugg
estions, everything is
welcome
Questions?
14José Mora
Engineering optimisations in
query rewriting for OBDA
José Mora and Óscar Corcho
{jmora, ocorcho}@fi.upm.es
Facultad de In...
Upcoming SlideShare
Loading in …5
×

Engineering optimisations in query rewriting for OBDA

306 views
242 views

Published on

This is the presentation done to explain the optimisations presented in the paper published in I-SEMANTICS 2013: J. Mora and O. Corcho, “Engineering optimisations in query rewriting for OBDA,” in Proceedings of the 9th International Conference on Semantic Systems, Graz, Austria, 2013, pp. 41–48.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
306
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Engineering optimisations in query rewriting for OBDA

  1. 1. Engineering optimisations in query rewriting for OBDA José Mora and Óscar Corcho {jmora, ocorcho}@fi.upm.es Facultad de Informática Universidad Politécnica de Madrid Campus de Montegancedo s/n 28660 Boadilla del Monte, Madrid, Spain
  2. 2. Index • Background • Query rewriting (QR) for OBDA • Approaches • Clause generation • Selection function • Optimisations in the rewriting • Ontology preprocessing • Constrain the searches • Subsumption checks • Prioritize some inferences • Questions, comments and other feedback (you do this part) 2
  3. 3. Q’ Query rewriting for OBDA 3 Query
  4. 4. Q’ Query rewriting for OBDA 3 Q Rewriting We use the ontology to produce a new query (Q’) We can use this new query with the DB and obtain all the answers with the inference done.
  5. 5. Main approaches in the state of the art 5 Expressiveness Author System Output Date ELHIO¬ Pérez-Urbina et al. REQUIEM [R] Datalog, UCQ 2009 Sticky-join [linear] datalog± Gottlob et al. Nyaya UCQ 2011 DL-LiteR, DL-LiteF Calvanese et al. QuOnto UCQ 2007 DL-LiteR Chortaras et al. Rapid UCQ 2011 DL-LiteR [+EBox] Rosati et al. Presto & Prexto NR-Datalog & UCQ 2010 & 2012
  6. 6. Main approaches in the state of the art 5 Expressiveness Author System Output Date ELHIO¬ Pérez-Urbina et al. REQUIEM [R] Datalog, UCQ 2009 Sticky-join [linear] datalog± Gottlob et al. Nyaya UCQ 2011 DL-LiteR, DL-LiteF Calvanese et al. QuOnto UCQ 2007 DL-LiteR Chortaras et al. Rapid UCQ 2011 DL-LiteR [+EBox] Rosati et al. Presto & Prexto NR-Datalog & UCQ 2010 & 2012
  7. 7. Clause generation [Pérez-Urbina2010] 6
  8. 8. Selection function [Pérez-Urbina2010] 8José Mora
  9. 9. Optimisations in the rewriting 9José Mora • The rewriting can be optimised in several ways • Ontology preprocessing • Constrain the searches • Subsumption checks • Prioritize inferences
  10. 10. A running example 10José Mora Consider the following ontology: With the following query:
  11. 11. A running example 11José Mora We can convert the ontology to a set of clauses
  12. 12. A running example (in Datalog) 12José Mora We can convert the ontology to a set of clauses Note the auxiliary predicate
  13. 13. Ontology preprocessing 10José Mora • Ontology preprocessing • Some of the resolution steps don’t need a query to be done • Can be done only once for all queries • The results can be stored, increase in size is reasonable • Evaluation peformed with the usual ontologies, and a few more →
  14. 14. In our example: 14José Mora We can do some inferences (this is only a small sample) to obtain a processed ontology
  15. 15. Preprocessed ontology 15José Mora We obtain the preprocessed ontology
  16. 16. Preprocessed ontology 16José Mora We obtain the preprocessed ontology Note the lack of auxiliary predicates, and the presence of clauses beyond the mentioned possibilities for the initial Datalog
  17. 17. Constraining the searches 13José Mora • There are several searches for clauses that can be constrained, improving the efficiency • We have seen we have main premises and side premises, and clauses cannot work as both • By keeping separately clauses that may work as main premises and as side premises we reduce the combinatorial search for valid resolutions • By separating clauses that act as main premises and side premises we can use selection functions that are more simple and handle more types of clauses • By allowing more types of clauses we can remove some auxiliary predicates
  18. 18. Subsumption checks 18José Mora Due to preprocessing only a few inferences are needed to obtain the Datalog program: Note the last inferred clause subsumes the two other inferred clauses This means a reduction of 90% in this specific example
  19. 19. Consider the following example: Subsumption checks 11 José Mora
  20. 20. Consider the following example: Subsumption checks 11 José Mora the inferred clause subsumes the main premise If we keep the main premise it will participate in many inferences. Let’s look at the Datalog program:
  21. 21. Datalog program 21José Mora There are some clauses that could participate in inferences
  22. 22. Subsumption checks 11 José Mora the inferred clause subsumes the main premise This way we can avoid a set of inferences that produce subsumed clauses that are useless. (73% in this example) We can delete the first clause because it’s redundant And we should delete it ASAP And therefore any clause obtained from the premise will be subsumed too (by some other clause)
  23. 23. Rewritten query 23José Mora In the end, the rewritten query is only this:
  24. 24. Prioritizing some inferences 12José Mora Deleting subsumed clauses reduces the number of clauses handled it’s more efficient but we need a subsuming clause
  25. 25. Prioritizing some inferences 12José Mora Deleting subsumed clauses reduces the number of clauses handled it’s more efficient but we need a subsuming clause Producing subsuming clauses first allows to delete subsubmed clauses some inferences lead there, some don’t it’s about choosing the right ones
  26. 26. Prioritizing some inferences 12José Mora Deleting subsumed clauses reduces the number of clauses handled it’s more efficient but we need a subsuming clause Producing subsuming clauses first allows to delete subsubmed clauses some inferences lead there, some don’t it’s about choosing the right onesWe can use heuristics to try to produce subsuming clauses ASAP shorter clauses are more likely to produce subsuming clauses Recently generated clauses first (similar to depth first search) helps too
  27. 27. Evaluation (1/2) 27José Mora
  28. 28. Evaluation (2/2) 28José Mora Full results at: http://www.oeg-upm.net/files/jmora/
  29. 29. Questions, comments, sugg estions, everything is welcome Questions? 14José Mora
  30. 30. Engineering optimisations in query rewriting for OBDA José Mora and Óscar Corcho {jmora, ocorcho}@fi.upm.es Facultad de Informática Universidad Politécnica de Madrid Campus de Montegancedo s/n 28660 Boadilla del Monte, Madrid, Spain

×