Skip to content

SHACL API

Requires pip install ontosql[shacl]. Validates shape constraints — not full OWL reasoning.

Shape generation

ontosql.shacl.generate.shapes_from_mapper

shapes_from_mapper(mapper_cls: type[Any], *, registry: PrefixRegistry | None = None, visited: set[type[Any]] | None = None) -> Store

Build SHACL shapes for a mapper and nested mappers.

ontosql.shacl.generate.shapes_from_mappers

shapes_from_mappers(mappers: list[type[Any]], *, registry: PrefixRegistry | None = None) -> Store

Merge SHACL shapes for multiple mappers.

Validation

ontosql.shacl.validate.validate_instance

validate_instance(instance: OntoModel, mapper_cls: type[Any], *, shapes: Store | None = None, registry: PrefixRegistry | None = None) -> ValidationReport

Validate an exported instance graph against mapper-derived SHACL shapes.

ontosql.shacl.validate.ValidationReport dataclass

Result of SHACL validation.