Stable Model Semantics for Recursive SHACL
Medina Andresel, Julien Corman, Magdalena Ortiz, Juan L. Reutter, Ognjen Savkovic, Mantas Simkus
Abstract
SHACL (SHape Constraint Language) is a W3C recommendation for validating graph-based data against a set of constraints (called shapes). Importantly, SHACL allows to define recursive shapes, i.e. a shape may refer to itself, directly of indirectly. The recommendation left open the semantics of recursive shapes, but proposals have emerged recently to extend the official semantics to support recursion. These proposals are based on the principle of possibility (or non-contradiction): a graph is considered valid against a schema if one can assign shapes to nodes in such a way that all constraints are satisfied. This semantics is not constructive, as it does not provide guidelines about how to obtain such an assignment, and it may lead to unfounded assignments, where the only reason to assign a shape to a node is that it allows validating the graph. In contrast, we propose in this paper a stricter, more constructive semantics for SHACL, based on stable models, which are well-known in Answer Set Programming (ASP). This semantics additionally requires a shape assignment to be properly justified by the input constraints. We further exploit the connection to logic programming, and show that SHACL constraints can be naturally represented as logic programs, and that the validation problem for a graph and a SHACL schema can be encoded as an ASP reasoning task. The proposed semantics also enjoys computationally tractable validation in the presence of constraints with stratified negation (as opposed to the previous semantics). We also extend our semantics to 3-valued stable models, which yields a more relaxed notion of validation, tolerant to certain faults in the schema or data. By exploiting a connection between 3-valued stable model semantics and the wellfounded semantics for logic programs, we can use our translation into ASP to show another tractability result. Finally, we provide a preliminary evaluation of the approach, which leverages an ASP solver to perform graph validation. CCS CONCEPTS • Information systems → Semantic web description languages; Graph-based database models.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext cfdb2036-fa79-4a67-a1d2-e5fab0630ae0Cited by top-tier papers4
- Trav-SHACL: Efficiently Validating Networks of SHACL ConstraintsMónica Figuera, Philipp D. Rohde, Maria-Esther VidalWWW 2021 · 39 citations
- Common Foundations for SHACL, ShEx, and PG-SchemaShqiponja Ahmetaj, Iovka Boneva, Jan Hidders, Katja Hose et al.WWW 2025 · 10 citations
- Magic Shapes for SHACL ValidationShqiponja Ahmetaj, Bianca Löhnert, Magdalena Ortiz, Mantas SimkusVLDB 2022 · 7 citations
- Stable Model Semantics for Description Logic TerminologiesFederica Di Stefano, Mantas SimkusAAAI 2024 · 5 citations
Related papers
- From Shapes to Shapes: Inferring SHACL Shapes for Results of SPARQL CONSTRUCT QueriesPhilipp Seifer, Daniel Hernández, Ralf Lämmel, Steffen StaabWWW 2024 · 3 citations
- Efficient Validation of SHACL Shapes with ReasoningJin Ke, Zenon G. Zacouris, Maribel AcostaVLDB 2024 · 9 citations
- Transforming RDF Graphs to Property Graphs using Standardized SchemasKashif Rabbani, Matteo Lissandrini, Angela Bonifati, Katja HoseSIGMOD 2025 · 13 citations
- Finite-Choice Logic ProgrammingChris Martens, Robert J. Simmons, Michael ArntzeniusPOPL 2025 · 3 citations
- Structural Decompositions of Epistemic Logic ProgramsMarkus Hecher, Michael Morak, Stefan WoltranAAAI 2020 · 15 citations
