biocypher._ontology.Ontology

class biocypher._ontology.Ontology(head_ontology: dict, ontology_mapping: Optional[OntologyMapping] = None, tail_ontologies: Optional[dict] = None)

A class that represents the ontological “backbone” of a BioCypher knowledge graph. The ontology can be built from a single resource, or hybridised from a combination of resources, with one resource being the “head” ontology, while an arbitrary number of other resources can become “tail” ontologies at arbitrary fusion points inside the “head” ontology.

__init__(head_ontology: dict, ontology_mapping: Optional[OntologyMapping] = None, tail_ontologies: Optional[dict] = None)

Initialize the Ontology class.

Parameters:
  • head_ontology (OntologyAdapter) – The head ontology.

  • tail_ontologies (list) – A list of OntologyAdapters that will be added to the head ontology. Defaults to None.

Methods

__init__(head_ontology[, ontology_mapping, ...])

Initialize the Ontology class.

get_ancestors(node_label)

Get the ancestors of a node in the ontology.

get_dict()

Returns a dictionary compatible with a BioCypher node for compatibility with the Neo4j driver.

show_ontology_structure([to_disk, full])

Show the ontology structure using treelib or write to GRAPHML file.