

# Review and edit grounding proposals

Each grounding proposal covers one table and one ontology. It proposes adding a link from the table to a class and from each matched column to a property. It can also contain removals. A removal proposes removing a link (a `delete` operation) that grounding no longer recommends.

You can approve a proposal or reject it. Before you approve it, you can also drop individual links from it. You can drop only added links, not removals. On the console, you *delete* a link. With the API, you *drop* the link’s operation. Both remove the link from the proposal.

You can review grounding proposals on the AWS Context console or with the API. If you can’t approve, reject, or edit a proposal, see [Troubleshoot structured data grounding](ontology-grounding-troubleshoot.md).

## Review grounding proposals on the console
<a name="ontology-grounding-review-console"></a>

To review grounding proposals on the AWS Context console, follow these steps:

1. In the navigation pane, choose **Agent context**, and then choose your Agent Context.

1. Choose the **Curation** tab.

1. Find the grounding proposals in the **Changes to review** section. To see every proposal, choose **View all changes**. On the **All changes** page, choose the **Pending** tab, and then filter **Generated by** for **Ontology grounding**.

1. To see the links that a proposal adds or removes, choose the proposal’s link in the **Change** column.

1. (Optional) To keep only some of the added links, choose **Edit change**. Choose the remove icon next to each link that you don’t want, and then choose **Apply edited change**. To discard your edits, choose **Cancel**. Removing a table’s link to a class also removes its column links.

1. To apply the proposal, choose **Approve**. To discard it, choose **Reject**.

You can also approve or reject a proposal from the **Actions** menu of its row on the **All changes** page.

## Review grounding proposals with the API
<a name="ontology-grounding-review-api"></a>

To review grounding proposals with the API, do the following:

1. Call `ListCurationProposals` with `status` set to `PENDING_REVIEW`. Grounding proposals have `generatedBy` set to `ONTOLOGY_GROUNDING`.

1. To read the change set’s current version, call `GetChangeSet` with the proposal’s `changeSetId`. `GetChangeSet` returns the change set’s metadata, including `changeSetVersion`. It doesn’t return the operations.

1. To see the links in the proposal, page through `ListChangeSetOperations` with the same `changeSetId`. Each entry in `items` is one operation: a `put`, an `update`, or a `delete`. The operation has an `entity` with a `nodeId` or an `edgeId`, and `properties`. For a link, `entity` has an `edgeId`, and `properties` includes the `edgeType`.

   In a grounding proposal, each link operation adds a link (a `put` operation) or removes a link (a `delete` operation).

1. (Optional) To drop added links that you don’t want, call `UpdateChangeSet` on the proposal’s change set. Send the `changeSetVersion` from `GetChangeSet`. In `operationsToRemove`, list the operations to drop, copied unchanged from `ListChangeSetOperations`. Follow the rules that the next section, [Rules for editing a grounding proposal](#ontology-grounding-review-rules), describes.

1. If you dropped links, call `GetCurationProposal` to read the proposal’s new `revisionId`.

1. To approve the proposal, call `AcceptCurationProposal`. To reject it, call `RejectCurationProposal`. Send the proposal’s current `revisionId`.

The following example shows the inputs for `GetChangeSet` and `ListChangeSetOperations`. It isn’t a complete request.

```
GetChangeSet
  agentContextId: <agent-context-id>
  changeSetId: <change-set-id>

ListChangeSetOperations
  agentContextId: <agent-context-id>
  changeSetId: <change-set-id>
  nextToken: <next-token>
```

Replace the following values:
+  `<agent-context-id>` – the ID or ARN of your Agent Context.
+  `<change-set-id>` – the proposal’s `changeSetId` from `ListCurationProposals`.
+  `<next-token>` – the `nextToken` from the previous response.

The following example shows the inputs for `UpdateChangeSet`. It isn’t a complete request.

```
UpdateChangeSet
  agentContextId: <agent-context-id>
  changeSetId: <change-set-id>
  changeSetVersion: <version>
  operationsToRemove:
    - <operation>
```

Replace the following values:
+  `<agent-context-id>` – the ID or ARN of your Agent Context.
+  `<change-set-id>` – the proposal’s `changeSetId` from `ListCurationProposals`.
+  `<version>` – the `changeSetVersion` from `GetChangeSet`.
+  `<operation>` – an entry from `items` in `ListChangeSetOperations`, copied unchanged. Add one entry for each operation to drop.

The following example shows the inputs for `AcceptCurationProposal` and `RejectCurationProposal`. It isn’t a complete request.

```
AcceptCurationProposal
  agentContextId: <agent-context-id>
  curationProposalId: <proposal-id>
  revisionId: <revision-id>

RejectCurationProposal
  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’s `curationProposalId` from `ListCurationProposals`.
+  `<revision-id>` – the proposal’s current `revisionId`. If you dropped links, use the value from `GetCurationProposal`. Otherwise, use the value from `ListCurationProposals`.

The proposal’s status changes to `APPROVED` or `REJECTED`. For what happens next, see [What happens after you decide](#ontology-grounding-review-after).

If `AcceptCurationProposal` or `RejectCurationProposal` fails, see [ConflictException: you can’t approve or reject a proposal](ontology-grounding-troubleshoot.md#ontology-grounding-troubleshoot-decide). If `UpdateChangeSet` fails, see [You can’t drop links from a proposal](ontology-grounding-troubleshoot.md#ontology-grounding-troubleshoot-edit).

## Rules for editing a grounding proposal
<a name="ontology-grounding-review-rules"></a>

When you drop links from a grounding proposal, the following rules apply:
+ You can drop only operations that add a link (`put` operations on relationships). You can’t drop a removal (`delete`), and you can’t drop a table, column, or other node operation.
+ To drop a table’s link to a class, also drop all of that table’s column links in the same request.
+ You can drop a single column link on its own.
+ At least one operation must remain in the change set. To drop every link, reject the proposal instead.
+ You can’t restore a dropped link. If you dropped a link by mistake, reject the proposal.
+ Each edit gives the proposal a new `revisionId`. Read the proposal again with `GetCurationProposal` before you approve it. An approval with the earlier `revisionId` fails with a `ConflictException`.

## `UpdateChangeSet` request fields
<a name="ontology-grounding-review-update-reference"></a>

The following table describes each field in the request.


| Field | Description and rules | 
| --- | --- | 
|  `agentContextId`  | Required. The Agent Context that the change set belongs to, by its ID or ARN. A change set of another Agent Context returns a `ResourceNotFoundException`. | 
|  `changeSetId`  | Required. The change set of the proposal, the `changeSetId` that the proposal shows. An edit doesn’t change this ID. | 
|  `changeSetVersion`  | Required. The change set version that you read with `GetChangeSet`. If it isn’t the latest version, the call fails with a `ConflictException`. The response has the new version. Send it in your next `UpdateChangeSet` call. | 
|  `operationsToRemove`  | Required. The operations to drop, up to 1,000. Copy each entry unchanged from `items` in `ListChangeSetOperations`, including its `entity` and `properties`. For a link, `entity` has an `edgeId`, and `properties` includes the `edgeType`. Each entry must match exactly one current operation. To drop more than 1,000 operations, make multiple calls. | 
|  `clientToken`  | Optional. Makes the request safe to retry. 1 to 64 printable ASCII characters, with no spaces. If you repeat the same request with the same token within 8 hours, AWS Context returns the change set’s latest version. It doesn’t change the change set again. If you reuse the token for another change set or for a different request, the call fails with a `ValidationException`. AWS SDKs generate a token if you don’t set one. | 

## `AcceptCurationProposal` and `RejectCurationProposal` request fields
<a name="ontology-grounding-review-reference"></a>

 `AcceptCurationProposal` and `RejectCurationProposal` take the same fields. The following table describes each field in the request.


| Field | Description and rules | 
| --- | --- | 
|  `agentContextId`  | Required. The Agent Context that the proposal belongs to, by its ID or ARN. A proposal of another Agent Context returns a `ResourceNotFoundException`. | 
|  `curationProposalId`  | Required. The ID of the proposal, from `ListCurationProposals`. | 
|  `revisionId`  | Required. The revision ID of the proposal, as you last read it. If the proposal changed after you read it, the call fails with a `ConflictException`. | 
|  `clientToken`  | Optional. Makes the request safe to retry. 1 to 64 printable ASCII characters, with no spaces. If you repeat the same request with the same token within 8 hours, AWS Context returns the proposal’s current state. It doesn’t change the proposal again. If you reuse the token for another proposal, the call fails with a `ValidationException`. AWS SDKs generate a token if you don’t set one. | 

## What happens after you decide
<a name="ontology-grounding-review-after"></a>
+  **Approve** – Applies the links. If the change can’t be applied, the proposal and its change set end with status `FAILED`.
+  **Reject** – Discards the links. AWS Context doesn’t propose the same links for that table again, with no time limit. The proposal stays suppressed until the links that grounding would propose change or the table’s current links change. Then grounding can propose the links again as a new proposal.
+  **No decision** – A curation policy that holds the proposal can set an auto-reject window. Under the default curation policy, the window is 14 days. When the window ends, AWS Context rejects the proposal with `statusReasonCode` `REQUEST_EXPIRED`. The proposal’s `expiresAt` value shows when the window ends. A proposal that AWS Context rejects this way stays suppressed in the same way as one that you reject.

The default curation policy holds grounding proposals for review. If the Agent Context’s curation policy doesn’t hold them, AWS Context applies grounding proposals without review.