Ontologies are top-level entities that can be attached to projects that provide a template structure for labels.

👍

Tip

For a detailed description about ontologies in the Encord platform go here.

ℹ️

Note

A project can only have a single ontology attached to it, but one ontology can be attached to multiple projects.

Each ontology is identified using a unique "<dataset_hash>" - a unique ID that can be found within a dataset in the Encord platform, as highlighted below.

To access the ontology use the get_ontology() method, that allows you to work with its structure property.

from encord import EncordUserClient

user_client: EncordUserClient = EncordUserClient.create_with_ssh_private_key(
    "<your_private_key>"
)

ontology = user_client.get_ontology("<ontology_hash>")


# The <ontology_hash>
"505afc20-0658-44ab-9d62-dc8d940d8e11" 

The structure comes as the OntologyStructure class.

ℹ️

Note

Ontologies cannot be deleted using the SDK or the API. Use the Encord platform to delete an ontology.