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.
Engineering optimisations in query rewriting for OBDA
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. 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
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. 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. 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
9. Optimisations in the rewriting
9José Mora
• The rewriting can be optimised in
several ways
• Ontology preprocessing
• Constrain the searches
• Subsumption checks
• Prioritize inferences
12. A running example (in Datalog)
12José Mora
We can convert
the ontology to a
set of clauses
Note the auxiliary
predicate
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. In our example:
14José Mora
We can do some
inferences
(this is only a
small sample)
to obtain a processed
ontology
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. 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. 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
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:
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)
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. 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. 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
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