Source code for oaklib.interfaces.patcher_interface

from abc import ABC
from typing import Any, Dict, Mapping, Optional

from kgcl_schema.datamodel.kgcl import Activity, Change

from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface
from oaklib.types import CURIE, PRED_CURIE

[docs]class PatcherInterface(BasicOntologyInterface, ABC): """ Applies diffs See `KGCL <>`_ """ auto_add_contributor_using: PRED_CURIE = 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"""
[docs] def apply_patch( self, patch: Change, activity: Activity = None, metadata: Mapping[PRED_CURIE, Any] = None ) -> Optional[Change]: """ Applies a change description :param patch: TBD use KGCL :param activity: :param metadata: :return: if successful, return copy of change object with additional metadata attached """ raise NotImplementedError
[docs] def migrate_curies(self, curie_map: Dict[CURIE, CURIE]) -> None: """ Rewire an ontology replacing all usages of some CURIEs :param curie_map: :return: """ raise NotImplementedError
[docs] def save(self): """ Commits all changes :return: """