Start grounding by associating an ontology
To start grounding, associate a published custom ontology with the Agent Context. You associate an ontology with a task. The task runs in the background and imports each ontology that you choose, in order. Each import is a curation change. Under the default curation policy, AWS Context applies the import at once. If a curation policy holds it for review, AWS Context applies it after you approve it. After the import is applied, grounding starts.
You can associate an ontology on the AWS Context console or with the API. If the association fails or no grounding proposals appear, see Troubleshoot structured data grounding.
Associate an ontology on the console
To associate an ontology on the AWS Context console, follow these steps:
-
In the navigation pane, choose Agent context, and then choose your Agent Context.
-
Choose Actions, and then choose Customize context. Customize context is also on the Next steps panel and on the Curation tab.
-
On the Associate ontologies card, choose Associate ontologies.
-
In the table, select one or more ontologies. The table lists only your published custom ontologies. It doesn’t list drafts or built-in ontologies. It still lists an ontology that is already associated with the Agent Context.
-
Choose Associate ontologies.
The console shows the message "Customization task <task-id> created." and opens the Curation tab. The task appears in the Customization tasks table with the task type Ontology association. The table shows the task’s run status and the number of changes that it created.
If a curation policy holds an import for review, its proposal appears on the Curation tab with the other proposals that wait for review. To approve it, follow the steps in Review grounding proposals on the console.
After the import is applied, grounding starts. After grounding runs, its proposals appear on the Curation tab. To review them, see Review and edit grounding proposals.
Associate an ontology with the API
To associate an ontology with the API, call StartTask with your Agent Context (agentContextId) and the ontologies to import (inputConfiguration.importOntology.ontologies). Name each ontology by its ID or ARN (ontologyId). A version (ontologyVersion) is optional. Also send the access control for what the task adds (accessControlConfig). A description (description) and a client token (clientToken) are optional.
The task runs in the background. The response has the task’s ID (id), its ARN (arn), its type (type), which is IMPORT_ONTOLOGY, and its status (status), which is PENDING for a new task.
The following example shows the inputs for StartTask. It isn’t a complete request.
StartTask agentContextId: <agent-context-id> inputConfiguration: importOntology: ontologies: - ontologyId: <ontology-id> accessControlConfig: accessControlList: - access: ALLOW principalId: "*" GetTask agentContextId: <agent-context-id> taskId: <task-id>
Replace the following values:
-
<agent-context-id>– the ID or ARN of your Agent Context. -
<ontology-id>– the ID or ARN of a published custom ontology, fromListOntologiesorGetOntology. To import more than one ontology, add one entry for each. -
<task-id>– the task’sidfrom theStartTaskresponse.
To check the task, call GetTask until its status is final. The task has one of the following statuses.
| Status | What it means |
|---|---|
|
|
The task is waiting to run. |
|
|
The task is importing the ontologies. |
|
|
The task imported every ontology. |
|
|
The task stopped, or at least one ontology wasn’t imported. |
|
|
Someone canceled the task with |
|
|
The task stopped after it was canceled. |
COMPLETED, FAILED, and CANCELLED are final. A task can partly succeed. If it imports some ontologies but not others, its status is FAILED, and statusMessage says how many ontologies it imported. When the task is final, outputs lists the change sets that it created, and statistics counts them. statistics.numberOfChangeSetsAutoApproved counts the imports that the curation policy applied without review.
If a curation policy holds an import for review, approve its curation proposal:
-
Call
ListCurationProposalswithstatusset toPENDING_REVIEW. Find the proposal whosechangeSetIdmatches achangeSetIdin the task’soutputs. The proposal hasgeneratedByset toIMPORT_ONTOLOGY_TASK. -
Call
AcceptCurationProposalwith the proposal’scurationProposalIdandrevisionId.
The following example shows the inputs for ListCurationProposals and AcceptCurationProposal. It isn’t a complete request.
ListCurationProposals agentContextId: <agent-context-id> status: PENDING_REVIEW AcceptCurationProposal agentContextId: <agent-context-id> curationProposalId: <proposal-id> revisionId: <revision-id>
Replace the following values:
-
<agent-context-id>– the ID or ARN of your Agent Context. -
<proposal-id>– the proposal’scurationProposalIdfromListCurationProposals. -
<revision-id>– the proposal’srevisionIdfromListCurationProposals.
For the AcceptCurationProposal request fields, see AcceptCurationProposal and RejectCurationProposal request fields.
The proposal’s status changes to APPROVED. After grounding runs, new proposals with generatedBy set to ONTOLOGY_GROUNDING appear in the curation queue with status PENDING_REVIEW. For a large catalog, the proposals arrive in batches, so the first proposals can appear before grounding has checked every table. For more information, see How structured data grounding works.
For the StartTask request fields, see the next section, StartTask request fields for associating an ontology. If StartTask fails or the task ends FAILED, see FAILED: the association task doesn’t import an ontology. If approving a held import fails, see ValidationException: approving a held import fails.
StartTask request fields for associating an ontology
The following table describes each field in the StartTask request for associating an ontology.
| Field | Description and rules |
|---|---|
|
|
Required. The Agent Context to import the ontologies into, by its ID or ARN. |
|
|
Required. What the task imports. Set exactly one member. To associate ontologies, set |
|
|
Required. In |
|
|
Required. In each entry of |
|
|
Optional. In each entry of |
|
|
Optional, but send it. Who can see what the task adds to the Agent Context. Only one entry is supported in |
|
|
Optional. A description of the task, up to 1,024 characters. It can’t contain control characters. |
|
|
Optional. Makes the request safe to retry. 1 to 64 printable ASCII characters, with no spaces. The token is scoped to your account and the Agent Context. If you reuse a token in the same Agent Context with different parameters, the call fails with a |
You can associate each ontology with an Agent Context only once. If the ontology is already loaded in the Agent Context, the task records that import as failed with ONTOLOGY_ALREADY_IMPORTED. To make grounding check every table again, associate a different published ontology, for example an edited copy that you upload as a new ontology. For more information, see Bring your own ontology and FAILED: the association task doesn’t import an ontology.