create_ontology
¶
create_ontology(
name: OntologyName,
source_format: OntologySourceFormat,
source: OntologySource,
*,
config_overrides: Optional[ContextClientConfig] = None,
client_token: Optional[ClientToken] = None,
description: Optional[UserDefinedString] = None,
tags: Optional[TagMap] = None,
) -> CreateOntologyResponse
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.
Parameters:
-
client_token(Optional[ClientToken], default:None) –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, orsource) is a ValidationException namingclientToken, never a ConflictException. The AWS SDKs generate the token automatically. A request that arrives without a token is a ValidationException. -
name(OntologyName) –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(Optional[UserDefinedString], default:None) –Optional description of the ontology. Part of the idempotency comparison on a replay.
-
source_format(OntologySourceFormat) –The format of
source. The only supported value isTURTLE. -
source(OntologySource) –An OWL ontology to derive the template from, in
sourceFormat. -
tags(Optional[TagMap], default:None) –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 needcontext:TagResourcepermission on the new ontology. If you specify more than 50 user tags, the request fails withServiceQuotaExceededException, as on TagResource. If an AWS Organizations tag policy refuses a tag, the request fails withValidationException.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.
-
InternalServerException–The request failed because of an internal error. Retry the request.
-
ThrottlingException–The request was denied because it exceeded a request rate quota. Wait, then retry the request.
-
ValidationException–The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.
-
ConflictException–The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.
-
ServiceQuotaExceededException–The request would exceed a service quota. Check the quota that
quotaCodenames, reduce your usage, and then retry the request. -
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create an ontology The following example creates an ontology from a Turtle (OWL) document that defines customers, orders, and the relationship between them.
>>> client.create_ontology(client_token='3f1c9a2e-5b7d-4e8f-9a0b-1c2d3e4f5a6b', name='sales-analytics', description='Customers and the orders they place.', source_format='TURTLE', source='@prefix ex: <http://example.com/sales#> .\n@prefix owl: <http://www.w3.org/2002/07/owl#> .\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .\n@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .\n\n<http://example.com/sales> a owl:Ontology .\n\nex:Customer a owl:Class ;\n rdfs:label "Customer" ;\n rdfs:comment "A person or company that places orders." .\n\nex:Order a owl:Class ;\n rdfs:label "Order" ;\n rdfs:comment "A purchase that a customer places." .\n\nex:customerId a owl:DatatypeProperty ;\n rdfs:domain ex:Customer ;\n rdfs:range xsd:string .\n\nex:orderId a owl:DatatypeProperty ;\n rdfs:domain ex:Order ;\n rdfs:range xsd:string .\n\nex:placedOrder a owl:ObjectProperty ;\n rdfs:label "placed order" ;\n rdfs:domain ex:Customer ;\n rdfs:range ex:Order .\n', tags={'team': 'analytics'})
Source code in docs_src/capo_context/_services/context.py
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 | |