skip to main content
10.1145/3589334.3645550acmconferencesArticle/Chapter ViewAbstractPublication PagesthewebconfConference Proceedingsconference-collections
research-article
Open access

From Shapes to Shapes: Inferring SHACL Shapes for Results of SPARQL CONSTRUCT Queries

Published: 13 May 2024 Publication History

Abstract

SPARQL CONSTRUCT queries allow for the specification of data processing pipelines that transform given input graphs into new output graphs. It is now common to constrain graphs through SHACL shapes allowing users to understand which data they can expect and which not. However, it becomes challenging to understand what graph data can be expected at the end of a data processing pipeline without knowing the particular input data: Shape constraints on the input graph may affect the output graph, but may no longer apply literally, and new shapes may be imposed by the query template. In this paper, we study the derivation of shape constraints that hold on all possible output graphs of a given SPARQL CONSTRUCT query. We assume that the SPARQL CONSTRUCT query is fixed, e.g., being part of a program, whereas the input graphs adhere to input shape constraints but may otherwise vary over time and, thus, are mostly unknown. We study a fragment of SPARQL CONSTRUCT queries (SCCQ) and a fragment of SHACL (Simple SHACL). We formally define the problem of deriving the most restrictive set of Simple SHACL shapes that constrain the results from evaluating a SCCQ over any input graph restricted by a given set of Simple SHACL shapes. We propose and implement an algorithm that statically analyses input SHACL shapes and CONSTRUCT queries and prove its soundness and complexity.

Supplemental Material

MP4 File
Supplemental video

References

[1]
Renzo Angles, Marcelo Arenas, Pablo Barceló, Peter A. Boncz, George H. L. Fletcher, Claudio Gutierrez, Tobias Lindaaker, Marcus Paradies, Stefan Plantikow, Juan F. Sequeda, Oskar van Rest, and Hannes Voigt. 2018. G-CORE: A Core for Future Graph Query Languages. In Proc. of SIGMOD. ACM, 1421--1432. https://doi.org/10.1145/3183713.3190654
[2]
Marcelo Arenas, Alexandre Bertails, Eric Prud'hommeaux, Juan Sequeda, et al. 2012. A Direct Mapping of Relational Data to RDF. https://www.w3.org/TR/rdb-direct-mapping/ Retrieved 12.02.2024 from
[3]
KRR Group at University of Oxford. 2008. HermiT OWL Reasoner. http://www.hermit-reasoner.com/ Retrieved 12.10.2023 from
[4]
Franz Baader, Diego Calvanese, Deborah L. McGuinness, Daniele Nardi, and Peter F. Patel-Schneider (Eds.). 2003. The Description Logic Handbook: Theory, Implementation, and Applications. Cambridge University Press.
[5]
Adrian Bielefeldt, Julius Gonsior, and Markus Krö tzsch. 2018. Practical Linked Data Access via SPARQL: The Case of Wikidata. In Workshop on Linked Data on the Web co-located with The Web Conference 2018, LDOW@WWW 2018 (CEUR Workshop Proceedings, Vol. 2073). CEUR-WS.org. https://ceur-ws.org/Vol-2073/article-03.pdf
[6]
Bart Bogaerts, Maxime Jakubowski, and Jan Van den Bussche. 2022. SHACL: A Description Logic in Disguise. In Proc. of Logic Programming and Nonmonotonic Reasoning (LNCS, Vol. 13416). Springer, 75--88. https://doi.org/10.1007/978--3-031--15707--3_7
[7]
Iovka Boneva, Jé ré mie Dusart, Daniel Ferná ndez-Á lvarez, and José Emilio Labra Gayo. 2019. Shape Designer for ShEx and SHACL constraints. In Proc. of the ISWC 2019 Satellite Tracks co-located with ISWC 2019 (CEUR Workshop Proceedings, Vol. 2456). CEUR-WS.org, 269--272. https://ceur-ws.org/Vol-2456/paper70.pdf
[8]
Angela Bonifati, Wim Martens, and Thomas Timm. 2020. An analytical study of large SPARQL query logs. VLDB J., Vol. 29, 2--3 (2020), 655--679. https://doi.org/10.1007/s00778-019-00558--9
[9]
Diego Calvanese, Wolfgang Fischl, Reinhard Pichler, Emanuel Sallinger, and Mantas Simkus. 2014. Capturing Relational Schemas and Functional Dependencies in RDFS. In Proc. of the AAAI Conference on Artificial Intelligence. AAAI Press, 1003--1011. https://doi.org/10.1609/AAAI.V28I1.8867
[10]
Andrea Cimmino, Alba Ferná ndez-Izquierdo, and Raú l Garc'i a-Castro. 2020. Astrea: Automatic Generation of SHACL Shapes from Ontologies. In Proc. of ESWC (LNCS, Vol. 12123). Springer, 497--513. https://doi.org/10.1007/978--3-030--49461--2_29
[11]
Richard Cyganiak, David Wood, Markus Lanthaler, Graham Klyne, Jeremy J. Carroll, and Brian McBride. 2014. RDF Concepts and Abstract Syntax. https://www.w3.org/TR/rdf11-concepts/ Retrieved 12.02.2024 from
[12]
Thomas Delva, Birte De Smedt, Sitt Min Oo, Dylan Van Assche, Sven Lieber, and Anastasia Dimou. 2021. RML2SHACL: RDF Generation Taking Shape. In Proc. of Knowledge Capture Conference. ACM, 153--160. https://doi.org/10.1145/3460210.3493562
[13]
Wenfei Fan, Shuai Ma, Yanli Hu, Jie Liu, and Yinghui Wu. 2008. Propagating functional dependencies with conditions. Proc. VLDB Endow., Vol. 1, 1 (2008), 391--407. https://doi.org/10.14778/1453856.1453901
[14]
Daniel Ferná ndez-Á lvarez, José Emilio Labra Gayo, and Daniel Gayo-Avello. 2022. Automatic extraction of shapes using sheXer. Knowledge-Based Systems, Vol. 238 (2022), 107975. https://doi.org/10.1016/J.KNOSYS.2021.107975
[15]
Beno^i t Groz, Auré lien Lemay, Slawek Staworko, and Piotr Wieczorek. 2022. Inference of Shape Graphs for Graph Databases. In ICDT (LIPIcs, Vol. 220). Schloss Dagstuhl - Leibniz-Zentrum fü r Informatik, 14:1--14:20. https://doi.org/10.4230/LIPICS.ICDT.2022.14
[16]
Steve Harris, Andy Seaborne, and Eric Prud'hommeaux. 2013. SPARQL 1.1 Query Language. https://www.w3.org/TR/sparql11-query/ Retrieved 12.02.2024 from
[17]
Barry E. Jacobs, Alan R. Aronson, and Anthony C. Klug. 1982. On Interpretations of Relational Languages and Solutions to the Implied Constraint Problem. ACM Trans. Database Syst., Vol. 7, 2 (1982), 291--315. https://doi.org/10.1145/319702.319730
[18]
Anthony C. Klug and Rod Price. 1982. Determining View Dependencies Using Tableaux. ACM Trans. Database Syst., Vol. 7, 3 (1982), 361--380. https://doi.org/10.1145/319732.319738
[19]
Holger Knublauch and Dimitris Kontokostas. 2017. Shapes Constraint Language (SHACL). https://www.w3.org/TR/shacl/ Retrieved 12.02.2024 from
[20]
Egor V. Kostylev, Juan L. Reutter, and Mart'i n Ugarte. 2015. CONSTRUCT Queries in SPARQL. In Proc. of International Conference on Database Theory, ICDT (LIPIcs, Vol. 31). Schloss Dagstuhl - Leibniz-Zentrum fü r Informatik, 212--229. https://doi.org/10.4230/LIPIcs.ICDT.2015.212
[21]
Martin Leinberger, Philipp Seifer, Claudia Schon, Ralf L"a mmel, and Steffen Staab. 2019. Type Checking Program Code Using SHACL. In Proc. of ISWC (LNCS, Vol. 11778). Springer, 399--417. https://doi.org/10.1007/978--3-030--30793--6_23
[22]
Nandana Mihindukulasooriya, Mohammad Rifat Ahmmad Rashid, Giuseppe Rizzo, Raú l Garc'i a-Castro, Ó scar Corcho, and Marco Torchiano. 2018. RDF Shape Induction Using Knowledge Base Profiling. In Prov. of the Symposium on Applied Computing. ACM, 1952--1959. https://doi.org/10.1145/3167132.3167341
[23]
Pouya Ghiasnezhad Omran, Kerry Taylor, Sergio José Rodr'i guez Mé ndez, and Armin Haller. 2023. Learning SHACL shapes from knowledge graphs. Semantic Web, Vol. 14, 1 (2023), 101--121. https://doi.org/10.3233/SW-223063
[24]
Harshvardhan J. Pandit, Declan O'Sullivan, and Dave Lewis. 2018. Using Ontology Design Patterns To Define SHACL Shapes. In Proc. of the Workshop on Ontology Design and Patterns (WOP 2018) co-located with ISWC 2018 (CEUR Workshop Proceedings, Vol. 2195). CEUR-WS.org, 67--71. https://ceur-ws.org/Vol-2195/research_paper_3.pdf
[25]
Eric Prud'hommeaux, José Emilio Labra Gayo, and Harold R. Solbrig. 2014. Shape expressions: an RDF validation and transformation language. In Proc. of the International Conference on Semantic Systems, SEMANTiCS. ACM, 32--40. https://doi.org/10.1145/2660517.2660523
[26]
Kashif Rabbani, Matteo Lissandrini, and Katja Hose. 2023. Extraction of Validating Shapes from very large Knowledge Graphs. Proc. VLDB Endow., Vol. 16, 5 (2023), 1023--1032. https://doi.org/10.14778/3579075.3579078
[27]
Raymond Reiter. 1982. Towards a Logical Reconstruction of Relational Database Theory. In On Conceptual Modelling (Intervale) (Topics in Information Systems). Springer, 191--233.
[28]
Philipp Seifer, Daniel Hernández, Ralf Lämmel, and Steffen Staab. 2024 a. Code for From Shapes to Shapes. https://doi.org/10.18419/darus-3977
[29]
Philipp Seifer, Daniel Hernández, Ralf Lämmel, and Steffen Staab. 2024 b. From Shapes to Shapes: Inferring SHACL Shapes for Results of SPARQL CONSTRUCT Queries (Extended Version). arxiv: 2402.08509 [cs.DB]
[30]
Philipp Seifer, Ralf L"a mmel, and Steffen Staab. 2021. ProGS: Property Graph Shapes Language. In Proc. of ISWC (LNCS, Vol. 12922). Springer, 392--409. https://doi.org/10.1007/978--3-030--88361--4_23
[31]
Juan F. Sequeda, Marcelo Arenas, and Daniel P. Miranker. 2012. On directly mapping relational databases to RDF and OWL. In WWW. ACM, 649--658. https://doi.org/10.1145/2187836.2187924
[32]
Blerina Spahiu, Andrea Maurino, and Matteo Palmonari. 2018. Towards Improving the Quality of Knowledge Graphs with Data-driven Ontology Patterns and SHACL. In Proc. of the Workshop on Ontology Design and Patterns (WOP 2018) co-located with ISWC 2018 (CEUR Workshop Proceedings, Vol. 2195). CEUR-WS.org, 52--66. https://ceur-ws.org/Vol-2195/research_paper_2.pdf
[33]
Michael Stonebraker. 1975. Implementation of Integrity Constraints and Views by Query Modification. In Proc. of SIGMOD. ACM, 65--78. https://doi.org/10.1145/500080.500091
[34]
Ratan Bahadur Thapa and Martin Giese. 2021. A Source-to-Target Constraint Rewriting for Direct Mapping. In Proc. of ISWC (LNCS, Vol. 12922). Springer, 21--38. https://doi.org/10.1007/978--3-030--88361--4_2
[35]
Ratan Bahadur Thapa and Martin Giese. 2022. Mapping Relational Database Constraints to SHACL. In Proc. of ISWC (LNCS, Vol. 13489). Springer, 214--230. https://doi.org/10.1007/978--3-031--19433--7_13

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
WWW '24: Proceedings of the ACM Web Conference 2024
May 2024
4826 pages
ISBN:9798400701719
DOI:10.1145/3589334
This work is licensed under a Creative Commons Attribution International 4.0 License.

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 13 May 2024

Check for updates

Badges

Author Tags

  1. data pipelines
  2. semantic queries
  3. shacl
  4. sparql construct

Qualifiers

  • Research-article

Funding Sources

Conference

WWW '24
Sponsor:
WWW '24: The ACM Web Conference 2024
May 13 - 17, 2024
Singapore, Singapore

Acceptance Rates

Overall Acceptance Rate 1,899 of 8,196 submissions, 23%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 121
    Total Downloads
  • Downloads (Last 12 months)121
  • Downloads (Last 6 weeks)47
Reflects downloads up to 15 Sep 2024

Other Metrics

Citations

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media