From Event to Action: Accelerate Your Decision Making with Real-Time Automation
An OBDA reasoner for efficient query answering over large ontologies and data
1. A reasoner for Ontology Based Data Access
Mariano Rodríguez-Muro and Diego Calvanese
KRDB Research Group
Free University of Bozen-BolzanoOWLED’12
May, 2012
Quest
3. OBDA and -Quest-
Instance reasoning
• Instance reasoning
• Infer new information about the data
• Detect inconsistent data
• Use inferred information for complex queries (e.g., SPARQL)
• Aim: Large ontologies + Large data
• Traditional approach...
4. OBDA and -Quest-
The usual workflow (ETL)
Reasoner
Source
Application
Communication
Ontology
Inputs
Triples Application Code (e.g., D2RQ, R2RML processors, etc)
5. OBDA and -Quest-
Problem with approach
• Software Complexity
• Duplication
• Data refreshing
• Performance (implementation,
even light languages)
• Data structure is lost (PKEYS,
FOREIGN KEYS, etc)
Reasoner
Source
Application
Communication
Ontology
Inputs
Triples Application Code
6. OBDA and -Quest-
OBDA Models: Sources and Mappings
“A formal specification of the relationship
between data in a data source and the
vocabulary of the ontology”
OBDA
Model
Source Declaration
Source M
A set of mappings
Mapping: “A tuple of an source query (e.g., SQL) and a
template of the ABox assertions to defined by the answers to
the query.”
7. OBDA and -Quest-
OBDA as an Architecture
Reasoner
Source
Application
Direct
Communication
Ontology
OBDA
Model
Inputs
9. OBDA and -Quest-
The Pay-off
• At least
• The source is documented
• Data handling can be done automatically (by the reasoner)
• Reduced cost of application development and maintenance
• The reasoner can analyze source and mappings to minimize the cost of
inference
10. OBDA and -Quest-
The Pay-off
• At least
• The source is documented
• Data handling can be done automatically (by the reasoner)
• Reduced cost of application development and maintenance
• The reasoner can analyze source and mappings to minimize the cost of
inference
• The sweet spot (with OWL 2 QL/RDFS)
• On-the-fly ontology based data access
• Exploitation of efficient sources (e.g., SQL engines)
• Reasoning by pure query rewriting
11. OBDA and -Quest-
An OBDA reasoner focused on fast and efficient query answering
over very large ontologies and very large volumes of data.
Features:
• Support for RDFS and OWL 2 QL semantics
• SPARQL* (> UCQs)
• Powerful mapping language (often compensates for OWL 2
QL)
• OWLAPI 3 and Protégé 4.1 support
• Reasoning by query rewriting.
• Relies on SQL engines for query execution.
• ABox modes...
Quest
12. OBDA and -Quest-
Quest in “classic ABox mode” (R/W)
Ontology
Quest
ABox/
OBDA
Model
Source
Application
JDBC
Storage is is based on the
Semantic Index technique
(ISWC11, KR12)
Internal DB
13. OBDA and -Quest-
Quest in “virtual ABox mode” (read-only)
Ontology
Quest
OBDA
Model
Source
ApplicationInputs
PostgreSQL, MySQL,
SQL Server, DB2 and
Oracle
JDBC
14. OBDA and -Quest-
Data integration with virtual ABox mode
Ontology
Quest
OBDA
Model
Database
Federation
Application
JDBC
Inputs
E.g., Teiid, Oracle, DB2
15. OBDA and -Quest-
What’s special about Quest?
• We realized that SQL determines performance, not TBox query
rewriting.
• Query rewritings in Quest are “natural” SQL queries
• Effective query rewriting:
• Highly efficient rewriting algorithm
• Highly efficient SQL generation:
• Detection of redundant SQL (w.r.t. constraints and mappings)
• Optimized individual SQL queries (w.r.t. constraints and mappings)
• Generates optimal SQL for modern engines
• Beyond academic prototype, focused on features for SW
application development.
• Going beyond OWL 2 QL. Rules (SWRL, RIF), exploiting
recursivity of SQL and Datalog engines for OWL 2 EL, hybrid
approaches for OWL 2 RL.
18. OBDA and -Quest-
Query Rewriting in a Nutshell
“Given a query Q, a TBox T, an OBDA model <D, M>
to compute a query Q’ over D that returns the desired
answers”
19. OBDA and -Quest-
Example OBDA
model
id [PKEY] name age ssn
12 John 37 xxx-999
Table: patient
patient_id [FKEY] c_id [FKEY]
12 33
Table: condition
20. OBDA and -Quest-
Example OBDA
model
SELECT id,name,age,ssn FROM patient
:person/{$id} a Patient; name $name;
age $age^^xsd:int; ssn $ssn
id [PKEY] name age ssn
12 John 37 xxx-999
Table: patient
patient_id [FKEY] c_id [FKEY]
12 33
Table: condition
21. OBDA and -Quest-
Example OBDA
model
SELECT id,name,age,ssn FROM patient
:person/{$id} a Patient; name $name;
age $age^^xsd:int; ssn $ssn
id [PKEY] name age ssn
12 John 37 xxx-999
Table: patient
patient_id [FKEY] c_id [FKEY]
12 33
Table: condition
SELECT id, c_id FROM condition
:person/{$id} affectedBy :cond/{$id}/{$c_id}
22. OBDA and -Quest-
Example OBDA
model
SELECT id,name,age,ssn FROM patient
:person/{$id} a Patient; name $name;
age $age^^xsd:int; ssn $ssn
id [PKEY] name age ssn
12 John 37 xxx-999
Table: patient
patient_id [FKEY] c_id [FKEY]
12 33
Table: condition
SELECT id, c_id FROM condition
:person/{$id} affectedBy :cond/{$id}/{$c_id}
SELECT id,c_id FROM condition WHERE c_id = 33
:cond/{$id}/{$c_id} a CardiacArrest
SELECT id,c_id FROM condition WHERE c_id = 27
:cond/{$id}/{$c_id} a Clog
23. OBDA and -Quest-
Query Rewriting:
An example
Ontology (Tbox)
SubClassOf(:CardiacArrest :HearthCondition)
SubClassOf(:Clog :HearthCondition)
Query (SPARQL)
SELECT ?p ?n ?ssn WHERE {
?p a :Patient; :name ?n; :ssn ?s; :age ?a;
:affectedBy [ a :HeartCondition ].
FILTER (?a >= 21 && ?a <= 50)
}
24. OBDA and -Quest-
Query Rewriting
An Example
Rewriting w.r.t. the OBDA model (mappings)
Efficient n-ary to binary!!
25. OBDA and -Quest-
Query Rewriting
An Example
Rewriting w.r.t. the OBDA model (mappings)
SELECT
(‘http://quest.org/owled#’ || tp.id) as p,
tp.name as n,
tp.ssn as s
FROM
patient tp JOIN condition tc
ON tp.id = tc.patient_id
WHERE
(c.c_id = 33 || c.c_id = 27)
AND tp.age >= 21
AND tp.age <= 50
Efficient n-ary to binary!!
26. OBDA and -Quest-
Query Rewriting
An Example
Rewriting w.r.t. the OBDA model (mappings)
SELECT
(‘http://quest.org/owled#’ || tp.id) as p,
tp.name as n,
tp.ssn as s
FROM
patient tp JOIN condition tc
ON tp.id = tc.patient_id
WHERE
(c.c_id = 33 || c.c_id = 27)
AND tp.age >= 21
AND tp.age <= 50
p n s
:person/12 John xxx-999
Answer
Efficient n-ary to binary!!