Usage

Utilities for interacting with OntoPortal.

class AgroPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for AgroPortal.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'agroportal'

The name of the instance

class BioDivPortal(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for biodiversity ontologies in BioDivPortal.

Create an account and get an API key by starting at https://biodivportal.gfbio.org/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'biodivportal'

The name of the instance

class BioPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for BioPortal.

To get an API key, follow the sign-up process at https://bioportal.bioontology.org/account.

See API documentation at https://data.bioontology.org/documentation.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'bioportal'

The name of the instance

class EarthPortal(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for biodiversity ontologies in EarthPortal.

Create an account and get an API key by starting at https://earthportal.eu/accounts/new.

Warning

This resource is dead

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'earthportal'

The name of the instance

class EcoPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for EcoPortal.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'ecoportal'

The name of the instance

class IndustryPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for industrial ontologies in IndustryPortal.

Create an account and get an API key by starting at https://industryportal.enit.fr/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'industryportal'

The name of the instance

class LovPortal(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for semantic web ontologies in LovPortal.

Create an account and get an API key by starting at https://lovportal.lirmm.fr/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'lovportal'

The name of the instance

class MatPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for materials science ontologies in MatPortal.

Create an account and get an API key by starting at https://matportal.org/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'matportal'

The name of the instance

class MedPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for medical ontologies in MedPortal.

Create an account and get an API key by starting at https://medportal.bmicc.cn/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'medportal'

The name of the instance

class OntoPortalClient(api_key: str, base_url: str)[source]

A client for an OntoPortal site, like BioPortal.

Instantiate the OntoPortal client.

Parameters:
  • api_key – The API key for the OntoPortal instance

  • base_url – The base URL for the OntoPortal instance, e.g., https://data.bioontology.org for BioPortal.

get_json(path: str, params: dict[str, Any] | None = None, **kwargs: Any) Any[source]

Get the response JSON.

get_response(path: str, params: dict[str, Any] | None = None, raise_for_status: bool = True, timeout: int | None = None, **kwargs: Any) Response[source]

Send a GET request the given endpoint on the OntoPortal site.

Parameters:
  • path – The path to query following the base URL, e.g., /ontologies. If this starts with the base URL, it gets stripped.

  • params – Parameters to pass through to requests.get()

  • raise_for_status – If true and the status code isn’t 200, raise an exception

  • timeout – A configurable timeout for sending the request

  • kwargs – Keyword arguments to pass through to requests.get()

Returns:

The response from requests.get()

The rate limit is 15 queries per second. See: https://www.bioontology.org/wiki/Annotator_Optimizing_and_Troublehooting

get_ontologies(summary_only: bool | None = None, notes: bool | None = None) list[dict[str, Any]][source]

Get ontologies.

get_latest_submission(ontology: str, display: str | None = None) dict[str, Any][source]

Get the latest version of the given ontology.

get_ontology_versions(ontology: str) set[str][source]

Get all versions for the given ontology.

annotate(text: str, ontology: str | None = None, require_exact_match: bool = True) list[dict[str, Any]][source]

Annotate the given text.

search(text: str, ontology: str | None = None) Iterable[dict[str, Any]][source]

Search the given text and unroll the paginated results.

search_paginated(text: str, ontology: str | None = None, start: str = '1') Iterable[dict[str, Any]][source]

Search the given text.

get_ancestors(ontology: str, uri: str) list[dict[str, Any]][source]

Get the ancestors of the given class.

get_mappings(ontology_1: str, ontology_2: str, *, progress: bool = False, timeout: int | None = None, display_links: bool = False, display_context: bool = False) Iterable[dict[str, Any]][source]

Get mappings between two ontologies.

class OntoportalAstroClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for astrophysics ontologies in OntoPortal-Astro.

Create an account and get an API key by starting at https://ontoportal-astro.eu/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'ontoportal-astro'

The name of the instance

class PreconfiguredOntoPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for an OntoPortal site, like BioPortal.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str]

The name of the instance

class SIFRBioPortalClient(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for French biomedical ontologies in SIFR BioPortal.

Create an account and get an API key by starting at http://bioportal.lirmm.fr/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'sifr_bioportal'

The name of the instance

class SocioPortal(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for sociology ontologies in SocioPortal.

Create an account and get an API key by starting at https://socioportal.org/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'socioportal'

The name of the instance

class TechnoPortal(api_key: str | None = None, value_key: str = 'api_key')[source]

A client for engineering and technology ontologies in TechnoPortal.

Create an account and get an API key by starting at https://technoportal.hevs.ch/accounts/new.

Instantiate the OntoPortal Client.

Parameters:
  • api_key

    The API key for the instance. If not given, use pystow to read the configuration in one of the following ways. Using BioPortal as an example, where the subclass of PreconfiguredOntoPortalClient sets the class variable name = "bioportal", the configuration can be set in the following ways:

    1. From BIOPORTAL_API_KEY in the environment, where the name is uppercased before _API_KEY

    2. From a configuration file at ~/.config/bioportal.ini and set the [bioportal] section in it with the given key

  • value_key – The name of the key to use. By default, uses api_key

name: ClassVar[str] = 'technoportal'

The name of the instance