Formalising openCypher Graph Queries in Relational Algebra

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10509)


Graph database systems are increasingly adapted for storing and processing heterogeneous network-like datasets. However, due to the novelty of such systems, no standard data model or query language has yet emerged. Consequently, migrating datasets or applications even between related technologies often requires a large amount of manual work or ad-hoc solutions, thus subjecting the users to the possibility of vendor lock-in. To avoid this threat, vendors are working on supporting existing standard languages (e.g. SQL) or standardising languages.

In this paper, we present a formal specification for openCypher, a high-level declarative graph query language with an ongoing standardisation effort. We introduce relational graph algebra, which extends relational operators by adapting graph-specific operators and define a mapping from core openCypher constructs to this algebra. We propose an algorithm that allows systematic compilation of openCypher queries.



Gábor Szárnyas and Dániel Varró were supported by the MTA-BME Lendület Research Group on Cyber-Physical Systems and the NSERC RGPIN-04573-16 project. The authors would like to thank Gábor Bergmann and János Maginecz for their comments on the draft of this paper.


  1. 1.
    Arendt, T., Biermann, E., Jurack, S., Krause, C., Taentzer, G.: Henshin: advanced concepts and tools for in-place EMF model transformations. In: Petriu, D.C., Rouquette, N., Haugen, Ø. (eds.) MODELS 2010. LNCS, vol. 6394, pp. 121–135. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-16145-2_9 CrossRefGoogle Scholar
  2. 2.
    Bergmann, G., Horváth, Á., Ráth, I., Varró, D., Balogh, A., Balogh, Z., Ökrös, A.: Incremental evaluation of model queries over EMF Models. In: Petriu, D.C., Rouquette, N., Haugen, Ø. (eds.) MODELS 2010. LNCS, vol. 6394, pp. 76–90. Springer, Heidelberg (2010). doi: 10.1007/978-3-642-16145-2_6 CrossRefGoogle Scholar
  3. 3.
    Botoeva, E., et al.: OBDA beyond relational DBs: a study for MongoDB. In: Proceedings of the 29th International Workshop on Description Logics (2016)Google Scholar
  4. 4.
    Elmasri, R., Navathe, S.B.: Fundamentals of Database Systems, 3rd edn. Addison-Wesley-Longman, Boston (2000)zbMATHGoogle Scholar
  5. 5.
    Erling, O., et al.: The LDBC social network benchmark: interactive workload. In: SIGMOD, pp. 619–630 (2015)Google Scholar
  6. 6.
    Garcia-Molina, H., Ullman, J.D., Widom, J.: Database Systems - The Complete Book, 2nd edn. Pearson Education, Harlow (2009)Google Scholar
  7. 7.
    Hölsch, J., Grossniklaus, M.: An algebra and equivalences to transform graph patterns in Neo4j. In: GraphQ at EDBT/ICDT (2016)Google Scholar
  8. 8.
    Junghanns, M., et al.: Cypher-based graph pattern matching in GRADOOP. In: GRADES at SIGMOD (2017)Google Scholar
  9. 9.
    Kolovos, D.S., Paige, R.F., Polack, F.A.C.: The epsilon transformation language. In: Vallecillo, A., Gray, J., Pierantonio, A. (eds.) ICMT 2008. LNCS, vol. 5063, pp. 46–60. Springer, Heidelberg (2008). doi: 10.1007/978-3-540-69927-9_4 CrossRefGoogle Scholar
  10. 10.
    Krause, C., Johannsen, D., Deeb, R., Sattler, K.-U., Knacker, D., Niadzelka, A.: An SQL-based query language and engine for graph pattern matching. In: Echahed, R., Minas, M. (eds.) ICGT 2016. LNCS, vol. 9761, pp. 153–169. Springer, Cham (2016). doi: 10.1007/978-3-319-40530-8_10 CrossRefGoogle Scholar
  11. 11.
    Li, C., Chang, K.C., Ilyas, I.F., Song, S.: RankSQL: query algebra and optimization for relational top-k queries. In: SIGMOD, pp. 131–142 (2005)Google Scholar
  12. 12.
    Libkin, L., et al.: Querying graphs with data. J. ACM 63(2), 14:1–14:53 (2016)MathSciNetCrossRefGoogle Scholar
  13. 13.
    Neo Technology. openCypher project (2017).
  14. 14.
    Pérez, J., et al.: Semantics and complexity of SPARQL. ACM TODS 34(3), 1–45 (2009)CrossRefGoogle Scholar
  15. 15.
    Rodriguez, M.A.: A collectively generated model of the world. In: Collective Intelligence: Creating a Prosperous World at Peace, pp. 261–264 (2008)Google Scholar
  16. 16.
    Rodriguez, M.A.: The gremlin graph traversal machine and language (invited talk). In: DBPL, pp. 1–10 (2015)Google Scholar
  17. 17.
    Rodriguez, M.A., Neubauer, P.: The graph traversal pattern. In: Graph Data Management: Techniques and Applications, pp. 29–46 (2011)Google Scholar
  18. 18.
    Rudolf, M., et al.: The graph story of the SAP HANA database. In: BTW (2013)Google Scholar
  19. 19.
    Sakr, S., Elnikety, S., He, Y.: G-SPARQL: a hybrid engine for querying large attributed graphs. In: CIKM, pp. 335–344 (2012)Google Scholar
  20. 20.
    Szárnyas, G., Izsó, B., Ráth, I., Harmath, D., Bergmann, G., Varró, D.: IncQuery-D: a distributed incremental model query framework in the cloud. In: Dingel, J., Schulte, W., Ramos, I., Abrahão, S., Insfran, E. (eds.) MODELS 2014. LNCS, vol. 8767, pp. 653–669. Springer, Cham (2014). doi: 10.1007/978-3-319-11653-2_40 Google Scholar
  21. 21.
    Szárnyas, G., et al.: The train benchmark: cross-technology performance evaluation of continuous model validation. Softw. Syst. Model. 1–29 (2017)Google Scholar
  22. 22.
    Szárnyas, G., Maginecz, J., Varró, D.: Evaluation of optimization strategies for incremental graph queries. Periodica Polytechnica, EECS (2017)Google Scholar
  23. 23.
    Szárnyas, G., Marton, J.: Formalisation of openCypher queries in relational algebra. Technical report, Budapest University of Technology and Economics (2017).
  24. 24.
    W3C. Resource Description Framework (2014).

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.Database LaboratoryBudapest University of Technology and EconomicsBudapestHungary
  2. 2.Fault Tolerant Systems Research Group, MTA-BME Lendület Research Group on Cyber-Physical SystemsBudapest University of Technology and EconomicsBudapestHungary
  3. 3.Department of Electrical and Computer EngineeringMcGill UniversityMontrealCanada

Personalised recommendations