PIWD: A Plugin-Based Framework for Well-Designed SPARQL

  • Xiaowang Zhang
  • Zhenyu Song
  • Zhiyong FengEmail author
  • Xin Wang
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10055)


In the real world datasets (e.g., DBpedia query log), queries built on well-designed patterns containing only AND and OPT operators (for short, WDAO-patterns) account for a large proportion among all SPARQL queries. In this paper, we present a plugin-based framework for all SELECT queries built on WDAO-patterns, named PIWD. The framework is based on a parse tree called well-designed AND-OPT tree (for short, WDAO-tree) whose leaves are basic graph patterns (BGP) and inner nodes are the OPT operators. We prove that for any WDAO-pattern, its parse tree can be equivalently transformed into a WDAO-tree. Based on the proposed framework, we can employ any query engine to evaluate BGP for evaluating queries built on WDAO-patterns in a convenient way. Theoretically, we can reduce the query evaluation of WDAO-patterns to subgraph homomorphism as well as BGP since the query evaluation of BGP is equivalent to subgraph homomorphism. Finally, our preliminary experiments on gStore and RDF-3X show that PIWD can answer all queries built on WDAO-patterns effectively and efficiently.


SPARQL BGP Well-designed patterns Subgraph homomorphism 



This work is supported by the programs of the National Key Research and Development Program of China (2016YFB1000603), the National Natural Science Foundation of China (NSFC) (61502336), and the open funding project of Key Laboratory of Computer Network and Information Integration (Southeast University), Ministry of Education (K93-9-2016-05). Xiaowang Zhang is supported by Tianjin Thousand Young Talents Program and the project-sponsored by School of Computer Science and Technology in Tianjin University.


  1. 1.
    Abadi, D.J., Marcus, A., Madden, S.R., Hollenbach, K.: SW-store: a vertically partitioned DBMS for semantic web data management. VLDB J. 18(2), 385–406 (2009)CrossRefGoogle Scholar
  2. 2.
    Angles, R., Gutierrez, C.: The expressive power of SPARQL. In: Sheth, A., Staab, S., Dean, M., Paolucci, M., Maynard, D., Finin, T., Thirunarayan, K. (eds.) ISWC 2008. LNCS, vol. 5318, pp. 114–129. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-88564-1_8 CrossRefGoogle Scholar
  3. 3.
    Arenas, M., Pérez, J.: Querying semantic web data with SPARQL. In: Proceedings of SIGMOD 2011, pp. 305–316 (2011)Google Scholar
  4. 4.
    Barcelo, P., Pichler, R., Skritek, S.: Efficient evaluation and approximation of well-designed pattern trees. In: Proceedings of PODS 2015, pp. 131–144 (2015)Google Scholar
  5. 5.
    Boncz, P.A., Zukowski, M., Nes, N.J.: MonetDB/x100: Hyper-pipelining query execution. In: Proceedings of CIDR 2005 (2005)Google Scholar
  6. 6.
    Broekstra, J., Kampman, A., Harmelen, F.: Sesame: a generic architecture for storing and querying RDF and RDF schema. In: Horrocks, I., Hendler, J. (eds.) ISWC 2002. LNCS, vol. 2342, pp. 54–68. Springer, Heidelberg (2002). doi: 10.1007/3-540-48005-6_7 CrossRefGoogle Scholar
  7. 7.
    Carroll, J.J., Dickinson, I., Dollin, C., Reynolds, D., Seaborne, A., Wilkinson, K.: Jena: implementing the semantic web recommendations. In: Proceedings of WWW 2004, pp. 74–83 (2004)Google Scholar
  8. 8.
    Erling, O., Mikhailov, I.: RDF support in the virtuoso DBMS. Studies in Computational Intelligence, pp. 7–24 (2009)Google Scholar
  9. 9.
    Han, X., Feng, Z., Zhang, X., Wang, X., Rao, G.: On the statistical analysis of practical SPARQL queries. In: Proceedings of WebDB 2016, Article 2(2016)Google Scholar
  10. 10.
    Han, W.S., Lee, J., Lee, J.H.: Turbo ISO: Towards ultrafast and robust subgraph isomorphism search in large graph databases. In: Proceedings of SIGMOD 2013, pp. 337–348 (2013)Google Scholar
  11. 11.
    He, H., Singh, A.K.: Query language and access methods for graph databases. In: Aggarwal, C.C., Wang, H. (eds.) Managing and Mining Graph Data. Springer, Heidelberg (2010)Google Scholar
  12. 12.
    Letelier, A., Pérez, J., Pichler, R., Skritek, S.: Static analysis and optimization of semantic web queries. Proceedings of PODS 38(4), 84–87 (2012)MathSciNetzbMATHGoogle Scholar
  13. 13.
    Letelier, A., Pérez, J., Pichler, R., Skritek, S.: SPAM: a SPARQL analysis and manipulation tool. Proc. VLDB 5(12), 1958–1961 (2012)CrossRefGoogle Scholar
  14. 14.
    Luigi, P.C., Pasquale, F., Carlo, S., Mario, V.: A (sub)graph isomorphism algorithm for matching large graphs. IEEE Trans. Pattern Anal. Mach. Intell. 26(10), 1367–1372 (2004)CrossRefGoogle Scholar
  15. 15.
    Medha, A.: Left bit right: for SPARQL join queries with OPTIONAL patterns (left-outer-joins). In: Proceedings of SIGMOD 2015, pp. 1793–1808 (2015)Google Scholar
  16. 16.
    Neumann, T., Weikum, G.: The RDF3X engine for scalable management of RDF data. VLDB J. 19(1), 91–113 (2010)CrossRefGoogle Scholar
  17. 17.
    Peng, P., Zou, L., Özsu, M.T., Chen, L., Zhao, D.: Processing SPARQL queries over distributed RDF graphs. VLDB J. 25(2), 243–268 (2016)CrossRefGoogle Scholar
  18. 18.
    Pérez, J., Arenas, M., Gutierrez, C.: Semantics and complexity of SPARQL. ACM Trans. Database Syst. 34(3), 30–43 (2009)CrossRefGoogle Scholar
  19. 19.
    Prud’hommeaux, E., Seaborne, A.: SPARQL query language for RDF. W3C Recommendation (2008)Google Scholar
  20. 20.
    Saleem, M., Ali, M.I., Hogan, A., Mehmood, Q., Ngomo, A.-C.N.: LSQ: the linked SPARQL queries dataset. In: Arenas, M., et al. (eds.) ISWC 2015. LNCS, vol. 9367, pp. 261–269. Springer, Heidelberg (2015). doi: 10.1007/978-3-319-25010-6_15 CrossRefGoogle Scholar
  21. 21.
    Shang, H., Zhang, Y., Lin, X., Yu, J.X.: Taming verification hardness: an efficient algorithm for testing subgraph isomorphism. Proc. VLDB 1(1), 364–375 (2008)CrossRefGoogle Scholar
  22. 22.
    Song, Z., Feng, Z., Zhang, X., Wang, X., Rao, G.: Efficient approximation of well-designed SPARQL queries. In: Song, S., Tong, Y. (eds.) WAIM 2016. LNCS, vol. 9998, pp. 315–327. Springer, Heidelberg (2016). doi: 10.1007/978-3-319-47121-1_27 CrossRefGoogle Scholar
  23. 23.
    Swick, R.R.: Resource description framework (RDF) model and syntax specification. In: W3C Recommendation (1998)Google Scholar
  24. 24.
    Ullmann, J.R.: An algorithm for subgraph isomorphism. J. ACM 23(1), 31–42 (1976)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Wang, H.: Efficient subgraph matching on billion node graphs. In: Proc. of VLDB 2012, 5: article 9 (2012)Google Scholar
  26. 26.
    Weiss, C., Karras, P., Bernstein, A.: Hexastore: sextuple indexing for semantic web data management. Proc. VLDB 1, 1008–1019 (2008)CrossRefGoogle Scholar
  27. 27.
    Yuan, P., Liu, P., Wu, B., Jin, H., Zhang, W., Liu, L.: Triplebit: a fast and compact system for large scale RDF data. Proc. VLDB 6(7), 517–528 (2013)CrossRefGoogle Scholar
  28. 28.
    Zhang, X., Feng, Z., Wang, X., Rao, G., Wu, W.: Context-free path queries on RDF graphs. In: Groth, P., Simperl, E., Gray, A., Sabou, M., Krötzsch, M., Lecue, F., Flöck, F., Gil, Y. (eds.) ISWC 2016. LNCS, vol. 9981, pp. 632–648. Springer, Heidelberg (2016). doi: 10.1007/978-3-319-46523-4_38 CrossRefGoogle Scholar
  29. 29.
    Zhang, X., Van den Bussche, J.: On the power of SPARQL in expressing navigational queries. Computer J. 58(11), 2841–2851 (2015)CrossRefGoogle Scholar
  30. 30.
    Zhang, X., Van den Bussche, J.: On the primitivity of operators in SPARQL. Inf. Process. Lett. 114(9), 480–485 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  31. 31.
    Zhang, X., Van den Bussche, J.: On the satisfiability problem for SPARQL patterns. J. Artif. Intell. Res. 56, 403–428 (2016)MathSciNetzbMATHGoogle Scholar
  32. 32.
    Zhao, P., Han, J.: On graph query optimization in large networks. Proc. VLDB 3(1–2), 340–351 (2010)CrossRefGoogle Scholar
  33. 33.
    Zou, L., Mo, J., Chen, L., Özsu, M.T., Zhao, D.: gStore: answering SPARQL queries via subgraph matching. Proc. VLDB 4(8), 482–493 (2011)CrossRefGoogle Scholar
  34. 34.
    Zou, L., Özsu, M.T., Chen, L., Shen, X., Huang, R., Zhao, D.: gStore: a graph-based SPARQL query engine. VLDB J. 23(4), 565–590 (2014)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  • Xiaowang Zhang
    • 1
    • 3
    • 4
  • Zhenyu Song
    • 1
    • 3
  • Zhiyong Feng
    • 2
    • 3
    Email author
  • Xin Wang
    • 1
    • 3
  1. 1.School of Computer Science and TechnologyTianjin UniversityTianjinChina
  2. 2.School of Computer SoftwareTianjin UniversityTianjinChina
  3. 3.Tianjin Key Laboratory of Cognitive Computing and ApplicationTianjinChina
  4. 4.Key Laboratory of Computer Network and Information IntegrationSoutheast University, Ministry of EducationNanjingChina

Personalised recommendations