Context / Client / create_ontology

create_ontology

Context.Client.create_ontology(**kwargs)

Creates an ontology from an OWL ontology document. An ontology defines the types of nodes and edges in an agent context. Returns the new ontology’s ID and ARN.

See also: AWS API Documentation

Request Syntax

response = client.create_ontology(
    clientToken='string',
    name='string',
    description='string',
    sourceFormat='TURTLE',
    source='string',
    tags={
        'string': 'string'
    }
)
Parameters:
  • clientToken (string) –

    Client idempotency token. A reused token with an identical request returns the existing ontology with no second write. A reused token with a different request (any member differs, for example name, description, sourceFormat, or source) is a ValidationException naming clientToken, never a ConflictException. The AWS SDKs generate the token automatically. A request that arrives without a token is a ValidationException.

    This field is autopopulated if not provided.

  • name (string) –

    [REQUIRED]

    Friendly display name for the ontology (for example, “Sales Org”). AWS Context assigns the ontology its opaque ID. This name is a non-unique label. You can rename the ontology in the AWS Context console.

  • description (string) – Optional description of the ontology. Part of the idempotency comparison on a replay.

  • sourceFormat (string) –

    [REQUIRED]

    The format of source. The only supported value is TURTLE.

  • source (string) –

    [REQUIRED]

    An OWL ontology to derive the template from, in sourceFormat.

  • tags (dict) –

    Tags to add to the ontology when you create it: up to 200 in the request, of which at most 50 can be user tags. Keys can’t start with aws:. To add tags, you also need context:TagResource permission on the new ontology. If you specify more than 50 user tags, the request fails with ServiceQuotaExceededException, as on TagResource. If an AWS Organizations tag policy refuses a tag, the request fails with ValidationException.

    • (string) –

      A tag key. Leading and trailing whitespace is trimmed. Keys starting with aws: are reserved for AWS.

      • (string) –

        A tag value. Leading and trailing whitespace is trimmed.

Return type:

dict

Returns:

Response Syntax

{
    'id': 'string',
    'arn': 'string',
    'updatedAt': datetime(2015, 1, 1),
    'name': 'string',
    'description': 'string',
    'version': 'string',
    'validationIssues': [
        {
            'code': 'string',
            'message': 'string',
            'line': 123,
            'subject': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    The created ontology’s identity, and any derivation warnings. GetOntology returns the version’s details, and ListOntologies ( OntologySummary) returns its node and edge type counts.

    • id (string) –

      The ID of the ontology, assigned by AWS Context.

    • arn (string) –

      The ARN of the created ontology.

    • updatedAt (datetime) –

      When the ontology last changed. On create, the creation time. On a replay, the current value.

    • name (string) –

      The display name as stored. On a replay, the current one.

    • description (string) –

      The description as stored. Absent when there is none. On a replay, the current one.

    • version (string) –

      The initial version that CreateOntology created, in MAJOR.MINOR.PATCH form, for example 1.0.0.

    • validationIssues (list) –

      Non-fatal warnings from the derivation, such as SYNTHESIZED_NODE_ID or a widened datatype. AWS Context also stores them on the version, and GetOntology returns them in validationIssues. Absent or empty if the derivation produced no warnings.

      • (dict) –

        One reason an uploaded ontology was rejected, or a non-fatal warning about a construct that could not be fully represented in the derived template, also in the draft of an induced ontology.

        • code (string) –

          A code that identifies the issue, such as RDF_PARSE_ERROR or UNMAPPABLE_CLASS. New codes can be added, so handle a code that you don’t recognize.

        • message (string) –

          A human-readable description of the issue.

        • line (integer) –

          1-based line in the uploaded source, when the failure is attributable to a specific triple.

        • subject (string) –

          What the issue is about, when attributable. From an ontology operation, such as GetOntology: the offending subject/predicate IRI. In the draft of an induced ontology, the IRI of a term.

Exceptions

  • Context.Client.exceptions.ThrottlingException

  • Context.Client.exceptions.ConflictException

  • Context.Client.exceptions.ValidationException

  • Context.Client.exceptions.ServiceQuotaExceededException

  • Context.Client.exceptions.InternalServerException

  • Context.Client.exceptions.AccessDeniedException