

# GetOntology

Returns an ontology's status and one of its versions.

## Request Parameters
<a name="API_GetOntology_RequestParameters"></a>

 ** ontologyId **   
The ontology to return, by its ID or ARN (see `OntologyIdentifier`).  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:(\d{12})?:ontology/)?[a-z0-9]+(-[a-z0-9]+)*`   
Required: Yes

 ** sourceFormat **   
Return the version's source document in `source`, in this format, in place of the template. The response then has no `template`. The format must be the version's `sourceFormat`. On a `DRAFT` ontology, GetOntology returns the draft, with or without `version` (its only version is 1.0.0). If the ontology is AWS managed, whose source is never returned, or the version has no source document, the request fails with `ValidationException`. If you omit it, the response has the template and no source.  
Type: String  
Valid Values: `TURTLE`   
Required: No

 ** version **   
The version to return, in MAJOR.MINOR.PATCH form, for example `1.0.0`. If you omit it, GetOntology returns the current default version.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)`   
Required: No

## Response Elements
<a name="API_GetOntology_ResponseElements"></a>

The following elements are returned by the service.

 ** arn **   
The ARN of the ontology. It has no account for an AWS managed ontology, and includes the account for a customer-owned one. Use it to address the same ontology again.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1011.  
Pattern: `arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:(\d{12})?:ontology/[a-z0-9]+(-[a-z0-9]+)*` 

 ** createdAt **   
When this version was created. Absent when the stored version carries no creation time.  
Type: Timestamp

 ** derivationVersion **   
Identifies the derivation rules that produced this template. Node ID formulas don't change after a version is published.  
Type: String

 ** description **   
The ontology's description. The same for every version. Absent when the ontology has none.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 1024.  
Pattern: `\P{Cc}*` 

 ** id **   
The ID of the ontology, assigned by AWS Context.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:(\d{12})?:ontology/)?[a-z0-9]+(-[a-z0-9]+)*` 

 ** name **   
The ontology's current display name. The same for every version. Absent for an AWS managed ontology, which has no name, and for a customer-owned ontology that was created without a name and hasn't been named since.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `[^\s\p{Cc}\p{Z}\p{Cf}](\P{Cc}*[^\s\p{Cc}\p{Z}\p{Cf}])?` 

 ** ontologyInductionId **   
The induction that made the ontology. Absent for an ontology CreateOntology made.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 180.  
Pattern: `(arn:(aws|aws-cn|aws-us-gov):context:[a-z0-9\-]{1,32}:\d{12}:ontology-induction/)?oi-[a-z0-9]+(-[a-z0-9]+)*` 

 ** publishedAt **   
Publish time of the DEFAULT version. Absent for non-default versions, and while the ontology is DRAFT: a DRAFT ontology stays a draft until you publish it in the AWS Context console.  
Type: Timestamp

 ** revisionId **   
The revision of the draft. Set only for a DRAFT ontology.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 64.  
Pattern: `[\x21-\x7E]+` 

 ** source **   
The source document of the returned version, or the draft of a `DRAFT` ontology, with or without `version`. Set only when the request set `sourceFormat`. Absent otherwise.  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2000000.

 ** sourceFormat **   
The format of the version's source document. On a `DRAFT`, `TURTLE`, the format of the draft. Set whether or not the request asked for `source`, and a `source` in the response is in this format. On an AWS managed ontology, it names the format that its template was derived from, but its source is never returned (see `sourceFormat` on the request).  
Type: String  
Valid Values: `TURTLE` 

 ** status **   
The ontology's status. PUBLISHED for every ontology CreateOntology made. Check it before using the template: a DRAFT ontology stays a draft until you publish it in the AWS Context console, and until then its template is the empty template of version 1.0.0 and GetOntology returns the draft.  
Type: String  
Valid Values: `DRAFT | PUBLISHED` 

 ** template **   
The serialized template JSON for this version (see OntologyTemplate).  
Type: String  
Length Constraints: Minimum length of 0. Maximum length of 2000000.

 ** updatedAt **   
When the ontology itself last changed. Equal to the ontology's creation time until the first update. The top-level `createdAt` (from the version fields) is the returned version's creation time, not the ontology's.  
Type: Timestamp

 ** validationIssues **   
Non-fatal warnings raised while deriving the returned version. On a DRAFT, the warnings from deriving the draft.  
Type: Array of [OntologyValidationIssue](API_OntologyValidationIssue.md) objects  
Array Members: Minimum number of 0 items. Maximum number of 100 items.

 ** version **   
The version of the ontology, in MAJOR.MINOR.PATCH form, for example `1.0.0`.  
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 128.  
Pattern: `(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)` 

## Errors
<a name="API_GetOntology_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** AccessDeniedException **   
You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.    
 ** message **   
A message that describes the error.
HTTP Status Code: 403

 ** InternalServerException **   
The request failed because of an internal error. Retry the request.    
 ** message **   
A message that describes the error.
HTTP Status Code: 500

 ** ResourceNotFoundException **   
The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.    
 ** message **   
A message that describes the error.  
 ** resourceId **   
The ID of the resource that was not found.  
 ** resourceType **   
The type of the resource that wasn't found.  
Valid values:  
+  `agent-context` - An agent context.
+  `connection` - A connection.
+  `curation-policy` - A curation policy.
+  `evaluation` - Reserved for future use.
+  `ontology` - An ontology.
+  `ontology-induction` - An ontology induction.
+  `resource-policy` - A resource-based policy.
HTTP Status Code: 404

 ** ThrottlingException **   
The request was denied because it exceeded a request rate quota. Wait, then retry the request.    
 ** message **   
A message that describes the error.  
 ** quotaCode **   
The code of the quota that throttled the request.  
 ** retryAfterSeconds **   
The number of seconds to wait before you retry the request, if AWS Context provides one.  
 ** serviceCode **   
The code of the service whose quota throttled the request.
HTTP Status Code: 429

 ** ValidationException **   
The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.    
 ** fieldList **   
The fields that failed validation, each with a message that describes why.  
 ** message **   
A message that describes the error.  
 ** reason **   
The reason that the input failed validation. Valid values:  
+  `unknownOperation` - The operation isn't recognized.
+  `cannotParse` - The request couldn't be parsed.
+  `fieldValidationFailed` - One or more fields failed validation. `fieldList` describes them.
+  `other` - Another reason. `message` describes it.
HTTP Status Code: 400

## See Also
<a name="API_GetOntology_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/context-2022-07-26/GetOntology) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/context-2022-07-26/GetOntology) 
+  [AWS SDK for C\+\+](https://docs.aws.amazon.com/goto/SdkForCpp/context-2022-07-26/GetOntology) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/context-2022-07-26/GetOntology) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/context-2022-07-26/GetOntology) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/context-2022-07-26/GetOntology) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/context-2022-07-26/GetOntology) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/context-2022-07-26/GetOntology) 
+  [AWS SDK for Python (Boto3)](https://docs.aws.amazon.com/goto/boto3/context-2022-07-26/GetOntology) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/context-2022-07-26/GetOntology) 