A Bottom-Up Algorithm for Answering Context-Free Path Queries in Graph Databases

  • Fred C. Santos
  • Umberto S. Costa
  • Martin A. MusicanteEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10845)


Many computing applications require processing of data that are directly collected from the Internet. In this context, the use of the Resource Description Framework (RDF) has became a common feature. The query and analysis of RDF data is paramount to explore the full potential of the data available on the Web. Query languages for RDF graph databases rely on the use of regular expressions to identify paths over the data. Some interesting queries, such as same-generation queries, cannot be expressed by regular expressions. We are interested in extending the expressiveness of queries over graph databases by using paths defined by context-free grammars. We introduce a new query algorithm to process context-free path queries over graph databases. Our approach is inspired by the LR(1) parsing techniques. A prototype was implemented and experiments were conducted to validate and compare the results of our algorithm with those obtained by similar approaches.


Graph databases Query answering Context-free path queries 


  1. 1.
    SPARQL 1.1 overview (2013). Accessed 13 Mar 2018
  2. 2.
    PRIMER rdf 1.1 primer (2014). Accessed 8 Feb 2017
  3. 3.
    RDF - semantics web standards (2014). Accessed 8 Feb 2017
  4. 4.
    Abiteboul, S., Hull, R., Vianu, V.: Foundations of Databases. Addison-Wesley, Boston (1995)zbMATHGoogle Scholar
  5. 5.
    Aho, A.V., Lam, M.S., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison Wesley Publishing Company Incorporated, Boston (2007)zbMATHGoogle Scholar
  6. 6.
    Ancona, D., Bolz, C.F., Cuni, A., Rigo, A.: Automatic generation of JIT compilers for dynamic languages in .NET. Technical report, DISI, University of Genova and Heinrich-Heine-Universität Düsseldorf (2008)Google Scholar
  7. 7.
    Grigorev, S., Ragozina, A.: Context-free path querying with structural representation of result. In: Proceedings of the 13th Central & Eastern European Software Engineering Conference in Russia, CEE-SECR 2017, pp. 10:1–10:7. ACM, New York (2017)Google Scholar
  8. 8.
    Hellings, J.: Conjunctive context-free path queries. In: Proceedings of the 17th International Conference on Database Theory (ICDT), Athens, Greece, pp. 119–130, March 2014Google Scholar
  9. 9.
    Medeiros, C.M., Musicante, M.A., Costa, U.S.: Efficient evaluation of context-free path queries for graph databases. In: ACM SAC 2018: Symposium on Applied Computing. ACM, New York (2018). 8 pagesGoogle Scholar
  10. 10.
    Scott, E., Johnstone, A., Hussain, S.S.: Tomita-style generalised LR parsers. Technical report, December 2000Google Scholar
  11. 11.
    Tomita, M.: An efficient augmented-context-free parsing algorithm. Comput. Linguist. 13(1–2), 31–46 (1987)Google Scholar
  12. 12.
    Xia, F., Yang, L.T., Wang, L., Vinel, A.: Internet of things. Int. J. Commun. Syst. 25(9), 1101 (2012)CrossRefGoogle Scholar
  13. 13.
    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, Cham (2016). Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  • Fred C. Santos
    • 1
  • Umberto S. Costa
    • 1
  • Martin A. Musicante
    • 1
    Email author
  1. 1.Computer Science Department (DIMAp)Federal University of Rio Grande do NorteNatalBrazil

Personalised recommendations