Table of Contents

Ontologies

Alex Cota Updated by Alex Cota

An ontology contains all of the classes used for labeling assets in a project.

This page includes sample queries and mutations for fetching and reusing ontologies.

Get an ontology

Use this GraphQL query to get an existing ontology for a project.

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

Reuse an ontology

There are two ways to reuse ontologies between projects:

  1. Share. This method is useful if you have multiple projects that must reference the same exact ontology. Any changes made to a
    ontology will affect to all projects sharing that ontology.
  2. Clone. Use this method if to make a copy of an existing ontology instead of making one from scratch. Any changes made to the
    ontology will not affect the master ontology it was cloned from.
Note: Only ontologies from projects within the new Editor can be connected or cloned. Reusing an ontology from the legacy editor to the new editor is not supported.
Option 1: Connect a shared ontology

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

query connectableOntologies {
project(where: { id: "<PROJECT_ID>" }) {
connectableOntologies {
id
name
}
}
}

Then, connect that ontology to your project.

mutation connectOntologyToProject {
project(where: {id: "<PROJECT_ID>"}) {
connectOntology(ontologyId: "<TARGET_ONTOLOGY_ID>"){
id
name
}
}
}
Option 2: Clone an ontology

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
}
}
}

Rename an ontology

Use this mutation to rename an ontology.

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

Was this page helpful?

Data types overview

Datasets

Contact