Ahmetaj, S., David, R., Polleres, A., & Simkus, M. (2025). A Logic Programming Approach to Repairing SHACL Constraint Violations. Transactions on Graph Data and Knowledge, 3(3). https://doi.org/10.4230/TGDK.3.3.1
The Shapes Constraint Language (SHACL) is a recent standard, a W3C recommendation, for validating RDF graphs against shape constraints to be checked on target nodes of a data graph. The standard also describes the notion of validation reports, which detail the results of the validation process. In case of violation of constraints, the validation report should explain the reasons for non-validation, offering guidance on how to identify or fix violations in the data graph. Since the specification left it open to SHACL processors to define such explanations, a recent work proposed the use of explanations in the style of database repairs, where a repair is a set of additions to or deletions from the data graph so that the resulting graph validates against the constraints. In this paper, we study such repairs for non-recursive SHACL, the largest fragment of SHACL that is fully defined in the specification. We propose an algorithm to compute repairs by encoding the explanation problem - using Answer Set Programming (ASP) - into a logic program, where the answer sets contain (minimal) repairs. We then study a scenario where it is not possible to simultaneously repair all the targets, which may be the case due to overall unsatisfiability or conflicting constraints. We introduce a relaxed notion of validation, which allows to validate a (maximal) subset of the targets and adapt the ASP translation to take into account this relaxation. Finally, we add support for repairing constraints which use property paths and equality of paths. Our implementation in clingo is - to the best of our knowledge - the first implementation of a repair program for SHACL.
en
Project title:
Grundlagen der Schlussfolgerungen in der Shape Constraint Language: T 1349-N (FWF - Österr. Wissenschaftsfonds) Bilateral Artificial Intelligence: COE 12 (FWF - Österr. Wissenschaftsfonds) Decompose and Conquer: Fast Query Processing via Decomposition: ICT22-011 (WWTF Wiener Wissenschafts-, Forschu und Technologiefonds)
-
Research Areas:
Logic and Computation: 80% Information Systems Engineering: 20%