# xpSHACL: Explainable SHACL Validation using Retrieval-Augmented Generation and Large Language Models

arXiv: https://arxiv.org/abs/2507.08432 · HTML: https://mlsanity.com/paper/2507.08432/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Placed in Knowledge-graph and structured-knowledge RAG, one of 15 directions in Retrieval-augmented generation.
- Builds on 10 of its 39 references that are in the map.
- First posted on arXiv 11 Jul 2025.

## Placed in

- Retrieval-augmented generation / [Knowledge-graph and structured-knowledge RAG](https://mlsanity.com/rag/knowledge-graph-and-structured-knowledge-rag/)

## Builds on (most cited first, 10 of 10)

- [Reasoning on Graphs: Faithful and Interpretable Large Language Model Reasoning](https://mlsanity.com/paper/2310.01061/) (2023)
- [The Good, The Bad, and The Greedy: Evaluation of LLMs Should Not Ignore Non-Determinism](https://mlsanity.com/paper/2407.10457/) (2024)
- [Knowledge Graph Enhanced Large Language Model Editing](https://mlsanity.com/paper/2402.13593/) (2024)
- [Knowledge Graph Embeddings and Explainable AI](https://mlsanity.com/paper/2004.14843/) (2020)
- [A Review of SHACL: From Data Validation to Schema Reasoning for RDF Graphs](https://mlsanity.com/paper/2112.01441/) (2021)
- [On the Use of Large Language Models to Generate Capability Ontologies](https://mlsanity.com/paper/2404.17524/) (2024)
- [Reasoning over RDF Knowledge Bases using Deep Learning](https://mlsanity.com/paper/1811.04132/) (2018)
- [Generating Context-Aware Contrastive Explanations in Rule-based Systems](https://mlsanity.com/paper/2402.13000/) (2024)
- [Step-by-Step Data Cleaning Recommendations to Improve ML Prediction Accuracy](https://mlsanity.com/paper/2503.11366/) (2025)
- [The Shape of Explanations: A Topological Account of Rule-Based Explanations in Machine Learning](https://mlsanity.com/paper/2301.09042/) (2023)

## Built on by (most cited first, 2 of 2)

- [Stemming Hallucination in Language Models Using a Licensing Oracle](https://mlsanity.com/paper/2511.06073/) (2025)
- [LLM+Graph@VLDB'2025 Workshop Summary](https://mlsanity.com/paper/2604.02861/) (2026)

## Abstract (arXiv)

Shapes Constraint Language (SHACL) is a powerful language for validating RDF data. Given the recent industry attention to Knowledge Graphs (KGs), more users need to validate linked data properly. However, traditional SHACL validation engines often provide terse reports in English that are difficult for non-technical users to interpret and act upon. This paper presents xpSHACL, an explainable SHACL validation system that addresses this issue by combining rule-based justification trees with retrieval-augmented generation (RAG) and large language models (LLMs) to produce detailed, multilanguage, human-readable explanations for constraint violations. A key feature of xpSHACL is its usage of a Violation KG to cache and reuse explanations, improving efficiency and consistency.
