Validator Interface


Currently the main validator methods are only implemented for SqlDatabaseImplementation

The validate method is configured using a metadata schema. The default one used is:

This is specified using LinkML which provides an expressive way to state constraints on metadata elements, such as AnnotationProperty assertions in ontologies. For example, this schema states that definition is recommended (not required), and that it is single-valued.

Different projects may wish to configure this - it is possible to pass in a different or modified schema

For more details see this howto guide

class oaklib.interfaces.validator_interface.ValidatorInterface(resource: Optional[oaklib.resource.OntologyResource] = None, strict: bool = False)[source]

Basic ontology QC

The overall goal is to support the following

  • validating against OntologyMetadata schema

  • lexical checks

  • wrapping reasoning

  • structural graph checks

Specific implementations may choose to implement efficient methods for this. For example, a SQL implementation can quickly determine all terms missing definitions with a query over an indexed table.

Currently the main implementation for this is the SqlDatabase implementation, this implements a generic property check using the OntologyMetadata datamodel


is_coherent() bool[source]

True if the ontology is logically coherent, as determined by deductive reasoning (e.g. an OWL reasoner)


true if coherent

repair(configuration: Optional[oaklib.datamodels.validation_datamodel.RepairConfiguration] = None, dry_run=False) Iterable[oaklib.datamodels.validation_datamodel.RepairOperation][source]

Finds problems and fixes them

  • configuration

  • dry_run


term_curies_without_definitions() Iterable[str][source]

TODO: decide whether to write highly specific methods or use a generic validate method


unsatisfiable_classes(exclude_nothing=True) Iterable[str][source]

Yields all classes that are unsatisfiable, as determined by deductive reasoning (e.g. an OWL reasoner)


exclude_nothing – if True (default) do not include the tautological owl:Nothing


class curie iterator

validate(configuration: Optional[oaklib.datamodels.validation_datamodel.ValidationConfiguration] = None) Iterable[oaklib.datamodels.validation_datamodel.ValidationResult][source]

Validate entire ontology or wrapped ontologies

Validation results might be implementation specific

  • reasoners will yield logical problems

  • shape checkers or schema checkers like SHACL or LinkML will return closed-world structural violations

  • specialized implementations may yield lexical or other kinds of problems