View a markdown version of this page

Edit a draft ontology - AWS Context

Edit a draft ontology

Edit the draft until it describes your business the way you want. You edit the draft as a whole. There is no step where you accept or reject each induced class or relationship. To remove a term that you don’t want, delete it from the draft.

You can edit a draft only while its status is DRAFT. Each time you save, AWS Context checks the whole draft. If the checks find an error, AWS Context doesn’t save your change. For more information, see Fix validation issues.

To edit a draft ontology on the AWS Context console, follow these steps:

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

  2. Do one of the following:

    • To add a class or relationship, choose Create, and then choose Create class or Create relationship.

    • To change a class or relationship, choose Edit.

  3. Enter your changes, and then choose Save.

To remove a class or relationship, choose Delete, and then choose Delete in the dialog box.

Each time you save, the console saves the whole draft, and the ontology stays a draft until you publish it. On the console, you can’t go past 128 classes, 2,000 properties, or 49 fields per class. These are the same limits as for an induced draft. For information about all the limits, see Size limits and removed terms.

Edit a draft with the API

To edit a draft with the API, call UpdateOntology with the draft’s ID (ontologyId). Send the whole edited draft in Turtle, a text format for RDF data. Put it in draft.source, and set draft.sourceFormat to TURTLE. Also send the revision ID (revisionId) of the draft that you edited. If the call succeeds, the response has a new revision ID. Use it for your next edit or to publish.

The following example shows the inputs for editing a draft with UpdateOntology.

UpdateOntology ontologyId: <the ontologyId that GetOntologyInduction returned> revisionId: <the revisionId from GetOntology or from your last save> draft: sourceFormat: TURTLE source: <the whole edited draft, in Turtle>

Rules for saving a draft with the API

When you save a draft with UpdateOntology, the following rules apply:

  • Send the whole draft, not only the part that you changed. The draft can be up to 2,000,000 bytes in UTF-8.

  • AWS Context checks the draft at once. If it finds problems, the call fails with a ValidationException, and the draft doesn’t change.

  • If the call succeeds, the ontology stays DRAFT, and the response has a new revisionId.

  • If someone else saved the draft after you read it, the call fails with a ConflictException. Read the draft again with GetOntology, make your change again, and save it.

  • To make the call safe to retry, send a client token (clientToken). AWS SDKs generate one if you don’t set it. A retry with the same token returns the result of the first call, if no other edit was saved after it. While that call is still the last edit saved, the same token with a different request fails with a ValidationException.

  • If the call fails with a ThrottlingException, send the same request again with the same clientToken. AWS SDKs do this for you.

  • Through the API, a draft can go past the size limits for a draft. AWS Context checks the draft against those limits first. If the draft is larger, AWS Context checks it against wider limits: up to 2,000,000 bytes of Turtle, 2,048 classes, 7,952 properties, and 128 fields per class. The 128 fields include inherited fields, but not the name and summary fields.