Advertisement

Efficient Handling of SPARQL OPTIONAL for OBDA

  • Guohui Xiao
  • Roman Kontchakov
  • Benjamin Cogrel
  • Diego Calvanese
  • Elena Botoeva
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11136)

Abstract

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 efficient evaluation of queries with OPTIONAL challenging. We tackle this problem 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.

Notes

Acknowledgements

We thank the reviewers for their suggestions. This work was supported by the OBATS project at the Free University of Bozen-Bolzano and by the Euregio (EGTC) IPN12 project KAOS.

References

  1. 1.
    Arias, M., Fernández, J.D., Martínez-Prieto, M.A., de la Fuente, P.: An empirical study of real-world SPARQL queries. In: Proceedings of USEWOD (2011)Google Scholar
  2. 2.
    Atre, M.: Left bit right: for SPARQL join queries with OPTIONAL patterns (left-outer-joins). In: Proceedings of ACM SIGMOD, pp. 1793–1808 (2015)Google Scholar
  3. 3.
    Bizer, C., Schultz, A.: The Berlin SPARQL benchmark. Int. J. Semant. Web Inf. Syst. 5(2), 1–24 (2009)CrossRefGoogle Scholar
  4. 4.
    Calvanese, D., Cogrel, B., Komla-Ebri, S., Kontchakov, R., Lanti, D., Rezk, M., Rodriguez-Muro, M., Xiao, G.: Ontop: answering SPARQL queries over relational databases. SWJ 8, 471–487 (2017)CrossRefGoogle Scholar
  5. 5.
    Calvanese, D., De Giacomo, G., Lembo, D., Lenzerini, M., Rosati, R.: Tractable reasoning and efficient query answering in description logics: the DL-Lite family. JAR 39, 385–429 (2007)MathSciNetCrossRefGoogle Scholar
  6. 6.
    Chakravarthy, U.S., Grant, J., Minker, J.: Logic-based approach to semantic query optimization. ACM TODS 15(2), 162–207 (1990)CrossRefGoogle Scholar
  7. 7.
    Chaloupka, M., Nečaský, M.: Efficient SPARQL to SQL translation with user defined mapping. In: Ngonga Ngomo, A.-C., Křemen, P. (eds.) KESW 2016. CCIS, vol. 649, pp. 215–229. Springer, Cham (2016).  https://doi.org/10.1007/978-3-319-45880-9_17CrossRefGoogle Scholar
  8. 8.
    Chebotko, A., Lu, S., Fotouhi, F.: Semantics preserving SPARQL-to-SQL translation. DKE 68(10), 973–1000 (2009)CrossRefGoogle Scholar
  9. 9.
    Cyganiak, R.: A relational algerba for SPARQL. TR HPL-2005-170, HP Labs Bristol (2005)Google Scholar
  10. 10.
    De Giacomo, G., Lembo, D., Lenzerini, M., Poggi, A., Rosati, R.: Using ontologies for semantic data integration. In: Flesca, S., Greco, S., Masciari, E., Saccà, D. (eds.) A Comprehensive Guide Through the Italian Database Research Over the Last 25 Years. SBD, vol. 31, pp. 187–202. Springer, Cham (2018).  https://doi.org/10.1007/978-3-319-61893-7_11CrossRefGoogle Scholar
  11. 11.
    Elmasri, R., Navathe, S.: Fundamentals of Database Systems. Addison-Wesley, Boston (2010)zbMATHGoogle Scholar
  12. 12.
    Galindo-Legaria, C., Rosenthal, A.: Outerjoin simplification and reordering for query optimization. ACM TODS 22(1), 43–74 (1997)CrossRefGoogle Scholar
  13. 13.
    Guagliardo, P., Libkin, L.: A formal semantics of SQL queries, its validation, and applications. PVLDB 11(1), 27–39 (2017)Google Scholar
  14. 14.
    Kaminski, M., Kostylev, E.V.: Beyond well-designed SPARQL. In: Proceedings of ICDT (2016)Google Scholar
  15. 15.
    Kontchakov, R., Rezk, M., Rodríguez-Muro, M., Xiao, G., Zakharyaschev, M.: Answering SPARQL queries over databases under OWL 2 QL entailment regime. In: Mika, P., et al. (eds.) ISWC 2014. LNCS, vol. 8796, pp. 552–567. Springer, Cham (2014).  https://doi.org/10.1007/978-3-319-11964-9_35CrossRefGoogle Scholar
  16. 16.
    Pérez, J., Arenas, M., Gutierrez, C.: Semantics and complexity of SPARQL. ACM TODS 34(3), 16:1–16:45 (2009)CrossRefGoogle Scholar
  17. 17.
    Picalausa, F., Vansummeren, S.: What are real SPARQL queries like? In: SWIM (2011)Google Scholar
  18. 18.
    Poggi, A., Lembo, D., Calvanese, D., De Giacomo, G., Lenzerini, M., Rosati, R.: Linking data to ontologies. J. Data Semant. 10, 133–173 (2008)zbMATHGoogle Scholar
  19. 19.
    Priyatna, F., Corcho, Ó., Sequeda, J.F.: Formalisation and experiences of R2RML-based SPARQL to SQL query translation using morph. In: Proceedings of WWW, pp. 479–490 (2014)Google Scholar
  20. 20.
    Rao, J., Pirahesh, H., Zuzarte, C.: Canonical abstraction for outerjoin optimization. In: Proceedings of ACM SIGMOD, pp. 671–682 (2004)Google Scholar
  21. 21.
    Rodríguez-Muro, M., Kontchakov, R., Zakharyaschev, M.: Ontology-based data access: Ontop of databases. In: Alani, H. (ed.) ISWC 2013. LNCS, vol. 8218, pp. 558–573. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-41335-3_35CrossRefGoogle Scholar
  22. 22.
    Rodriguez-Muro, M., Rezk, M.: Efficient SPARQL-to-SQL with R2RML mappings. J. Web Semant. 33, 141–169 (2015)CrossRefGoogle Scholar
  23. 23.
    Schmidt, M., Meier, M., Lausen, G.: Foundations of SPARQL query optimization. In: Proceedings ICDT, pp. 4–33 (2010)Google Scholar
  24. 24.
    Sequeda, J.F., Arenas, M., Miranker, D.P.: OBDA: query rewriting or materialization? In practice, both!. In: Mika, P., et al. (eds.) ISWC 2014. LNCS, vol. 8796, pp. 535–551. Springer, Cham (2014).  https://doi.org/10.1007/978-3-319-11964-9_34CrossRefGoogle Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  • Guohui Xiao
    • 1
  • Roman Kontchakov
    • 2
  • Benjamin Cogrel
    • 1
  • Diego Calvanese
    • 1
  • Elena Botoeva
    • 1
  1. 1.KRDB Research CentreFree University of Bozen-BolzanoBolzanoItaly
  2. 2.Department of Computer Science and Information SystemsBirkbeck, University of LondonLondonUK

Personalised recommendations