> ## Documentation Index
> Fetch the complete documentation index at: https://docs.textql.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ontology Overview

The ontology is the "view" that TextQL (particularly, the 'ontology' tool) has into a connected data warehouse.
It delineates the logical concepts that exist within your business in a way that is easy for TextQL's AI to understand and generate correct queries.

You construct an ontology for your company by defining objects, attributes, and links.

<Frame caption="Example ontology for a ticket selling business. The ontology (left center) is comprised of objects denoting concepts core to the business, each tied to a subset of the user's data warehouse. Links describe related data concepts, such as 'Events at Venues'.">
  <img height="200" src="https://mintcdn.com/textql/TODRj2ocYnane3o1/images/how-it-works/ontology/ontology-v2.png?fit=max&auto=format&n=TODRj2ocYnane3o1&q=85&s=28b9b83be36214aba794de61f79b506d" alt="Example Ontology" data-path="images/how-it-works/ontology/ontology-v2.png" />
</Frame>

Compared to generating SQL directly from schema annotations, an ontology has the following advantages:

* The ontology is structured. It is fully known what parts of an AI generated query map onto which parts of the ontology.
* Ontology queries are much easier for a non-technical user to understand compared to direct SQL.
* Ontologies can be progressively improved without changing the underlying data model.
  They are designed to work reasonably on a mapping that is very similar to the data warehouse ERD and only get better with incremental improvements that still don't change the underlying data infrastructure.
* Ontologies can be improved in a deterministic manner; if the definition of a KPI in the ontology is changed, TextQL is forced to compute that definition in the calculation.

<Tip>
  **Automatic Ontology Generation**: TextQL supports automatic generation of ontology components:

  * **Attribute Auto-Inference**: When adding objects from tables, attributes are automatically inferred from table schemas, including column types and primary keys
  * **Alation Integration**: Import complete ontologies from Alation data catalog, including objects, attributes, and relationships based on join metadata

  Full automatic ontology generation from arbitrary database ERDs (without Alation) is a work in progress.
</Tip>
