An Ontology contains all of the classes used for labeling assets in a Project.

For a complete list of fields for Ontology, see the Docs tab in the API explorer.

Get an ontology

Use the project query to get an existing ontology for a project.

query GetOntology { 
    project (where: {id: "<PROJECT_ID>"}) { 
        ontology { 
            normalized
            id 
        } 
    }
}

Clone an ontology

A cloned ontology is a copy of an existing ontology. Any changes made to the ontology will not affect the ontology it was cloned from. Note: Cloning ontologies from the legacy editor to the new editor is not supported.

Use the cloneOntology mutation to target the ontology by id and clone it.

mutation CloneOntologyFromProject {
    project (where: {id: "<PROJECT_ID>"}) {
        cloneOntology (ontologyId: "<TARGET_ONTOLOGY_ID>"){
            id
            name
        }
    }
}

Connect an ontology

Connecting an existing ontology is useful if you have multiple projects that must reference the same exact ontology. Any changes made to an ontology will affect all projects sharing that ontology. Note: Connecting ontologies from the legacy editor to the new editor is not supported.

Use the connectableOntologies query to list all ontologies that can be shared with a given project.

Then, use the connectOntology mutation to connect that ontology to your project.

query ConnectableOntologies {
    project (where: { id: "<PROJECT_ID>" }) {
        connectableOntologies {
            id
            name
        }
    }
}
mutation ConnectOntologyToProject {
    project (where: {id: "<PROJECT_ID>"}) {
        connectOntology (ontologyId: "<TARGET_ONTOLOGY_ID>"){
            id
            name
        }
    }
}

Rename an ontology

Use the update mutation to rename an ontology.

mutation RenameOntology {
    ontology (where: { id: "<ONTOLOGY_ID>" }) {
        update (data: {
            name: "<NEW_NAME>"
        }) {
            id
            name
        }
    }
}