Efficient Handling of SPARQL OPTIONAL for OBDA

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

Proc. of the 17th Int. Semantic Web Conf. (ISWC 2018). Volume 11136 of Lecture Notes in Computer Science. 2018.

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

   title = "Efficient Handling of SPARQL OPTIONAL for OBDA",
   year = "2018",
   author = "Guohui Xiao and Roman Kontchakov and Benjamin Cogrel and
Diego Calvanese and Elena Botoeva",
   booktitle = "Proc. of the 17th Int. Semantic Web Conf. (ISWC 2018)",
   pages = "354--373",
   volume = "11136",
   publisher = "Springer",
   series = "Lecture Notes in Computer Science",
   doi = "10.1007/978-3-030-00671-6_21",
pdf url