Add a deterministic, ontology-based schema validator as a sibling to the
confidence-based ExtractionValidator. Both validators implement the same
validate_entities() and validate_relations() interfaces and return the
shared ValidationResult structure, enabling orthogonal composition across
extraction confidence and ontological conformance.
Key Additions & Behaviors:
- ExtractionSchema: Read-only view over domain ontologies (allowed concepts
and predicates with optional domain/range constraints). Supports loading
from dictionary representations (generate_ontology() or OntologyData from
OntologyIngestor) via ExtractionSchema.from_ontology(), and from OWL/Turtle
files/strings via ExtractionSchema.from_owl().
- SchemaValidator: Verifies entity labels against schema concepts and
validates relation predicates against defined domain/range constraints.
Provides filter_by_schema() and filter_relations_by_schema() to extract
conforming subsets without mutating source data.
- Domain/Range Wildcarding: Treats owl:Thing (and unqualified Thing) as
unconstrained wildcards so fallback types do not reject valid endpoints.
- Constructor Parity: Folds relation domain/range endpoint types into the
concepts set across both from_ontology() and from_owl() to ensure logical
consistency.
- Ingest Pipeline Interop: Automatically unwraps OntologyData-like objects
via duck-typing on .data.
- Resilient Endpoint Resolution: Guards malformed relations missing subject
or object endpoints without raising AttributeError, and prefers rdfs:label
over URI suffixes while supporting both owl:Class and rdfs:Class.
Part of #1510.