

# Cancel or delete an ontology induction

You can stop an induction that is still running. You can also delete an induction when you no longer need it. Canceling and deleting do different things:
+  **Cancel** an induction to stop it while it runs, such as when you chose the wrong documents. A canceled induction doesn’t create an ontology. It also stops counting toward the quota for inductions in progress. For information about the quota, see [`StartOntologyInduction` request fields](ontology-induce-start.md#ontology-induce-start-reference).
+  **Delete** an induction to remove it from your account. While its ontology is a draft, you delete both by deleting the ontology. What you can delete depends on the status of the induction and of its ontology.

## Cancel an induction
<a name="ontology-induce-cancel"></a>

You can cancel an induction only while its status is `INDUCING` (**Inducing**). After you cancel it, its status changes to `CANCELLED`, and it doesn’t create an ontology. `CANCELLED` is final. To try again, start a new induction.

To stop an induction that you no longer need, cancel it on the AWS Context console or with the API.

To cancel an ontology induction on the console, follow these steps:

1. On the **Ontologies** page, open the induction that you want to cancel.

1. Choose **Actions**, and then choose **Cancel generation**.

1. In the **Cancel generation** dialog box, choose **Cancel generation**.

To cancel an induction with the API, call [`CancelOntologyInduction`](https://docs.aws.amazon.com/context/latest/APIReference/API_CancelOntologyInduction.html). Canceling an induction that is already `CANCELLED` succeeds. You can’t cancel an induction that is `DRAFT` or `FAILED`. The call fails with a `ConflictException`.

## Delete an induction
<a name="ontology-induce-delete"></a>

What you can delete depends on the status of the induction and of its ontology:
+ While the induction is running, you can’t delete it. Cancel it first.
+ A failed or canceled induction has no ontology. You can delete the induction.
+ While the ontology is a draft, you delete the ontology and its induction together. To do so, delete the ontology.
+ After you publish the ontology, the induction and the ontology are separate. You can delete either one, and the other one stays.

To delete an induction with the API, call [`DeleteOntologyInduction`](https://docs.aws.amazon.com/context/latest/APIReference/API_DeleteOntologyInduction.html). To delete an ontology, call [`DeleteOntology`](https://docs.aws.amazon.com/context/latest/APIReference/API_DeleteOntology.html). For information about how to delete an ontology on the console or with the API, see [Delete an ontology](ontology-delete.md). The following table shows the result of each call.

## Results of each delete call
<a name="ontology-induce-delete-reference"></a>

The following table shows what each delete call does, by the status of the induction and of its ontology.


| Induction | Ontology |  `DeleteOntologyInduction`  |  `DeleteOntology`  | 
| --- | --- | --- | --- | 
|  `INDUCING`  | None yet | Fails with a `ConflictException`. Cancel the induction first. | Not applicable | 
|  `FAILED` or `CANCELLED`  | None | Deletes the induction. | Not applicable | 
|  `DRAFT`  |  `DRAFT`  | Fails with a `ConflictException`. | Deletes the draft ontology and its induction together. | 
|  `DRAFT`  |  `PUBLISHED`  | Deletes the induction. The ontology doesn’t change. | Deletes the ontology. The induction stays. | 

 `DeleteOntology` fails with a `ConflictException`, and AWS Context deletes nothing, in the following cases:
+ An Agent Context uses the ontology. The exception lists the Agent Contexts that use it. Remove the ontology from those Agent Contexts, or delete the ones that are `FAILED`, and then try again. For information about how to remove an ontology from an Agent Context, see [Remove an ontology from Agent Contexts](ontology-delete-find-usage.md).
+ You just removed the ontology from an Agent Context. For up to 5 minutes, the exception can still list that Agent Context. Retry the call.
+ An Agent Context is still being created or updated. Wait until it finishes, and then try again.
+ An Agent Context was created or updated with a mapping to the ontology in the last 5 minutes. Retry the call after that time.
+ The ontology changed while the call ran. Retry the call.

For information about each `ConflictException` from `DeleteOntology`, see [Troubleshoot deleting an ontology](ontology-delete-troubleshooting.md).