Efficient Handling of SPARQL OPTIONAL for OBDA

Chapel October 10, 2018 12:00 - 12:20

Bookmark and Share

Guohui Xiao, Roman Kontchakov, Benjamin Cogrel, Diego Calvanese and Elena Botoeva.  

Abstract:  OPTIONAL is a key feature in SPARQL for dealing with missing information. While this operator is being used extensively, it is also known for its complexity, which can make it challenge to evaluate queries with OPTIONAL efficiently. In this paper, we tackle this challenge in the standard Ontology-Based Data Access (OBDA) setting, where the data is stored in a SQL relational database and is exposed as a virtual RDF graph by the means of an R2RML mapping. We start with a succinct translation of a fragment of SPARQL into Relational Algebra (RA) that fully respects bag semantics and three-valued logic. This translation relies on extensive use of the LEFT JOIN operator and coalesce function. We then propose a number of optimisation techniques for reducing the size and improving the structure of generated SQL queries. Our optimisations capture interactions between JOIN, LEFT JOIN, coalesce and database integrity constraints such as attribute nullability and uniqueness, and foreign key constraints. Finally, we empirically verify effectiveness of our techniques over several OBDA benchmarks.

Keywords:  Ontology-based Data Access;  SPARQL;  OPTIONAL;  LEFT JOIN;  Query Optimisation;  Bag Semantics