SHACL Validation
Auto-generate shapes
rdfmapper generates a SHACL NodeShape directly from the cardinality metadata
declared in @rdf_property:
Validate a graph
conforms, results_graph, report_text = mapper.validate(
graph, entity_class=Person
)
print("Conforms:", conforms)
print(report_text)
Provide your own SHACL graph
from rdflib import Graph
shacl = Graph()
shacl.parse("my-shapes.ttl", format="turtle")
conforms, _, report = mapper.validate(graph, shacl_graph=shacl)