skip to main content
research-article

Semantics and complexity of SPARQL

Published:03 September 2009Publication History
Skip Abstract Section

Abstract

SPARQL is the standard language for querying RDF data. In this article, we address systematically the formal study of the database aspects of SPARQL, concentrating in its graph pattern matching facility. We provide a compositional semantics for the core part of SPARQL, and study the complexity of the evaluation of several fragments of the language. Among other complexity results, we show that the evaluation of general SPARQL patterns is PSPACE-complete. We identify a large class of SPARQL patterns, defined by imposing a simple and natural syntactic restriction, where the query evaluation problem can be solved more efficiently. This restriction gives rise to the class of well-designed patterns. We show that the evaluation problem is coNP-complete for well-designed patterns. Moreover, we provide several rewriting rules for well-designed patterns whose application may have a considerable impact in the cost of evaluating SPARQL queries.

References

  1. Abiteboul, S., Hull, R., and Vianu, V. 1995. Foundations of Databases. Addison-Wesley. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Abiteboul, S., Kanellakis, P., and Grahne, G. 1991. On the representation and querying of sets of possible worlds. Theor. Comput. Sci. 78, 1, 158--187. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Angles, R. and Gutierrez, C. 2008. The expressive power of sparql. In Proceedings of the International Semantic Web Conference (ISWC), 114--129. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Arenas, M., Gutierrez, C., Parsia, B., Pérez, J., Polleres, A., and Seaborne, A. 2007. SPARQL—Where are we? Current state, theory and practice. Full day tutorial, European Semantic Web Conference.Google ScholarGoogle Scholar
  5. ARQ, 2006. A SPARQL processor for Jena, version 1.3 March 2006, Hewlett-Packard Development Company. http://jena.sourceforge.net/ARQ.Google ScholarGoogle Scholar
  6. Beeri, C., Fagin, R., Maier, D., and Yannakakis, M. 1983. On the desirability of acyclic database schemes. J. ACM 30, 3, 479--513. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bhargava, G., Goel, P., and Iyer, B. 1995. Hypergraph based reorderings of outer join queries with complex predicates. In Proceedings of the SIGMOD International Conference of Management of Data, 304--315. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Chandra, A. and Merlin, P. 1977. Optimal implementation of conjunctive queries in relational data bases. In Proceedings of the Symposium on the Theory of Computing (STOC), 77--90. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Chen, L., Gupta, A., and Kurul, E. 2005. A semantic-aware RDF query algebra. In Proceedings of the International Conference on Management of Data (COMAD).Google ScholarGoogle Scholar
  10. Cyganiak, R. 2005. A relational algebra for sparql. Tech. rep. HPL-2005-170, HP-Labs. http://www.hpl.hp.com/techreports/2005/HPL-2005-170.html.Google ScholarGoogle Scholar
  11. de Bruijn, J., Franconi, E., and Tessaris, S. 2005. Logical reconstruction of normative RDF. In Proceedings of the OWL—Experiences and Directions Workshop (OWLED).Google ScholarGoogle Scholar
  12. Durst, M. and Suignard, M. 2005. Rfc 3987, internationalized resource identifiers (IRIS). http://www.ietf.org/rfc/rfc3987.txt.Google ScholarGoogle Scholar
  13. Frasincar, F., Houben, G.-J., Vdovjak, R., and Barna, P. 2004. RAL: An algebra for querying RDF. World Wide Web 7, 1, 83--109. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Furche, T., Linse, B., Bry, F., Plexousakis, D., and Gottlob, G. 2006. RDF querying: Language constructs and evaluation methods compared. In Reasoning Web, 1--52.Google ScholarGoogle Scholar
  15. Galindo-Legaria, C. A. and Rosenthal, A. 1997. Outerjoin simplification and reordering for query optimization. ACM Trans. Datab. Syst. 22, 1, 43--73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Garey, M. R. and Johnson, D. S. 1979. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Gottlob, G., Leone, N., and Scarcello, F. 2001. The complexity of acyclic conjunctive queries. J. ACM 48, 3, 431--498. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Gutierrez, C., Hurtado, C. A., and Mendelzon, A. O. 2004. Foundations of semantic Web databases. In Proceedings of the ACM Symposium on Principles of Database Systems (PODS), 95--106. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Haase, P., Broekstra, J., Eberhart, A., and Volz, R. 2004. A comparison of RDF query languages. In Proceedings of the International Semantic Web Conference (ISWC), 502--517.Google ScholarGoogle Scholar
  20. Harris, S. and Shadbolt, N. 2005. SPARQL query processing with conventional relational database systems. In Proceedings of the WISE Workshops, 235--244. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Imielinski, T. and Lipski, W. 1984. Incomplete information in relational databases. J. ACM 31, 4, 761--791. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Karvounarakis, G., Alexaki, S., Christophides, V., Plexousakis, D., and Scholl, M. 2002. RQL: A declarative query language for RDF. In Proceedings of the International Conference on World Wide Web (WWW), 592--603. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Klyne, G., Carroll, J. J., and McBride, B. 2004. Resource description framework (RDF): Concepts and abstract syntax. W3C recommendation. http://www.w3.org/TR/rdf-concepts/.Google ScholarGoogle Scholar
  24. Manola, F. and Miller, E. 2004. RDF primer, W3C recommendation. http://www.w3.org/TR/rdf-concepts/.Google ScholarGoogle Scholar
  25. Marin, D. 2004. A formalization of RDF (applications de la logique á la sémantique du Web). Tech. rep., École Polytechnique, Universidad de Chile. Department of Computer Science, Universidad de Chile, TR/DCC-2006-8.Google ScholarGoogle Scholar
  26. Pérez, J., Arenas, M., and Gutierrez, C. 2006a. Semantics and complexity of SPARQL. In Proceedings of the International Semantic Web Conference (ISWC). 30--43. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Pérez, J., Arenas, M., and Gutierrez, C. 2006b. Semantics of SPARQL. Tech. rep., Universidad de Chile. Department of Computer Science, Universidad de Chile, TR/DCC-2006-17.Google ScholarGoogle Scholar
  28. Polleres, A. 2007. From SPARQL to rules (and back). In Proceedings of the International Conference on World Wide Web (WWW), 787--796. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Prud'hommeaux, E. and Seaborne, A. 2008. SPARQL query language for RDF. W3C recommendation. http://www.w3.org/TR/rdf-sparql-query/.Google ScholarGoogle Scholar
  30. Robertson, E. L. 2004. Triadic relations: An algebra for the semantic Web. In Proceedings of the International Workshop on Semantic Web and Databases (SWDB), 91--108. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Schmidt, M., Meier, M., and Lausen, G. 2008. Foundations of SPARQL query optimization. http://arxiv.org/abs/0812.3788.Google ScholarGoogle Scholar
  32. Seaborne, A. 2006. Personal communication.Google ScholarGoogle Scholar
  33. Serfiotis, G., Koffina, I., Christophides, V., and Tannen, V. 2005. Containment and minimization of RDF/S query patterns. In Proceedings of the International Semantic Web Conference (ISWC), 607--623. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Vardi, M. Y. 1982. The complexity of relational query languages (extended abstract). In Proceedings of the Symposium on the Theory of Computing (STOC), 137--146. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Yannakakis, M. 1981. Algorithms for acyclic database schemes. In Proceedings of the International Conference on Very Large Data Bases (VLDB), 82--94. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Zaniolo, C. 1984. Database relations with null values. J. Comput. Syst. Sci. 28, 1, 142--166.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Semantics and complexity of SPARQL

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM Transactions on Database Systems
      ACM Transactions on Database Systems  Volume 34, Issue 3
      August 2009
      269 pages
      ISSN:0362-5915
      EISSN:1557-4644
      DOI:10.1145/1567274
      Issue’s Table of Contents

      Copyright © 2009 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 3 September 2009
      • Accepted: 1 June 2009
      • Revised: 1 December 2008
      • Received: 1 April 2008
      Published in tods Volume 34, Issue 3

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article
      • Research
      • Refereed

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader