Patcher Interface

class oaklib.interfaces.patcher_interface.PatcherInterface(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]

Applies diffs

See KGCL

auto_add_contributor_using: str = None

If provided, then any creators of or contributors on a Change object are propagated to the entity after application of that change, using this property. If this is set then the recommended value is dct:contributor

ignore_invalid_changes: bool = False

If True, then invalid changes are ignored. If False, then invalid changes raise an exception

apply_patch(patch: Change, activity: Activity | None = None, metadata: Mapping[str, Any] | None = None, configuration: Configuration | None = None) Change | None[source]

Applies a change description

Parameters:
  • patch – TBD use KGCL

  • activity

  • metadata

  • configuration

Returns:

if successful, return copy of change object with additional metadata attached

migrate_curies(curie_map: Dict[str, str]) None[source]

Rewire an ontology replacing all usages of some CURIEs

Parameters:

curie_map

Returns:

save()[source]

Commits all changes

Returns:

expand_changes(changes: List[Change], configuration: Configuration | None = None, apply=False) List[Change][source]

Expand a list of complex change objects to a list of atomic changes.

Parameters:
  • changes

  • configuration

  • apply – if True, apply the changes

Returns:

expand_change(change: Change, configuration: Configuration | None = None) List[Change][source]

Expand a complex change object to a list of atomic changes.

Examples

  • An obsoletion command may also generate a label change and removal or rewiring of edges

  • A NameBecomesSynonym may generate a NewSynonym and a NodeRename

param change:

param configuration:

return:

undo(changes: List[Change], expand=False, strict=True, **kwargs) List[Change][source]

Undo a list of changes

Parameters:
  • changes

  • kwargs

Returns:

reverse_changes(changes: List[Change]) List[Change][source]

Creates reciprocal Undo operations for a list of changes

Parameters:

changes

Returns: