

# Prepare your ontology file

Before you upload your ontology, check that your Turtle file meets the following requirements.
+  **Declare your classes** – Declare at least one class with `owl:Class` or `rdfs:Class`.
+  **Give each property a domain** – Name the class that a property belongs to with `rdfs:domain` or `schema:domainIncludes` so that AWS Context adds that property to the class.
+  **Keep everything in one file** – Include all the terms that your ontology needs in the file. Copy any terms that you need from another ontology into your file. A file that uses `owl:imports` can’t be uploaded.
+  **Use your own namespace** – Use a namespace that you own for your terms.
+  **Use unique names** – Give each class in a namespace its own local name, and give each property on a class its own local name.
+  **Stay within the limits** – Check the size of your file against [Limits for an uploaded ontology](ontology-byo-limits.md).

To get the best results, describe your ontology clearly:
+  **Name classes and properties for what they mean** – Use the words that people use in questions. AWS Context then sorts the information that it extracts into the right classes, and search can match your terms. For example, use `InsuranceClaim` rather than `IC01`.
+  **Describe each class and property** – Add a definition with `rdfs:comment` or `skos:definition`. Search matches definitions, and the retrieval agent reads them.
+  **Mention other names** – In a term’s definition, mention other names that your business uses for it, such as code names and abbreviations.
+  **Link related terms with standard predicates** – Some links between terms have a standard predicate. Link equivalent terms with `owl:equivalentClass`, a renamed term with `dcterms:replaces`, and a more specific kind with `rdfs:subClassOf`. The retrieval agent gets guidance on what these links mean. For other links, you can use predicates of your own. For more detail, see [What links between terms mean](agentic-retrieval-custom-ontology.md#agentic-retrieval-custom-ontology-links).
+  **Write business rules on their class** – Write business rules as Shapes Constraint Language (SHACL) shapes or Web Ontology Language (OWL) restrictions on the class that they apply to. The retrieval agent then gets the complete rule when a question involves the class.
+  **Keep each ontology focused** – Cover one business area and the concepts that your questions need.
+  **Add an identifying property** – Give each class a property, such as `customerId` or `id`, with a string or integer value so that AWS Context can build a stable ID for each item of that class. If a class has none, AWS Context adds an `id` property. You can’t change these IDs after you upload the ontology.