From 95a129fbe952436bde251b02ab61ef3272fb9537 Mon Sep 17 00:00:00 2001 From: Syphax Date: Tue, 11 Feb 2025 05:35:10 +0100 Subject: [PATCH] add classDeletion and ObjectPropertyDeletion change type specifying the NodeDeletion --- src/oaklib/interfaces/differ_interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/oaklib/interfaces/differ_interface.py b/src/oaklib/interfaces/differ_interface.py index 31665f02b..222f7464f 100644 --- a/src/oaklib/interfaces/differ_interface.py +++ b/src/oaklib/interfaces/differ_interface.py @@ -35,6 +35,7 @@ ) from oaklib.datamodels.vocabulary import ( # OIO_SYNONYM_TYPE_PROPERTY, + OWL_OBJECT_PROPERTY, DEPRECATED_PREDICATE, HAS_OBSOLESCENCE_REASON, OWL_CLASS, @@ -173,7 +174,15 @@ def diff( if nodes_to_delete: for node in nodes_to_delete: - yield NodeDeletion(id=_gen_id(), about_node=node) + node_types = self.owl_type(node) + is_class = OWL_CLASS in node_types + is_property = OWL_OBJECT_PROPERTY in node_types + if is_class: + yield kgcl.ClassDeletion(id=_gen_id(), about_node=node) + elif is_property: + yield kgcl.ObjectPropertyDeletion(id=_gen_id(), about_node=node) + else: + yield NodeDeletion(id=_gen_id(), about_node=node, change_description=node_types) logger.info("finding Obsoletions") other_ontology_entities_with_obsoletes = set(