tyto.endpoint

Submodules

Package Contents

Classes

QueryBackend

Helper class that provides a standard way to create an ABC using

SPARQLBuilder

Mixin class that provides SPARQL queries to SPARQLEndpoint and GraphEndpoint classes

Endpoint

Helper class that provides a standard way to create an ABC using

RESTEndpoint

Class for issuing and handling HTTP requests

SPARQLEndpoint

Class which issues SPARQL queries to an endpoint

GraphEndpoint

Class for querying a local graph from a file

OntobeeEndpoint

Class which issues SPARQL queries to an endpoint

EBIOntologyLookupServiceAPI

Class for issuing and handling HTTP requests

PUG_REST

Class for issuing and handling HTTP requests

Attributes

Ontobee

Endpoint instance representing Ontobee. Ontobee is the default linked data server for most OBO Foundry library ontologies, but is also been used for many non-OBO ontologies.

EBIOntologyLookupService

The Ontology Lookup Service (OLS) is a repository for biomedical ontologies that aims to provide a single point of access to the latest ontology versions. Hosted by the European Bioinformatics Institute

PubChemAPI

class tyto.endpoint.QueryBackend

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

abstract get_term_by_uri(self, ontology: Ontology, uri: str)
abstract get_uri_by_term(self, ontology: Ontology, term: str)
class tyto.endpoint.SPARQLBuilder

Mixin class that provides SPARQL queries to SPARQLEndpoint and GraphEndpoint classes

get_term_by_uri(self, ontology, uri)

Query for a term by its URI

Parameters
  • uri – The URI for the term

  • ontology – The Ontology to query

Uri

URI

Ontology

Ontology

get_uri_by_term(self, ontology: Ontology, term: str) str

Query for the URI associated with the given an ontology term (e.g., “promoter”) :param term: The ontology term :term: str :param ontology: The ontology to query :ontology: Ontology

is_child_of(self, ontology: Ontology, child_uri: str, parent_uri: str) bool
is_parent_of(self, ontology: Ontology, parent_uri: str, child_uri: str) bool
is_ancestor_of(self, ontology: Ontology, ancestor_uri: str, descendant_uri: str) bool
is_descendant_of(self, ontology: Ontology, descendant_uri: str, ancestor_uri: str) bool
get_ontologies(self)
class tyto.endpoint.Endpoint(url)

Bases: QueryBackend, abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

class tyto.endpoint.RESTEndpoint(url)

Bases: QueryBackend, abc.ABC

Class for issuing and handling HTTP requests

_get_request(self, ontology: Ontology, request: str)
class tyto.endpoint.SPARQLEndpoint(url)

Bases: SPARQLBuilder, Endpoint

Class which issues SPARQL queries to an endpoint

query(self, ontology, sparql, err_msg)

Issues SPARQL query

convert(self, response)

Converts standard SPARQL query JSON into a flat list.

See https://www.w3.org/TR/2013/REC-sparql11-results-json-20130321/

class tyto.endpoint.GraphEndpoint(file_path)

Bases: SPARQLBuilder, Endpoint

Class for querying a local graph from a file

is_loaded(self)
load(self)
query(self, ontology, sparql, err_msg)
convert(self, response)

Extracts and flattens queried variables from rdflib response into a list

class tyto.endpoint.OntobeeEndpoint

Bases: SPARQLEndpoint

Class which issues SPARQL queries to an endpoint

query(self, ontology, sparql, err_msg)

Issues SPARQL query

class tyto.endpoint.EBIOntologyLookupServiceAPI

Bases: RESTEndpoint

Class for issuing and handling HTTP requests

_load_ontology_ids(self)
_get_request(self, ontology: Ontology, get_request: str)
get_term_by_uri(self, ontology: Ontology, uri: str)
get_uri_by_term(self, ontology: Ontology, term: str)
get_parents(self, ontology: Ontology, uri: str)
get_children(self, ontology: Ontology, uri: str)
get_descendants(self, ontology: Ontology, uri: str)
get_ancestors(self, ontology: Ontology, uri: str)
is_parent_of(self, ontology: Ontology, parent_uri: str, child_uri: str) bool
is_child_of(self, ontology: Ontology, child_uri: str, parent_uri: str) bool
is_descendant_of(self, ontology: Ontology, descendant_uri: str, ancestor: str) bool
is_ancestor_of(self, ontology: Ontology, ancestor_uri: str, descendant_uri: str) bool
get_ontologies(self)
convert(self, response)
query(self, query)
class tyto.endpoint.PUG_REST

Bases: RESTEndpoint

Class for issuing and handling HTTP requests

get_term_by_uri(self, ontology: Ontology, uri: str)
get_uri_by_term(self, ontology: Ontology, term: str)
tyto.endpoint.Ontobee

Endpoint instance representing Ontobee. Ontobee is the default linked data server for most OBO Foundry library ontologies, but is also been used for many non-OBO ontologies.

tyto.endpoint.EBIOntologyLookupService

The Ontology Lookup Service (OLS) is a repository for biomedical ontologies that aims to provide a single point of access to the latest ontology versions. Hosted by the European Bioinformatics Institute

tyto.endpoint.PubChemAPI