Edit

Share via


Ontology (preview) tutorial part 0: Introduction and environment setup

This tutorial shows how to create your first ontology (preview) in Microsoft Fabric, either by generating it from an existing Power BI semantic model or by building it from your OneLake data. Then, enrich the ontology with live operational data, and explore it with both graph preview and natural-language (NL) queries through Fabric data agent.

Important

This feature is in preview.

The example scenario for this tutorial is a fictional company called Lakeshore Retail. Lakeshore is a retail ice cream seller that keeps data on sales and freezer streaming data. In the tutorial, you generate entity types like Store, Products, and SaleEvent. You bind streaming data like freezer temperature from Eventhouse, and answer questions like: "What is the top product by revenue across all stores?"

Choose ontology creation method

This tutorial contains two options for setting up the ontology (preview) item. Choose from one of the following methods:

  • Generate from semantic model: With these instructions, you use an existing semantic model to automatically generate an ontology that you can build upon and extend. Choose this option to see how to work with ontology when you already have a well-structured Power BI semantic model that represents your business domain.
  • Build directly from OneLake: With these instructions, you create the ontology manually by binding properties directly from OneLake. Choose this option to see how to build an ontology when you don't have a semantic model, or want full control over ontology design from the start.

Choose your preferred scenario by using the links above (will reload the page) or the selector at the beginning of the article.

Prerequisites

  • A workspace with a Microsoft Fabric-enabled capacity. Use this workspace for all resources you create in the tutorial.

  • Required settings for ontology (preview) and data agent must be enabled on your tenant. A Fabric administrator should enable the following settings in the tenant settings page of the admin portal:

    • Enable Ontology item (preview)
    • User can create Graph (preview)
    • Users can create and share Data agent item types (preview)
    • Users can use Copilot and other features powered by Azure OpenAI
    • Data sent to Azure OpenAI can be processed outside your capacity's geographic region, compliance boundary, or national cloud instance
    • Data sent to Azure OpenAI can be stored outside your capacity's geographic region, compliance boundary, or national cloud instance

    Screenshot of enabling ontology in the admin portal.

    For more information about these prerequisites, see Ontology (preview) required tenant settings.

  • A workspace with a Microsoft Fabric-enabled capacity. Use this workspace for all resources you create in the tutorial.

  • Required settings for ontology (preview) and data agent must be enabled on your tenant. A Fabric administrator should enable the following settings in the tenant settings page of the admin portal:

    • Enable Ontology item (preview)
    • User can create Graph (preview)
    • Users can create and share Data agent item types (preview)
    • Users can use Copilot and other features powered by Azure OpenAI
    • Data sent to Azure OpenAI can be processed outside your capacity's geographic region, compliance boundary, or national cloud instance
    • Data sent to Azure OpenAI can be stored outside your capacity's geographic region, compliance boundary, or national cloud instance

    Screenshot of enabling ontology in the admin portal.

    For more information about these prerequisites, see Ontology (preview) required tenant settings.

Download sample data

Download the contents of this GitHub folder: IQ samples.

It contains the following sample CSV files. The data contains static entity details about the Lakeshore Retail scenario and streaming data from its freezers:

  • DimStore.csv
  • DimProducts.csv
  • FactSales.csv
  • Freezer.csv
  • FreezerTelemetry.csv

Prepare the lakehouse

Follow these steps to prepare the sample tutorial data in a lakehouse.

  1. Start in your Fabric workspace. Use the + New item button to create a new Lakehouse item called OntologyDataLH.

    Screenshot of creating a new lakehouse item.

  2. The new lakehouse opens when it's ready. From the lakehouse ribbon, select Get data > Upload files.

    Screenshot of uploading files to the lakehouse.

  3. Select four of the sample CSV files that you downloaded earlier to upload them to your lakehouse. These files contain entity details about business objects in the Lakeshore Retail scenario.

    • DimProducts.csv
    • DimStore.csv
    • FactSales.csv
    • Freezer.csv

    Note

    Don't upload FreezerTelemetry.csv to the lakehouse. You upload this file to Eventhouse in a later step.

  4. Expand the Files folder in the Explorer to view your uploaded files. Next, load each file to a delta table.

    For each file, select ... next to the file name, then Load to Tables > New table.

    Screenshot of the load to tables dialogue in lakehouse.

    Continue through the table creation dialogue, keeping the default settings.

The lakehouse looks like the following image when you're done. The default table names reflect the file names in all lowercase.

Screenshot of the tables in the lakehouse.

Prepare the Power BI semantic model

This section prepares you to generate an ontology from a semantic model. If you're not following the semantic model scenario and you want to build the ontology manually from OneLake, use the selector at the beginning of the article to change to the OneLake scenario.

  1. From the lakehouse ribbon, select New semantic model.

    Screenshot of creating a new semantic model.

  2. In the New semantic model pane, set the following details:

    • Direct Lake semantic model name: RetailSalesModel

    • Workspace: Your tutorial workspace is chosen by default.

    • Select or deselect tables for the semantic model. Select three tables:

      • dimproducts
      • dimstore
      • factsales

      Note

      Don't select the freezer table. You create this entity manually in a later step.

    Select Confirm.

  3. Open the semantic model in Editing mode when it's ready. From the ribbon, select Manage relationships.

    Screenshot of the semantic model ribbon.

  4. In the Manage relationships pane, use the + New relationship button to create two relationships with the following details.

    From table To table Cardinality Cross-filter direction Make this relationship active?
    factsales, select StoreId dimstore, select StoreId Many to one (*:1) Single Yes
    factsales, select ProductId dimproducts, select ProductId Many to one (*:1) Single Yes

    The relationships look like this when you're done:

    Screenshot of the created relationships.

    Select Close.

Now the semantic model is ready to import into an ontology.

Prepare the eventhouse

Follow these steps to upload the device streaming data file to a KQL database in Eventhouse.

  1. In your Fabric workspace, use the + New item button to create a new eventhouse called TelemetryDataEH. A default KQL database is created with the same name.

  2. The eventhouse opens when it's ready. Open the KQL database by selecting its name in the explorer.

    Screenshot of the KQL database in the eventhouse.

  3. Next, create a new table called FreezerTelemetry that uses the FreezerTelemetry.csv sample file as a source.

    In the menu ribbon, select Get data > Local file.

    Screenshot of the data source options for the database.

    Create a New table called FreezerTelemetry and browse for the FreezerTelemetry.csv file that you downloaded earlier.

    Screenshot of uploading the csv file and creating the table.

    Continue through the table creation dialogue, keeping the default settings.

When you're done, the KQL database shows the FreezerTelemetry table with data:

Screenshot of the table in the database.

Next steps

Now your sample scenario is set up in Fabric. Next, create an ontology (preview) item by generating it automatically from a semantic model or building it manually from the OneLake data source.

Both options are available in the next step, Create an ontology.