SlideShare une entreprise Scribd logo
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
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
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 the DB and
obtain all the answers
with the inference done.
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
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
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
• Constrain the searches
• Subsumption checks
• Prioritize inferences
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
• 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 →
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 presence of
clauses beyond
the mentioned
possibilities for
the initial Datalog
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
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
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 the main premise it will participate in many inferences.
Let’s look at the Datalog program:
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 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)
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 efficient
but we need a
subsuming clause
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
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
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 Informática
Universidad Politécnica de Madrid
Campus de Montegancedo s/n
28660 Boadilla del Monte, Madrid, Spain

Contenu connexe

Similaire à Engineering optimisations in query rewriting for OBDA

Detecting common scientific workflow fragments using templates and execution ...
Detecting common scientific workflow fragments using templates and execution ...Detecting common scientific workflow fragments using templates and execution ...
Detecting common scientific workflow fragments using templates and execution ...
dgarijo
 
A Survey on Automatic Software Evolution Techniques
A Survey on Automatic Software Evolution TechniquesA Survey on Automatic Software Evolution Techniques
A Survey on Automatic Software Evolution Techniques
Sung Kim
 
Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...
Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...
Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...
Lucidworks
 
Dev buchan 30 proven tips
Dev buchan 30 proven tipsDev buchan 30 proven tips
Dev buchan 30 proven tips
Bill Buchan
 

Similaire à Engineering optimisations in query rewriting for OBDA (20)

Ood and solid principles
Ood and solid principlesOod and solid principles
Ood and solid principles
 
Detecting common scientific workflow fragments using templates and execution ...
Detecting common scientific workflow fragments using templates and execution ...Detecting common scientific workflow fragments using templates and execution ...
Detecting common scientific workflow fragments using templates and execution ...
 
A Survey on Automatic Software Evolution Techniques
A Survey on Automatic Software Evolution TechniquesA Survey on Automatic Software Evolution Techniques
A Survey on Automatic Software Evolution Techniques
 
Using SigOpt to Tune Deep Learning Models with Nervana Cloud
Using SigOpt to Tune Deep Learning Models with Nervana CloudUsing SigOpt to Tune Deep Learning Models with Nervana Cloud
Using SigOpt to Tune Deep Learning Models with Nervana Cloud
 
OSS Java Analysis - What You Might Be Missing
OSS Java Analysis - What You Might Be MissingOSS Java Analysis - What You Might Be Missing
OSS Java Analysis - What You Might Be Missing
 
Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...
Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...
Enriching Solr with Deep Learning for a Question Answering System - Sanket Sh...
 
Systematic Inventive Thinking and Process improvements
Systematic Inventive Thinking and Process improvementsSystematic Inventive Thinking and Process improvements
Systematic Inventive Thinking and Process improvements
 
Top jcl interview questions and answers job interview tips
Top jcl interview questions and answers job interview tipsTop jcl interview questions and answers job interview tips
Top jcl interview questions and answers job interview tips
 
代码大全(内训)
代码大全(内训)代码大全(内训)
代码大全(内训)
 
Refactoring: Improve the design of existing code
Refactoring: Improve the design of existing codeRefactoring: Improve the design of existing code
Refactoring: Improve the design of existing code
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
Clean code
Clean codeClean code
Clean code
 
Evolving The Optimal Relevancy Scoring Model at Dice.com: Presented by Simon ...
Evolving The Optimal Relevancy Scoring Model at Dice.com: Presented by Simon ...Evolving The Optimal Relevancy Scoring Model at Dice.com: Presented by Simon ...
Evolving The Optimal Relevancy Scoring Model at Dice.com: Presented by Simon ...
 
Design p atterns
Design p atternsDesign p atterns
Design p atterns
 
Artificial Intelligence for Automated Software Testing
Artificial Intelligence for Automated Software TestingArtificial Intelligence for Automated Software Testing
Artificial Intelligence for Automated Software Testing
 
Software design principles
Software design principlesSoftware design principles
Software design principles
 
Improving neural question generation using answer separation
Improving neural question generation using answer separationImproving neural question generation using answer separation
Improving neural question generation using answer separation
 
Webinar: Performance Tuning + Optimization
Webinar: Performance Tuning + OptimizationWebinar: Performance Tuning + Optimization
Webinar: Performance Tuning + Optimization
 
Dev buchan 30 proven tips
Dev buchan 30 proven tipsDev buchan 30 proven tips
Dev buchan 30 proven tips
 
MongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
MongoDB World 2018: Tutorial - MongoDB Meets Chaos MonkeyMongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
MongoDB World 2018: Tutorial - MongoDB Meets Chaos Monkey
 

Dernier

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
UXDXConf
 

Dernier (20)

Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
Integrating Telephony Systems with Salesforce: Insights and Considerations, B...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Buy Epson EcoTank L3210 Colour Printer Online.pptx
Buy Epson EcoTank L3210 Colour Printer Online.pptxBuy Epson EcoTank L3210 Colour Printer Online.pptx
Buy Epson EcoTank L3210 Colour Printer Online.pptx
 
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
ASRock Industrial FDO Solutions in Action for Industrial Edge AI _ Kenny at A...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2UiPath Test Automation using UiPath Test Suite series, part 2
UiPath Test Automation using UiPath Test Suite series, part 2
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 

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
  • 10. A running example 10José Mora Consider the following ontology: With the following query:
  • 11. A running example 11José Mora We can convert the ontology to a set of clauses
  • 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
  • 15. Preprocessed ontology 15José Mora We obtain the preprocessed 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
  • 19. Consider the following example: Subsumption checks 11 José Mora
  • 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. Datalog program 21José Mora There are some clauses that could participate in inferences
  • 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. Rewritten query 23José Mora In the end, the rewritten query is only this:
  • 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
  • 28. Evaluation (2/2) 28José Mora Full results at: http://www.oeg-upm.net/files/jmora/
  • 29. Questions, comments, sugg estions, everything is welcome Questions? 14José Mora
  • 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