Subsetting

class oaklib.interfaces.subsetter_interface.SubsetterInterface(resource: ~oaklib.resource.OntologyResource | None = None, strict: bool = False, _multilingual: bool | None = None, autosave: bool = <factory>, exclude_owl_top_and_bottom: bool = <factory>, ontology_metamodel_mapper: ~oaklib.mappers.ontology_metadata_mapper.OntologyMetadataMapper | None = None, _converter: ~curies.api.Converter | None = None, auto_relax_axioms: bool | None = None, cache_lookups: bool = False, property_cache: ~oaklib.utilities.keyval_cache.KeyValCache = <factory>, _edge_index: ~oaklib.indexes.edge_index.EdgeIndex | None = None, _entailed_edge_index: ~oaklib.indexes.edge_index.EdgeIndex | None = None)[source]

an interface that provides subsetting operations.

Subsets are named sets of entities/terms in an ontology. Subsetting operations include extracting, and “rolling up” to a subset.

See:

extract_subset_ontology(seed_curies: List[str], strategy: SubsetStrategy | None = None) BasicOntologyInterface[source]

Extracts an ontology subset using a seed list of curies

EXPERIMENTAL: this method may be removed in future

Parameters:
  • seed_curies

  • strategy

Returns:

gap_fill_relationships(seed_curies: List[str], predicates: List[str] | None = None) Iterator[Tuple[str, str, str]][source]

Given a term subset as a list of curies, find all non-redundant relationships connecting them.

This assumes relation-graph entailed edges, so currently only implemented for ubergraph and sqlite

First the subset of all entailed edges conforming to the predicate profile connecting any pair of terms in the subset is selected

Then naive transitive reduction on a per predicate basis is performed. This may yield edges that are formally redundant, but these are still assumed to be useful for the user

Parameters:
  • seed_curies

  • predicates – if specified, only consider relationships using these predicates

Returns:

autosave: bool

For adapters that wrap a transactional source (e.g sqlite), this controls whether results should be auto-committed after each operation

exclude_owl_top_and_bottom: bool

Do not include owl:Thing or owl:Nothing