Querying APIs with SPARQL: Language and Worst-Case Optimal Algorithms

  • Matthieu Mosser
  • Fernando Pieressa
  • Juan Reutter
  • Adrián SotoEmail author
  • Domagoj Vrgoč
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10843)


Although the amount of RDF data has been steadily increasing over the years, the majority of information on the Web is still residing in other formats, and is often not accessible to Semantic Web services. A lot of this data is available through APIs serving JSON documents. In this work we propose a way of extending SPARQL with the option to consume JSON APIs and integrate the obtained information into SPARQL query answers, thus obtaining a query language allowing to bring data from the “traditional” Web to the Semantic Web. Looking to evaluate these queries as efficiently as possible, we show that the main bottleneck is the amount of API requests, and present an algorithm that produces “worst-case optimal” query plans that reduce the number of requests as much as possible. We also do a set of experiments that empirically confirm the optimality of our approach.



Work funded by the Millennium Nucleus Center for Semantic Web Research under Grant NC120004.


  1. 1.
  2. 2.
    Online demo of SERVICE-to-API.
  3. 3.
    SERVICE-to-API implementation.
  4. 4.
    Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison-Wesley, Boston (1995)zbMATHGoogle Scholar
  5. 5.
    Buil-Aranda, C., Arenas, M., Corcho, O.: Semantics and optimization of the SPARQL 1.1 federation extension. In: Antoniou, G., Grobelnik, M., Simperl, E., Parsia, B., Plexousakis, D., De Leenheer, P., Pan, J. (eds.) ESWC 2011. LNCS, vol. 6644, pp. 1–15. Springer, Heidelberg (2011). Scholar
  6. 6.
    Aranda, C.B., Arenas, M., Corcho, Ó., Polleres, A.: Federating queries in SPARQL 1.1: syntax, semantics and evaluation. J. Web Sem. 18(1), 1–17 (2013)CrossRefGoogle Scholar
  7. 7.
    Buil-Aranda, C., Polleres, A., Umbrich, J.: Strategies for executing federated queries in SPARQL1.1. In: Mika, P., et al. (eds.) ISWC 2014. LNCS, vol. 8797, pp. 390–405. Springer, Cham (2014). Scholar
  8. 8.
    Atserias, A., Grohe, M., Marx, D.: Size bounds and query plans for relational joins. SIAM J. Comput. 42(4), 1737–1767 (2013)MathSciNetCrossRefGoogle Scholar
  9. 9.
    Battle, R., Benson, E.: Bridging the semantic web and web 2.0 with representational state transfer (REST). J. Web Sem. 6(1), 61–69 (2008)CrossRefGoogle Scholar
  10. 10.
    Benedikt, M., Leblay, J., Tsamoura, E.: Querying with access patterns and integrity constraints. PVLDB 8(6), 690–701 (2015)Google Scholar
  11. 11.
    Bizer, C., Schultz, A.: The Berlin SPARQL benchmark. Int. J. Semant. Web Inf. Syst. 5(2), 1–24 (2009)CrossRefGoogle Scholar
  12. 12.
    Bonifati, A., Martens, W., Timm, T.: An analytical study of large SPARQL query logs. CoRR, abs/1708.00363 (2017)CrossRefGoogle Scholar
  13. 13.
    Calì, A., Martinenghi, D.: Querying data under access limitations. In: ICDE 2008, pp. 50–59 (2008)Google Scholar
  14. 14.
    Dimou, A., Sande, M.V., Colpaert, P., Verborgh, R., Mannens, E., de Walle, R.V.: RML: A generic language for integrated RDF mappings of heterogeneous data. In: LDOW (2014)Google Scholar
  15. 15.
    Fafalios, P., Tzitzikas, Y.: SPARQL-LD: a SPARQL extension for fetching and querying linked data. In: ISWC Demos (2015)Google Scholar
  16. 16.
    Fafalios, P., Yannakis, T., Tzitzikas, Y.: Querying the web of data with SPARQL-LD. In: Fuhr, N., Kovács, L., Risse, T., Nejdl, W. (eds.) TPDL 2016. LNCS, vol. 9819, pp. 175–187. Springer, Cham (2016). Scholar
  17. 17.
    Galiegue, F., Zyp, K.: JSON schema: core definitions and terminology. Internet Eng. Task Force (IETF) (2013)Google Scholar
  18. 18.
    Gottlob, G., Lee, S.T., Valiant, G., Valiant, P.: Size and treewidth bounds for conjunctive queries. J. ACM 59(3), 16:1–16:35 (2012)MathSciNetCrossRefGoogle Scholar
  19. 19.
    Grohe, M.: Bounds and algorithms for joins via fractional edge covers. In: Tannen, V., Wong, L., Libkin, L., Fan, W., Tan, W.-C., Fourman, M. (eds.) In Search of Elegance in the Theory and Practice of Computation. LNCS, vol. 8000, pp. 321–338. Springer, Heidelberg (2013). Scholar
  20. 20.
    Harris, S., Seaborne, A.: SPARQL 1.1 query language. W3C (2013)Google Scholar
  21. 21.
    IETF: URI Template (2012).
  22. 22.
    Junemann, M., Reutter, J.L., Soto, A., Vrgoč, D.: Incorporating API data into SPARQL query answers. In: ISWC 2016 Posters and Demos (2016)Google Scholar
  23. 23.
    Kobayashi, N., Ishii, M., Takahashi, S., Mochizuki, Y., Matsushima, A., Toyoda, T.: Semantic-JSON. Nucleic Acids Res. 39, 533–540 (2011)CrossRefGoogle Scholar
  24. 24.
    Montoya, G., Vidal, M., Acosta, M.: A heuristic-based approach for planning federated SPARQL queries. In: COLD 2012 (2012)Google Scholar
  25. 25.
    Montoya, G., Vidal, M.-E., Corcho, O., Ruckhaus, E., Buil-Aranda, C.: Benchmarking federated SPARQL query engines: are existing testbeds enough? In: Cudré-Mauroux, P., et al. (eds.) ISWC 2012. LNCS, vol. 7650, pp. 313–324. Springer, Heidelberg (2012). Scholar
  26. 26.
    Müller, H., Cabral, L., Morshed, A., Shu, Y.: From restful to SPARQL: a case study on generating semantic sensor data. In: ISWC 2013, pp. 51–66 (2013)Google Scholar
  27. 27.
    Ngo, H.Q., Porat, E., Ré, C., Rudra, A.: Worst-case optimal join algorithms. In: PODS 2012, pp. 37–48 (2012)Google Scholar
  28. 28.
    Pérez, J., Arenas, M., Gutierrez, C.: nSPARQL: a navigational language for RDF. J. Web Sem. 8(4), 255–270 (2010)CrossRefGoogle Scholar
  29. 29.
    Pezoa, F., Reutter, J.L., Suarez, F., Ugarte, M., Vrgoč, D.: Foundations of JSON Schema. In: WWW 2016, pp. 263–273 (2016)Google Scholar
  30. 30.
    Prud’hommeaux, E., Buil-Aranda, C.: SPARQL 1.1 Federated Query. W3C Recommendation, 21, 113 (2013)Google Scholar
  31. 31.
    Rietveld, L., Hoekstra, R.: YASGUI: not just another SPARQL client. In: Cimiano, P., Fernández, M., Lopez, V., Schlobach, S., Völker, J. (eds.) ESWC 2013. LNCS, vol. 7955, pp. 78–86. Springer, Heidelberg (2013). Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Pontificia Universidad Católica de ChileSantiagoChile

Personalised recommendations