Compiling SHACL Into SQL
Pages 59 - 77
Abstract
Constraints on graph data expressed in the Shapes Constraint Language (SHACL) can be quite complex. This brings the challenge of efficient validation of complex SHACL constraints on graph data. This challenge is remarkably similar to the processing of analytical queries, investigated intensively in the database community. Motivated by this observation, we have devised an efficient compilation technique from SHACL into SQL, under a natural relational representation of RDF graphs. Our conclusion is that the powerful processing and optimization techniques, already offered by modern SQL engines, are more than up to the challenge.
References
[1]
Abbas A, Genevès P, Roisin C, and Layaïda N Mikkonen T, Klamma R, and Hernández J Selectivity Estimation for SPARQL Triple Patterns with Shape Expressions Web Engineering 2018 Cham Springer 195-209
[2]
Ahlstrøm Jakobsen, K., Andersen, A., Hose, K., Bach Pedersen, T.: Optimizing RDF data cubes for efficient processing of analytical queries. In: Hartig, O., Sequeda, J., et al. (eds.) Proceedings 6th International Workshop on Consuming Linked Data. CEUR Workshop Proceedings, vol. 1426 (2015)
[3]
Ahmetaj, S., David, R., Ortiz, M., Polleres, A., Shehu, B., Simkus, M.: Reasoning about explanations for non-validation in SHACL. In: Bienvenu, M., Lakemeyer, G., et al. (eds.) Proceedings 18th International Conference on Principles of Knowledge Representation and Reasoning, pp. 12–21. IJCAI Organization (2021)
[4]
Ahmetaj, S., David, R., Polleres, A., Simkus, M.: Reparing SHACL constraint violations using answer set programming. In: Sattler, U., et al. (eds.) Proceedings 21st International Semantic Web Conference. LNCS, vol. 13489, pp. 375–391. Springer (2022)
[5]
Ahmetaj S, Löhnert B, Ortiz M, and Simkus M Magic shapes for SHACL validation Proc. VLDB Endowment 2022 15 10 2284-2296
[6]
Ahmetaj, S., Ortiz, M., Oudshoorn, A., Simkus, M.: Reconciling SHACL and ontologies: Semantics and validation via rewriting. In: Gal, K., Nowé, A., et al. (eds.) Proceedings 26th European Conference on Artificial Intelligence. Frontiers in Artificial Intelligence and Applications, vol. 372, pp. 27–35. IOS Press (2023)
[7]
Andreşel, M., Corman, J., Ortiz, M., Reutter, J., Savkovic, O., Simkus, M.: Stable model semantics for recursive SHACL. In: Huang, Y., King, I., Liu, T.Y., van Steen, M. (eds.) Proceedings WWW’20, pp. 1570–1580. ACM (2020)
[8]
Arroyuelo, D., Hogan, A., Navarro, G., Rojas-Ledesma, J.: Time- and space-efficient regular path queries. In: Proceedings 38th International Conference on Data Engineering, pp. 3091–3105. IEEE (2022)
[9]
Bahadur Thapa, R., Giese, M.: Optimizing SPARQL queries with SHACL. In: Payne, T., Presutti, V., Qi, G., et al. (eds.) Proceedings 22nd International Semantic Web Conference. LNCS, vol. 14265, pp. 41–60. Springer (2023)
[10]
Bogaerts, B., Jakubowski, M.: Fixpoint semantics for recursive SHACL. In: Formisano, A., Liu, Y., et al. (eds.) Proceedings 37th International Conference on Logic Programming (Technical Communications). Electronic Proceedings in Theoretical Computer Science, vol. 345, pp. 41–47 (2021)
[11]
Boncz P, Erling O, and Pham M-D Auer S, Bryl V, and Tramp S Advances in large-scale RDF data management Linked Open Data – Creating Knowledge Out of Interlinked Data 2014 Cham Springer 21-44
[12]
Boncz P, Kersten M, and Manegold S Breaking the memory wall in MonetDB Commun. ACM 2008 51 12 77-85
[13]
Boncz, P., Zukowski, M., Nes, N.: MonetDB/X100: Hyper-pipelining query execution. In: Proceedings 2nd Biennial Conference on Innovative Data Systems Research, pp. 225–237. www.cidrdb.org (2005)
[14]
Boneva I, Labra Gayo JE, and Prud’hommeaux EG d’Amato C, Fernandez M, Tamma V, Lecue F, Cudré-Mauroux P, Sequeda J, Lange C, and Heflin J Semantics and validation of shapes schemas for RDF The Semantic Web – ISWC 2017 2017 Cham Springer 104-120
[15]
Chmurovic, A., Simkus, M.: Well-founded semantics for recursive SHACL. In: Alviano, M., Pieris, A. (eds.) Datalog 2.0 2022: Fourth International Workshop on the Resurgence of Datalog in Academia and Industry. CEUR Workshop Proceedings, vol. 3203, pp. 2–13 (2022)
[16]
Corman, J., Florenzano, F., Reutter, J., Savkovic, O.: Validating SHACL constraints over a SPARQL endpoint. In: Ghidini et al. [30], pp. 145–163
[17]
Corman J, Reutter JL, and Savković O Vrandečić D, Bontcheva K, Suárez-Figueroa MC, Presutti V, Celino I, Sabou M, Kaffee L-A, and Simperl E Semantics and validation of recursive SHACL The Semantic Web – ISWC 2018 2018 Cham Springer 318-336
[18]
DBLP data in RDF. http://dblp.org/rdf/
[19]
De Leo, D., Boncz, P.: Extending SQL for computing shortest paths. In: Boncz, P., Larriba-Pey, J. (eds.) Proceedings 5th International Workshop on Graph Data management Experiences & Systems, pp. 10:1–10:8. ACM (2017)
[20]
Dedecker, R., Slabbinck, W., Wright, J., et al.: What’s in a Pod? a knowledge graph interpretation for the Solid ecosystem. In: Saleem, M., et al. (eds.) Proceedings 6th Workshop on Storing, Querying and Benchmarking Knowledge Graphs. CEUR Workshop Proceedings, vol. 3279, pp. 81–96 (2022)
[21]
Delva, T., Dimou, A., Jakubowski, M., Van den Bussche, J.: Data provenance for SHACL. In: Stoyanovich, J., Teubner, J., et al. (eds.) Proceedings 26th International Conference on Extending Database Technology, pp. 285–297. OpenProceedings.org (2023)
[22]
Eich M, Fender P, and Moerkotte G Efficient generation of query plans containing group-by, join, and groupjoin VLDB J. 2018 27 5 617-641
[23]
Erling, O.: Implementing a SPARQL-compliant RDF triple store using a SQL-ORDBMS. https://vos.openlinksw.com/owiki/wiki/VOS/VOSRDFWP. Accessed 8 Apr 2024
[24]
Erling O Virtuoso, a hybrid RDBMS/graph column store IEEE Data Eng. Bull. 2012 35 1 3-8
[25]
Erling, O., Mikhailov, I.: RDF support in the Virtuoso RDBMS. In: Auer, S., Bizer, C., Müller, C., Zhdanova, A. (eds.) Proceedings 1st Conference on Social Semantic Web. Lecture Notes in Informatics, vol. P-113, pp. 59–68. GI (2007)
[26]
Fent P and Neumann T A practical approach to groupjoin and nested aggregates Proc. VLDB Endowment 2021 14 11 2383-2396
[27]
Figuera, M., Rohde, P., Vidal, M.E.: Trav-SHACL: efficiently validating networks of SHACL constraints. In: Leskovec, J., et al. (eds.) Proceedings WWW 2021, pp. 3337–3348. ACM (2021)
[28]
Ganski R and Wong H Optimization of nested SQL queries revisited SIGMOD Record 1987 16 3 23-33
[29]
Gayo, J., Prud’hommeaux, E., Boneva, I., Kontokostas, D.: Validating RDF data. Synthesis Lectures on the Semantic Web: Theory and Technology 16 (2018)
[30]
Ghidini, C., Hartig, O., Maleshkova, M., Svátek, V., et al. (eds.): Proceedings 18th International Semantic Web Conference. LNCS, vol. 11778. Springer (2019)
[31]
Gray, J., et al.: Data cube: A relational aggregation operator generalizing group-by, cross-tab, and sub totals. Data Mining Knowl. Discovery 1(1), 29–53 (1007)
[32]
Harris, S., Seaborne, A.: SPARQL 1.1 query language. W3C Recommendation, March 2013
[33]
Hogan, A., Riveros, C., Rojas, C., Soto, A.: A worst-case optimal join algorithm for SPARQL. In: Ghidini et al. [30], pp. 258–275
[34]
Ibragimov D, Hose K, Pedersen TB, and Zimányi E Gandon F, Sabou M, Sack H, d’Amato C, Cudré-Mauroux P, and Zimmermann A Processing aggregate queries in a federation of SPARQL endpoints The Semantic Web. Latest Advances and New Domains 2015 Cham Springer 269-285
[35]
Kemper, A., Neumann, T.: HyPer: a hybrid OLTP &OLAP main memory database system based on virtual memory snapshots. In: Proceedings 27th International Conference on Data Engineering, pp. 195–206. IEEE Computer Society (2011)
[36]
Kersten T, Leis V, et al. Everything you always wanted to know about compiled and vectorized queries but were afraid to ask Proc. VLDB Endowment 2018 11 13 2209-2222
[37]
Knublauch, H., Kontokostas, D.: Shapes constraint language (SHACL). W3C Recommendation, July 2017
[38]
Kohn A, Leis V, and Neumann T Tidy tuples and flying start: fast compilation and fast execution of relational queries in Umbra VLDB J. 2021 30 5 883-905
[39]
Labra Gayo, J.: Creating knowledge graph subsets using shape expressions. arXiv:2110.11709 (Oct 2021)
[40]
Leinberger M, Seifer P, Rienstra T, Lämmel R, and Staab S Pan JZ, Tamma V, d’Amato C, Janowicz K, Fu B, Polleres A, Seneviratne O, and Kagal L Deciding SHACL shape containment through description logics reasoning The Semantic Web – ISWC 2020 2020 Cham Springer 366-383
[41]
Lieber, S., Dimou, A., Verborgh, R.: Statistics about data shape use in RDF. In: Taylor, K., et al. (eds.) Proceedings of the ISWC 2020 Demos and Industry Tracks: From Novel Ideas to Industrial Practice, vol. 2721. CEUR Workshop Proceedings (2020)
[42]
Moerkotte G and Neumann T Accelerating queries with group-by and join by groupjoin Proc. VLDB Endowment 2011 4 843-851
[43]
Morfonios, K., et al.: ROLAP implementations of the data cube. ACM Comput. Surv. 39(4), 12:1–12:53 (2007)
[44]
Neumann T and Weikum G The RDF-3X engoine for scalable management of RDF data VLDB J. 2010 19 1 91-113
[45]
Pareti, P., Konstantinidis, G.: A review of SHACL: From data validation to schema reasoning for RDF graphs. In: Šimkus, M., Varzinczak, I. (eds.) Reasoning Web: Declarative Artificial Intelligence. Lecture Notes in Computer Science, vol. 13100, pp. 115–144. Springer (2022)
[46]
Pareti P, Konstantinidis G, and Mogavero F Satisfiability and containment of recursive SHACL J. Web Semantics 2022 74
[47]
Raasveld, M., Mühleisen, H.: DuckDB: an embeddable analytical database. In: Proceedings 2019 International Conference on Management of Data, pp. 1981–1984. ACM (2019)
[48]
Rabbani, K., Lissandrini, M., Hose, K.: Optimizing SPARQL queries using shape statistics. In: Velegrakis, Y., Zeinalipour-Yazti, D., et al. (eds.) Proceedings 24th International Conference on Extending Database Technology, pp. 505–510. OpenProceedings.org (2021)
[49]
RDF 1.1 primer. W3C Working Group Note, June 2014
[50]
Robinson, J., Voronkov, A. (eds.): Handbook of Automated Reasoning. Elsevier and MIT Press (2001)
[51]
Rohde, P., et al.: SHACL-ACL: Access control with SHACL. In: Pesquita, C., Skaf-Molli, H., et al. (eds.) The Semantic Web: ESWC Satellite Events. LNCS, vol. 13998, pp. 22–26 (2023)
[52]
Schaffenrath R, Proksch D, Kopp M, Albasini I, Panasiuk O, and Fensel A Gutiérrez-Basulto V, Kliegr T, Soylu A, Giese M, and Roman D Benchmark for performance evaluation of SHACL implementations in graph databases Rules and Reasoning 2020 Cham Springer 82-96
[53]
SHACL test suite and implementation report. W3C Document, January 2024
[54]
Shacl2sparql. https://github.com/rdfshapes/shacl-sparql
[55]
ShEx—shape expressions, April 2024. https://shex.io
[56]
Stonebraker, M., et al.: C-Store: a column-oriented DBMS. In: Böhm, K., Jensen, C., et al. (eds.) Proceedings 31th International Conference on Very Large Data Bases, pp. 553–564. ACM (2005)
[57]
TPC benchmark H decision support standard specification revision 3.0.1. Transaction Processing Performance Council (1993–2022)
[58]
Trav-shacl implementation. https://github.com/SDM-TIB/Trav-SHACL
[59]
Werbrouck, J., et al.: Pattern-based access control in a decentralised collaboration environment. In: Poveda-Villalón, M., Roxin, A., et al. (eds.) Proceedings 8th Linked Data in Architecture and Construction Workshop. CEUR Workshop Proceedings, vol. 2636, pp. 118–131 (2020)
Index Terms
- Compiling SHACL Into SQL
Index terms have been assigned to the content through auto-classification.
Recommendations
Mapping Relational Database Constraints to SHACL
The Semantic Web – ISWC 2022AbstractMost structured data today is still stored in relational databases, which makes it important to provide a translation between relational and semantic data. A relational to RDF mapping, such as R2RML [13], provides a way to view existing relational ...
Comments
Information & Contributors
Information
Published In

Nov 2024
277 pages
ISBN:978-3-031-77849-0
DOI:10.1007/978-3-031-77850-6
© The Author(s), under exclusive license to Springer Nature Switzerland AG 2025.
Publisher
Springer-Verlag
Berlin, Heidelberg
Publication History
Published: 27 November 2024
Qualifiers
- Article
Contributors
Other Metrics
Bibliometrics & Citations
Bibliometrics
Article Metrics
- 0Total Citations
- 0Total Downloads
- Downloads (Last 12 months)0
- Downloads (Last 6 weeks)0
Reflects downloads up to 25 Feb 2025