The Challenge of Natural Language to SHACL Translation

SHACL (Shapes Constraint Language) is the standard for validating RDF graphs, but writing it manually is complex, error-prone, and requires deep knowledge of semantic web technologies. While Large Language Models (LLMs) show promise in generating code from natural language, there has been a lack of standardized evaluation methods to measure their proficiency in generating valid, semantically correct SHACL shapes.

Introducing NL2SHACL-Bench

NL2SHACL-Bench addresses this gap by providing a structured benchmark suite designed to test LLM performance in this specific domain. The benchmark focuses on the translation process—converting human-readable constraints into the formal, machine-readable SHACL syntax. By establishing a rigorous testing environment, the authors aim to move beyond anecdotal evidence of LLM capabilities and provide a quantifiable metric for model performance in knowledge graph engineering tasks.

Evaluation Methodology and Impact

The benchmark suite allows researchers and developers to assess models across varying levels of complexity, from basic property constraints to more advanced logical conditions. By standardizing the input-output pairs, NL2SHACL-Bench enables:

  • Comparative Analysis: Benchmarking different LLM architectures against a consistent set of validation requirements.
  • Error Identification: Pinpointing where models fail—whether in understanding the natural language intent, mapping to the correct SHACL vocabulary, or handling complex logical nesting.
  • Production Readiness: Establishing a baseline for using AI-assisted tools to automate the creation of data validation schemas, reducing the barrier to entry for maintaining high-quality knowledge graphs.