> ## 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 Editing

> Let Ana modify your semantic layer

Grants Ana the ability to modify and update your ontology directly during conversations.

> [!WARNING]
>
> **Powerful Feature:** This tool allows Ana to make structural changes to your semantic layer. Use with caution and review changes carefully.

![Ontology editing tool showing object creation](https://mintcdn.com/textql/_MjEsXv_WMgj05pB/images/tool/ontology_editor.png?fit=max\&auto=format\&n=_MjEsXv_WMgj05pB\&q=85\&s=35118b65f177cc95dea189cba56295f1)

Ontology editing tool showing object creation

## &#x20;What It Does

When Ontology Editing is enabled, Ana can perform these operations:

> [card] Create Objects
>
> Add new business entities that map to your database tables

> [card] Define Metrics
>
> Create or modify metrics with their SQL calculation logic

> [card] Update Dimensions
>
> Add or modify attributes for grouping and filtering

> [card] Manage Links
>
> Create or edit relationships between objects

> [card] Delete Elements
>
> Remove objects, metrics, dimensions, or links that are no longer needed

> [card] Refine Definitions
>
> Update descriptions, names, and configurations

## &#x20;When to Use

Enable Ontology Editing when:

> [tab] Building From Scratch
>
> **You want Ana to help build your ontology from scratch**
>
> Ana can explore your database schema and suggest logical objects, metrics, and relationships based on your data structure.
>
> **Example:** "Create an ontology for my e-commerce database with customer, order, and product objects"

> [tab] Refining Existing
>
> **You're refining your semantic layer based on conversation**
>
> As you chat with Ana and discover new metrics or relationships, you can ask Ana to add them to your ontology on the fly.
>
> **Example:** "Add a 'customer lifetime value' metric to the customers object"

> [tab] Quick Additions
>
> **You want to quickly add new metrics or dimensions**
>
> Instead of manually navigating to the ontology UI, you can ask Ana to make quick additions during your analysis.
>
> **Example:** "Create a dimension for order status in the orders object"

> [tab] Iterative Development
>
> **You trust Ana to make structural changes to your data model**
>
> For rapid development and iteration, you can let Ana make changes as you refine your understanding of the data.

## &#x20;Auto Approve for Ontology Edits

When Auto Approve is enabled, Ana automatically approves all ontology changes without requiring manual review. This allows conversations to continue uninterrupted while Ana makes ontology modifications.

### &#x20;How It Works

**1. Ana Proposes Change**

Ana suggests creating, updating, or deleting an object, attribute, link, or metric.

**2. Approval Decision**

**Without Auto Approve:** Ana pauses and waits for your manual approval.

**With Auto Approve:** Changes are automatically approved and applied.

**3. Change Applied**

The ontology is updated immediately, allowing the conversation to continue seamlessly.

### &#x20;When to Use Auto Approve

> [card] Trusted Environment
>
> You trust Ana to make ontology changes without review and are comfortable with automated modifications

> [card] Rapid Building
>
> You're in rapid ontology building or refinement sessions and want uninterrupted workflows

> [card] Development Mode
>
> You're working in a development or testing environment, not production

> [card] Iterative Refinement
>
> You're quickly iterating on structure and can review changes afterward

### &#x20;Requirements

> [!NOTE]
>
> You must have `ontology:write` permissions for auto approve to function. Without these permissions, changes will still require manual approval even if auto approve is enabled.

> [!WARNING]
>
> **Production Warning:** Auto approve applies to all ontology changes in a chat session. Use with extreme caution in production environments where you want to review changes before they're applied.

## &#x20;Best Practices

**1. Start with Manual Approval**

Don't enable auto approve until you're comfortable with how Ana structures your ontology. Watch how it makes decisions for a few edits first.

**2. Review Changes After**

Even with auto approve enabled, review what Ana changed to ensure it matches your expectations and business logic.

**3. Use in Development First**

Test ontology editing in a development environment before using in production. Build confidence in the feature.

**4. Provide Clear Instructions**

Give Ana specific guidance about naming conventions, structure preferences, and business logic.

**Good:** "Create a metric called 'Monthly Recurring Revenue' that sums subscription amounts"

**Vague:** "Add a revenue metric"

**5. Disable When Done**

Turn off ontology editing once you've finished building or refining your semantic layer. Don't leave it on for regular analytics chats.

## &#x20;Common Pitfalls to Avoid

> [accordion] Leaving It Enabled Permanently
>
> Don't leave Ontology Editing enabled for day-to-day analytics. Only enable it when you're actively building or refining your ontology.
>
> **Why:** You might accidentally modify your ontology during a regular analysis conversation.

> [accordion] Not Reviewing Changes
>
> Even with auto approve, always review changes afterward to ensure they align with your business logic and naming conventions.
>
> **Tip:** Check the ontology UI after each editing session to see what changed.

> [accordion] Unclear Instructions
>
> Vague instructions lead to unpredictable results. Be specific about what you want Ana to create or modify.
>
> **Example:** Instead of "add metrics", say "add a 'Total Orders' metric that counts distinct order IDs"

> [accordion] Skipping Development Testing
>
> Always test ontology editing in a development environment first, especially with auto approve enabled.
>
> **Why:** You can experiment freely without impacting production analytics.

## &#x20;Related Documentation

> [card] [Ontology Overview](https://docs.textql.com/core/ontology/overview.md)
>
> Learn the fundamentals of ontologies in TextQL

> [card] [Ontology Query Tool](https://docs.textql.com/core/how-it-works/tools/ontology)
>
> Use your ontology for querying (without editing)

> [card] [Creating Objects](https://docs.textql.com/core/ontology/build-your-ontology.md)
>
> Manual guide to creating objects

> [card] [Defining Metrics](https://docs.textql.com/core/ontology/build-your-ontology.md)
>
> Manual guide to defining metrics


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.