Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
nayib-jose-gloria committed Feb 20, 2024
1 parent b5316f8 commit c382ee5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/ontology-builder/src/all_ontology_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,15 @@ def _get_ancestors(onto_class: owlready2.entity.ThingClass, onto_name: str) -> S
:rtype List[str]
:return list of ancestors (term ids), it could be empty
"""

def _get_branch_ancestors(term: owlready2.entity.ThingClass):
# a branch ancestor is defined in ontology files as having a "part_of" (BFO_0000050) relationship with a term
branch_ancestors = set()
for subclass in term.is_a:
if (
hasattr(subclass, "property") and
subclass.property.name == "BFO_0000050" and
isinstance(subclass.value, owlready2.entity.ThingClass)
hasattr(subclass, "property")
and subclass.property.name == "BFO_0000050"
and isinstance(subclass.value, owlready2.entity.ThingClass)
):
branch_ancestor_name = subclass.value.name.replace("obo.", "").replace("_", ":")
if branch_ancestor_name.split(":")[0] == onto_name:
Expand Down

0 comments on commit c382ee5

Please sign in to comment.