biocypher._translate.Translator

class biocypher._translate.Translator(ontology: Ontology, strict_mode: bool = False)

Class responsible for exacting the translation process that is configured in the schema_config.yaml file. Creates a mapping dictionary from that file, and, given nodes and edges, translates them into BioCypherNodes and BioCypherEdges. During this process, can also filter the properties of the entities if the schema_config.yaml file specifies a property whitelist or blacklist.

Provides utility functions for translating between input and output labels and cypher queries.

__init__(ontology: Ontology, strict_mode: bool = False)
Parameters:
  • leaves – Dictionary detailing the leaves of the hierarchy tree representing the structure of the graph; the leaves are the entities that will be direct components of the graph, while the intermediary nodes are additional labels for filtering purposes.

  • strict_mode – If True, the translator will raise an error if input data do not carry source, licence, and version information.

Methods

__init__(ontology[, strict_mode])

param leaves:

Dictionary detailing the leaves of the hierarchy

get_missing_biolink_types()

Returns a dictionary of types that were not represented in the schema_config.

name_sentence_to_pascal(name)

Converts a name in sentence case to pascal case.

reverse_translate(query)

Reverse translate a cypher query.

reverse_translate_term(term)

Reverse translate a single term.

translate(query)

Translate a cypher query.

translate_edges(edge_tuples)

Translates input edge representation to a representation that conforms to the schema of the given BioCypher graph.

translate_nodes(node_tuples)

Translates input node representation to a representation that conforms to the schema of the given BioCypher graph.

translate_term(term)

Translate a single term.