> ## 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.
</Warning>

<Frame caption="Ontology editing tool showing object creation">
  <img src="https://mintcdn.com/textql/_MjEsXv_WMgj05pB/images/tool/ontology_editor.png?fit=max&auto=format&n=_MjEsXv_WMgj05pB&q=85&s=35118b65f177cc95dea189cba56295f1" alt="Ontology editing tool showing object creation" width="3344" height="1928" data-path="images/tool/ontology_editor.png" />
</Frame>

## <Icon icon="wand-magic-sparkles" iconType="solid" /> What It Does

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

<CardGroup cols={2}>
  <Card title="Create Objects" icon="plus">
    Add new business entities that map to your database tables
  </Card>

  <Card title="Define Metrics" icon="calculator">
    Create or modify metrics with their SQL calculation logic
  </Card>

  <Card title="Update Dimensions" icon="sliders">
    Add or modify attributes for grouping and filtering
  </Card>

  <Card title="Manage Links" icon="link">
    Create or edit relationships between objects
  </Card>

  <Card title="Delete Elements" icon="trash">
    Remove objects, metrics, dimensions, or links that are no longer needed
  </Card>

  <Card title="Refine Definitions" icon="pen-to-square">
    Update descriptions, names, and configurations
  </Card>
</CardGroup>

## <Icon icon="circle-check" iconType="solid" /> When to Use

Enable Ontology Editing when:

<Tabs>
  <Tab title="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>

  <Tab title="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>

  <Tab title="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>

  <Tab title="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.
  </Tab>
</Tabs>

## <Icon icon="robot" iconType="solid" /> 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.

### <Icon icon="gears" /> How It Works

<Steps>
  <Step title="Ana Proposes Change">
    Ana suggests creating, updating, or deleting an object, attribute, link, or metric.
  </Step>

  <Step title="Approval Decision">
    **Without Auto Approve:** Ana pauses and waits for your manual approval.

    **With Auto Approve:** Changes are automatically approved and applied.
  </Step>

  <Step title="Change Applied">
    The ontology is updated immediately, allowing the conversation to continue seamlessly.
  </Step>
</Steps>

### <Icon icon="toggle-on" /> When to Use Auto Approve

<CardGroup cols={2}>
  <Card title="Trusted Environment" icon="shield-check">
    You trust Ana to make ontology changes without review and are comfortable with automated modifications
  </Card>

  <Card title="Rapid Building" icon="bolt">
    You're in rapid ontology building or refinement sessions and want uninterrupted workflows
  </Card>

  <Card title="Development Mode" icon="flask">
    You're working in a development or testing environment, not production
  </Card>

  <Card title="Iterative Refinement" icon="arrows-rotate">
    You're quickly iterating on structure and can review changes afterward
  </Card>
</CardGroup>

### <Icon icon="key" /> 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.
</Note>

<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.
</Warning>

## <Icon icon="lightbulb" iconType="solid" /> Best Practices

<Steps>
  <Step title="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.
  </Step>

  <Step title="Review Changes After">
    Even with auto approve enabled, review what Ana changed to ensure it matches your expectations and business logic.
  </Step>

  <Step title="Use in Development First">
    Test ontology editing in a development environment before using in production. Build confidence in the feature.
  </Step>

  <Step title="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"
  </Step>

  <Step title="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.
  </Step>
</Steps>

## <Icon icon="triangle-exclamation" iconType="solid" /> Common Pitfalls to Avoid

<AccordionGroup>
  <Accordion title="Leaving It Enabled Permanently" icon="toggle-on">
    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>

  <Accordion title="Not Reviewing Changes" icon="eye-slash">
    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>

  <Accordion title="Unclear Instructions" icon="question">
    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>

  <Accordion title="Skipping Development Testing" icon="flask-vial">
    Always test ontology editing in a development environment first, especially with auto approve enabled.

    **Why:** You can experiment freely without impacting production analytics.
  </Accordion>
</AccordionGroup>

## <Icon icon="book-open" iconType="solid" /> Related Documentation

<CardGroup cols={2}>
  <Card title="Ontology Overview" icon="map" href="/core/ontology/overview">
    Learn the fundamentals of ontologies in TextQL
  </Card>

  <Card title="Ontology Query Tool" icon="magnifying-glass" href="/core/how-it-works/tools/ontology">
    Use your ontology for querying (without editing)
  </Card>

  <Card title="Creating Objects" icon="cube" href="/core/ontology/build-your-ontology">
    Manual guide to creating objects
  </Card>

  <Card title="Defining Metrics" icon="calculator" href="/core/ontology/build-your-ontology">
    Manual guide to defining metrics
  </Card>
</CardGroup>
