Journal on Data Semantics

, Volume 7, Issue 3, pp 133–154 | Cite as

SPARQL Query Containment Under Schema

  • Melisachew Wudage Chekol
  • Jérôme Euzenat
  • Pierre Genevès
  • Nabil Layaïda
Original Article


Query containment is defined as the problem of determining if the result of a query is included in the result of another query for any dataset. It has major applications in query optimization and knowledge base verification. To date, testing query containment has been performed using different techniques: containment mapping, canonical databases, automata theory techniques and through a reduction to the validity problem in logic. Here, we use the latter technique to test containment of SPARQL queries using an expressive modal logic called \(\mu \)-calculus. For that purpose, we define an RDF graph encoding as a transition system which preserves its characteristics. In addition, queries and schema axioms are encoded as \(\mu \)-calculus formulae. Thereby, query containment can be reduced to testing validity in the logic. We identify various fragments of SPARQL and description logic schema languages for which containment is decidable. Additionally, we provide theoretically and experimentally proven procedures to check containment of these decidable fragments. Finally, we propose a benchmark for containment solvers which is used to test and compare the current state-of-the-art containment solvers.


SPARQL Query containment \(\mu \)-calculus 



This research was partially supported by the ANR project CLEAR (ANR-16-CE25-0010).


  1. 1.
    Abiteboul S, Hull R, Vianu V (1995) Foundations of databases, vol 8. Addison-Wesley, BostonzbMATHGoogle Scholar
  2. 2.
    Aho AV, Sagiv Y, Ullman JD (1979) Equivalences among relational expressions. SIAM J Comput 8(2):218–246MathSciNetCrossRefzbMATHGoogle Scholar
  3. 3.
    Alkhateeb F, Baget JF, Euzenat J (2009) Extending SPARQL with regular expression patterns (for querying RDF). Web Semant Sci Serv Agents World Wide Web 7(2):57–73CrossRefGoogle Scholar
  4. 4.
    Angles R, Gutierrez C (2008) The expressive power of SPARQL. In: Proceedings of ISWC. Springer, pp 114–129Google Scholar
  5. 5.
    Baader F, Calvanese D, McGuinness D, Nardi D, Patel-Schneider P (eds) (2007) The description logic handbook: theory, implementation, and applications. Cambridge University Press, Cambridge. ISBN 9780511717383Google Scholar
  6. 6.
    Baget JF (2005) RDF entailment as a graph homomorphism. Semant Web-ISWC 2005:82–96Google Scholar
  7. 7.
    Barcelo P, Libkin L, Lin AW, Wood PT (2012) Expressive languages for path queries over graph-structured data. ACM Trans Database Syst 37:31CrossRefGoogle Scholar
  8. 8.
    Bizer C, Schultz A (2008) Benchmarking the performance of storage systems that expose SPARQL endpoints. In: Proceedings of 4th international workshop on scalable semantic web knowledge base systems (SSWS)Google Scholar
  9. 9.
    Bizer C, Schultz A (2009) The Berlin SPARQL benchmark. Int J Semant Web Inf Syst 5(2):1–24CrossRefGoogle Scholar
  10. 10.
    Blackburn P, van Benthem JF, Wolter F (2007) Handbook of modal logic, vol 3. Elsevier, New YorkzbMATHGoogle Scholar
  11. 11.
    Calvanese D, De Giacomo G, Lenzerini M, Vardi MY (2000) Containment of conjunctive regular path queries with inverse. In: Proceedings of 7th international conference on the principles of knowledge representation and reasoning (KR 2000), pp 176–185Google Scholar
  12. 12.
    Calvanese D, De Giacomo G, Lenzerini M, Vardi MY (2003) Reasoning on regular path queries. SIGMOD Rec 32(4):83–92CrossRefGoogle Scholar
  13. 13.
    Calvanese D, Giacomo GD, Lenzerini M (2008) Conjunctive query containment and answering under description logic constraints. ACM Trans Comput Log 9(3):22MathSciNetCrossRefzbMATHGoogle Scholar
  14. 14.
    Calvanese D, Ortiz M, Simkus M (2011) Containment of regular path queries under description logic constraints. In: IJCAI proceedings-international joint conference on artificial intelligence, vol 22, p 805Google Scholar
  15. 15.
    Calvanese D, Rosati R (2003) Answering recursive queries under keys and foreign keys is undecidable. In: Proceedings of 10th international workshop on knowledge representation meets databases (KRDB 2003), vol 79, pp 3–14Google Scholar
  16. 16.
    Chandra AK, Merlin PM (1977) Optimal implementation of conjunctive queries in relational data bases. In: Proceedings of the ninth annual ACM symposium on theory of computing. ACM, pp 77–90Google Scholar
  17. 17.
    Chebotko A, Lu S, Jamil HM, Fotouhi F (2006) Semantics preserving SPARQL-to-SQL query translation for optional graph patterns. Technical reportGoogle Scholar
  18. 18.
    Chekol MW (2012) Static analysis of semantic web queries. Ph.D. thesis, Université de Grenoble. ThesisGoogle Scholar
  19. 19.
    Chekol MW (2016) On the containment of SPARQL queries under entailment regimes. In: Proceedings of the thirtieth AAAI conference on artificial intelligence, February 12–17, 2016, Phoenix, Arizona, USA, pp 936–942Google Scholar
  20. 20.
    Chekol MW, Euzenat J, Genevès P, Layaïda N (2011) PSPARQL query containment. In: Proceedings of DBPLGoogle Scholar
  21. 21.
    Chekol MW, Euzenat J, Genevès P, Layaïda N (2012) SPARQL query containment under RDFS entailment regime. In: Proceedings of IJCAR, pp 134–148Google Scholar
  22. 22.
    Chekol MW, Euzenat J, Genevès P, Layaïda N (2012) SPARQL query containment under SHI axioms. In: Proceedings of AAAI, pp 10–16Google Scholar
  23. 23.
    Chekol MW, Euzenat J, Genevès P, Layaïda N (2013) Evaluating and benchmarking SPARQL query containment solvers. Int Semant Web Conf 2:408–423zbMATHGoogle Scholar
  24. 24.
    Cyganiak R (2005) A relational algebra for SPARQL. Digital Media Systems Laboratory HP Laboratories Bristol. HPL-2005-170, p 35Google Scholar
  25. 25.
    Florescu D, Levy A, Suciu D (1998) Query containment for conjunctive queries with regular expressions. In: Proceedings of the seventeenth ACM SIGACT-SIGMOD-SIGART symposium on principles of database systems. ACM, pp 139–148Google Scholar
  26. 26.
    Genevès P, Layaïda N (2006) A system for the static analysis of XPath. ACM Trans Inf Syst 24(4):475–502CrossRefGoogle Scholar
  27. 27.
    Genevès P, Layaïda N, Schmitt A (2007) Efficient static analysis of XML paths and types. In: Proceedings of PLDI. ACM, pp 342–351Google Scholar
  28. 28.
    Glimm B (2011) Using SPARQL with RDFS and OWL entailment. In: Polleres A et al (eds) Reasoning web. Semantic technologies for the web of data. Springer, Berlin, pp 137–201CrossRefGoogle Scholar
  29. 29.
    Groppe J, Groppe S, Kolbaum J (2009) Optimization of SPARQL by using coreSPARQL. In: Proceedings of ICEIS, pp 107–112Google Scholar
  30. 30.
    Gutierrez C, Hurtado C, Mendelzon AO (2004) Foundations of semantic web databases. In: Proceedings of the twenty-third ACM SIGMOD-SIGACT-SIGART symposium on principles of database systems. ACM, pp 95–106Google Scholar
  31. 31.
    Hayes P (2004) RDF semantics. W3C RecommendationGoogle Scholar
  32. 32.
    Hitzler P, Krötzsch M, Parsia B, Patel-Schneider PF, Rudolph S (2009) OWL 2 web ontology language primer. W3C Recommendation 27(1)Google Scholar
  33. 33.
    Ioannidis YE, Ramakrishnan R (1995) Containment of conjunctive queries: beyond relations as sets. ACM Trans Database Syst 20(3):288–324CrossRefGoogle Scholar
  34. 34.
    Johnson DS, Klug A (1984) Testing containment of conjunctive queries under functional and inclusion dependencies. J Comput Syst Sci 28(1):167–189MathSciNetCrossRefzbMATHGoogle Scholar
  35. 35.
    Kostylev EV, Cuenca Grau B (2014) On the semantics of SPARQL queries with optional matching under entailment regimes. In: The semantic web ISWC 2014. Lecture notes in computer science, vol 8797. Springer, pp 374–389Google Scholar
  36. 36.
    Kostylev EV, Reutter JL, Romero M, Vrgoč D (2015) SPARQL with property paths. In: International semantic web conference. Springer, pp 3–18Google Scholar
  37. 37.
    Kozen D (1983) Results on the propositional \(\mu \)-calculus. Theor Comput Sci 27(3):333–354MathSciNetCrossRefzbMATHGoogle Scholar
  38. 38.
    Letelier A, Pérez J, Pichler R, Skritek S (2012) Static analysis and optimization of semantic web queries. In: Proceedings of PODS. ACM, pp. 89–100Google Scholar
  39. 39.
    Manola F, Miller E (2004) Resource description framework primer. W3C recommendationGoogle Scholar
  40. 40.
    Mateescu R, Meriot S, Rampacek S (2009) Extending SPARQL with temporal logic. INRIA Research Report, RR-7056.
  41. 41.
    Munoz S, Pérez J, Gutierrez C (2007) Minimal deductive systems for RDF. In: Franconi E, Kifer M, May W (eds) The semantic web: research and applications, vol 4519. Springer, Berlin, pp 53–67CrossRefGoogle Scholar
  42. 42.
    Pérez J, Arenas M, Gutierrez C (2009) Semantics and complexity of SPARQL. ACM Trans Database Syst 34(3):16CrossRefGoogle Scholar
  43. 43.
    Pichler R, Skritek S (2014) Containment and equivalence of well-designed SPARQL. In: Proceedings of the 33rd ACM SIGMOD-SIGACT-SIGART symposium on principles of database systems, ACM, pp 39–50Google Scholar
  44. 44.
    Polleres A (2007) From SPARQL to rules (and back). In: Proceedings of the 16th international conference on World Wide Web. ACM, pp 787–796Google Scholar
  45. 45.
    PrudHommeaux E, Seaborne A (2008) SPARQL query language for RDF. W3C recommendation 15Google Scholar
  46. 46.
    Schmidt M, Hornung T, Lausen G, Pinkel C (2009) SP\(^2\)Bench: a SPARQL performance benchmark. In: Proceedings of ICDE, pp 222–233Google Scholar
  47. 47.
    Schmidt M, Meier M, Lausen G (2010) Foundations of SPARQL query optimization. In: Proceedings of ICDT. ACM, pp 4–33Google Scholar
  48. 48.
    Serfiotis G, Koffina I, Christophides V, Tannen V (2005) Containment and minimization of RDF/S query patterns. In: Gil Y, Motta E, Benjamins VR, Musen MA (eds) The semantic web–ISWC 2005. LNCS, vol 3729. Springer, Berlin, pp 607–623CrossRefGoogle Scholar
  49. 49.
    Stocker M, Seaborne A, Bernstein A, Kiefer C, Reynolds D (2008) SPARQL basic graph pattern optimization using selectivity estimation. In: Proceedings of WWW conference, pp 595–604Google Scholar
  50. 50.
    Tanabe Y, Takahashi K, Hagiya M (2008) A decision procedure for alternation-free modal \(\mu \)-calculi. Adv Modal Logic 7:341–362MathSciNetzbMATHGoogle Scholar
  51. 51.
    Tanabe Y, Takahashi K, Yamamoto M, Tozawa A, Hagiya M (2005) A decision procedure for the alternation-free two-way modal \(\mu \)-calculus. In: TABLEAUX, pp 277–291Google Scholar

Copyright information

© Springer-Verlag GmbH Germany, part of Springer Nature 2018

Authors and Affiliations

  • Melisachew Wudage Chekol
    • 1
  • Jérôme Euzenat
    • 2
  • Pierre Genevès
    • 2
  • Nabil Layaïda
    • 2
  1. 1.Data and Web Science Group, University of MannheimMannheimGermany
  2. 2.Univ. Grenoble Alpes, Inria, CNRS, Grenoble INP, LIGGrenobleFrance

Personalised recommendations