TL;DR
The paper introduces sheval, an open-source evaluation framework and test suite designed to assess how different RDF data shape validation engines handle recursive definitions. The tool reveals that while ShEx engines consistently implement Greatest Fixed Point (GFP) semantics, SHACL engines exhibit wildly divergent behaviors—ranging from crashes and timeouts to contradictory validation reports—due to ambiguities in the official SHACL specification.
What Problem Does This Paper Address?
In the world of the Semantic Web, Resource Description Framework (RDF) graphs are used to represent complex, interconnected data. To ensure this data is clean and consistent, developers use shape-based validation languages like ShEx (Shape Expressions) and SHACL (Shapes Constraint Language).
A major challenge arises with recursive shapes—definitions where a shape refers to itself, either directly or indirectly (e.g., a User shape requires a connection to a Person shape, which in turn requires a connection to a User shape).
While the ShEx specification explicitly defines how to handle recursion, the W3C SHACL 1.0 recommendation leaves the semantics of recursive shapes undefined. As a result, different SHACL validation engines have implemented their own ad-hoc strategies, leading to a total lack of interoperability and unpredictable validation results for developers.
Methods
The authors developed sheval, a command-line framework designed to run a standardized test suite across multiple ShEx and SHACL validation engines.
The core design principle of sheval is the isolation of engine-specific quirks behind a uniform Runner interface. The framework operates as follows:
- Orchestration: It reads a YAML manifest defining the test cases (data graphs, schemas, and expected results).
- Input Preparation: It automatically translates abstract shape definitions into concrete ShEx schemas (ShapeMaps) or SHACL shapes graphs.
- Execution: It runs the validation engines inside Docker containers to ensure reproducibility, capturing standard output, errors, and exit codes.
- Analysis & Matching: It parses the varied outputs into a unified format (
conforms,successes,failures,message) and matches them against formal logical semantics, such as Least Fixed Point (LFP), Greatest Fixed Point (GFP), and Supported Model Semantics (SMS).
Datasets
Instead of a traditional training dataset, the authors introduced a specialized recursive shapes test suite consisting of several micro-benchmarks:
- Basic Separation Tests: Minimal examples designed to clearly distinguish whether an engine uses LFP semantics (where a node doesn't conform unless proven otherwise) or GFP semantics (where a node conforms unless a constraint is violated).
- Reachability Separation Tests: Scenarios checking graph reachability and safety properties.
- Feature Tests: Edge cases testing non-stratified negation (combining recursion and negation in ways that cause logical paradoxes), consistency checking, and "fresh nodes" (nodes evaluated outside the actual data graph).
- Duality Tests: Validating the logical duality propositions between LFP and GFP.
- Non-recursive Control Tests: Baselines to ensure engines behave identically on standard, non-recursive data.
Key Insights and Ideas
- ShEx is Unified, SHACL is Divided: ShEx validators (like rudof, Jena ShEx, and ShEx-S) are highly consistent because they strictly follow the official specification's GFP semantics. SHACL engines, however, are a "wild west" of conflicting implementations.
- The Spectrum of SHACL Behaviors: When faced with recursion, SHACL engines don't just disagree on the boolean true/false verdict; they fail in entirely different ways. Some engines enter infinite loops, some crash with stack overflows, and others attempt to flag the cycle and proceed anyway.
- Abstracting the Quirks: The paper demonstrates that a clean, runner-based architecture can successfully benchmark software even when the target applications have completely different input formats, output structures, and error-signaling behaviors.
Key Results
The framework evaluated several prominent engines, including pySHACL, SHACL-S, Apache Jena, SHACL-TQ, rudof, and ShEx-S.
- ShEx Engines: 100% consistent with GFP semantics across all basic and reachability tests.
- Apache Jena (SHACL): Tended to follow GFP semantics, successfully detecting cycles and continuing validation to return
conforms=truein most recursive test cases. - pySHACL: Detected cycles but frequently crashed (
C!) or returned validation errors on complex recursive structures. - SHACL-S: Suffered from timeout errors (
T) on basic recursive examples, indicating an inability to resolve certain loops. - SHACL-TQ: Followed a unique, non-standard semantics that did not align with LFP, GFP, or Supported Model Semantics, highlighting a critical need for a formal study of its underlying algorithm.
Limitations and Future Work
The current iteration of sheval relies on a simplified, abstract shape language subset to map behaviors across ShEx and SHACL. It does not yet cover the full expressiveness of either language specification.
Future work aims to integrate additional ShEx and SHACL implementations into the runner framework. The authors also plan to expand the test suites to evaluate other critical dimensions of data shape validation, including performance benchmarking, interoperability, explainability, and overall usability.
Summary updated