Constraint-Guided RDF Construction with Provenance
Validating RDF graphs against constraint languages, such as SHACL, remains decoupled from the RDF graph’s construction, usually performed via mapping languages, such as RML. This leads to blindly generating all triples defined by the mapping, including those irrelevant to or non-conforming with the SHACL shapes, incurring construction and validation overhead. Avoiding unnecessary overhead requires a precise characterization of the triples to be generated, at three progressively finer facets: those that are shape-relevant, those that belong to nonconforming or conforming focus nodes, and those that constitute minimal deterministic evidence. While such a characterization is implicit in a provenance semantics for SHACL over materialized RDF graphs, it has not been exploited during the graph’s construction. Instead of deriving these characterizations a posteriori, we propose compiling SHACL shapes into an existing RML mapping following the provenance semantics, producing rewritten mappings for each above facet. We prove correctness of the approach, implement it as an open-source system, experimentally show up to three orders of magnitude faster execution and less memory than the post-hoc baseline. By lifting constraints into the RDF graph construction, our approach reduces the need for post-hoc validation over the full graph, avoiding the materialization of the entire graph including triples that are irrelevant or non-conforming. Our work provides the foundation for seamlessly integrating the construction and validation of RDF graphs into a coherent unified process, reducing redundancy, promoting consistency by design and improving overall efficiency.
Palabras clave: SHACL, RML, RDF Validation, Provenance