Knowledge graph - ontology capabilities

更新时间:
复制 MD 格式

RDS AI, built on Supabase, lets you automatically extract entities and relationships from your business database, build an ontology layer, and generate a skill for an AI agent with a single click. This enables you to quickly transform business data into semantically-aware AI applications.

Notes

  • LLM automatic modeling is a one-time process. Do not leave the page while it runs. Automatic modeling uses the LLM to infer the database schema and business semantics, a process that typically takes several minutes. If you leave the current page or refresh your browser during modeling, the task is interrupted and cannot be resumed. You must restart the process.

  • The business data in this document, including users, orders, and stores, is demo data generated by LLM batch data generation. The values and conclusions do not reflect real business data. Validate with real business data in a production environment.

Step 1: Prepare the instance environment

1. Create a Knowledge Graph instance

  1. Log in to the RDS AI Application development console and go to the instance purchase page.

  2. On the purchase page, configure the following parameters, ensuring you select Knowledge Graph for the RDS AI Application Module.

    Parameter

    Description

    RDS AI Application Project Name

    A custom name to identify the instance in the console.

    Region

    Select the region where your business operates. This setting cannot be changed after the instance is created. For lower network latency, deploy the instance in the same region as your applications.

    VPC, Primary Zone, and Network

    Select an existing VPC and vSwitch. If none exist, click Create to create them in the VPC console.

    RDS AI Application Module

    Knowledge Graph is a required selection. You can also select Supabase and Long-term Memory depending on your business needs.

    Dashboard Username

    This value is fixed to supabase and cannot be changed.

    Dashboard Password

    The password must be 8 to 32 characters long and contain at least three of the following: uppercase letters, lowercase letters, digits, and underscores (_). This password is used to sign in to the Knowledge Graph workbench.

    Billing Method

    The available billing methods are subscription and pay-as-you-go. The subscription option is recommended for long-term use.

    Engine

    Available engines are PostgreSQL 17 and PostgreSQL 18. We recommend PostgreSQL 17 unless you have specific requirements.

    SLR Authorization

    Ensure the AliyunServiceRoleForRds and AliyunServiceRoleForRdsPgsqlOnEcs service-linked roles have a green check mark. If not, follow the on-screen instructions to authorize them.

    Edition

    Select the Basic Edition for testing and feature validation. For production environments, we recommend the High-availability Edition.

    Instance Type Category, Instance Type

    Select an instance type that meets your data volume and concurrency requirements. For this demo, we recommend selecting at least pg.n2.2c.1m (2 vCPUs, 4 GB).

    Storage Space

    The default is 20 GB. You can adjust this value to match the scale of your business data.

    Database Password

    The password must be 8 to 32 characters long and meet the same requirements as the Dashboard Password. This password is for connecting directly to the PostgreSQL database to perform data operations.

  3. Review your order, complete the payment, and wait for the instance to be created. This process typically takes several minutes.

2. Configure the IP address whitelist

  1. In the instance list of the RDS AI Application development console, click the target project name to go to the instance details page.

  2. Add your local client's public IP address to the IP address whitelist and save the changes.

3. Sign in to Knowledge Graph

  1. In the RDS AI Application development console, click the target project name to go to the instance details page.

  2. In the Network Information section, copy the public endpoint (for example, 59.xxxx.182:80).

  3. In a browser, open the public endpoint and sign in with the Dashboard Username supabase and the Dashboard Password you set during instance creation. After signing in, you are directed to the Knowledge Graph workbench, where you will perform all subsequent operations, such as building datasets, modeling ontologies, and generating skills.

Note

The Network Information section on the instance details page also displays the PostgreSQL public endpoint (for example, pgm-xxxxxxxx.pg.rds.aliyuncs.com) and the PostgreSQL internal endpoint. You will need these endpoints to connect directly to the RDS PostgreSQL database in a later step, so take note of them. If a public endpoint is not available, you can enable it using the Allow Public Access toggle.

Step 2: Prepare business data

In this step, you will create the business table schema and generate test data. We recommend connecting directly to RDS PostgreSQL for maximum efficiency.

1. Connect directly to the RDS PostgreSQL instance

  1. Log in to the RDS console.

  2. In the instance list, find the PostgreSQL instance associated with your RDS AI instance, and click the instance ID to open the Details page.

  3. On the Database Connection page, copy the public endpoint (for example, pgm-xxxxxxxx.rds.aliyuncs.com), and record the corresponding port, database name, username, and password.

2. Create the business table schema

Use any PostgreSQL client, such as psql, DataGrip, or Navicat, to connect to the RDS PostgreSQL instance. In the target database, such as supabase_db, run the following DDL to create the tables, foreign keys, indexes, and constraints for a food delivery ordering system.

Business table DDL

-- ============================================================
-- DDL for database: supabase_db  schema: public
-- Generated via information_schema + pg_catalog queries
-- ============================================================

SET search_path TO public;

-- ─── Extensions ───
CREATE EXTENSION IF NOT EXISTS "age";
CREATE EXTENSION IF NOT EXISTS "pg_cron";
CREATE EXTENSION IF NOT EXISTS "pg_graphql";
CREATE EXTENSION IF NOT EXISTS "pg_net";
CREATE EXTENSION IF NOT EXISTS "pg_stat_statements";
CREATE EXTENSION IF NOT EXISTS "pg_trgm";
CREATE EXTENSION IF NOT EXISTS "pgcrypto";
CREATE EXTENSION IF NOT EXISTS "pgjwt";
CREATE EXTENSION IF NOT EXISTS "supabase_vault";
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "vector";

-- ─── Enum Types ───
CREATE TYPE memory_type AS ENUM ('explicit', 'implicit', 'feedback');
CREATE TYPE order_status AS ENUM ('pending', 'confirmed', 'preparing', 'delivering', 'completed', 'cancelled');

-- ─── Table: addresses ───
CREATE TABLE addresses (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    user_id uuid NOT NULL,
    label text,
    address text NOT NULL,
    lat numeric(10,8),
    lng numeric(11,8),
    contact_name text,
    contact_phone text,
    is_default boolean DEFAULT false NOT NULL,
    created_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: menus ───
CREATE TABLE menus (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    shop_id uuid NOT NULL,
    name text NOT NULL,
    description text,
    price numeric(10,2) NOT NULL,
    category text,
    tags jsonb DEFAULT '[]'::jsonb,
    is_available boolean DEFAULT true NOT NULL,
    image_url text,
    created_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: order_feedbacks ───
CREATE TABLE order_feedbacks (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    order_id uuid NOT NULL,
    user_id uuid NOT NULL,
    rating integer NOT NULL,
    comment text,
    liked_items jsonb DEFAULT '[]'::jsonb,
    disliked_items jsonb DEFAULT '[]'::jsonb,
    created_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: order_items ───
CREATE TABLE order_items (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    order_id uuid NOT NULL,
    menu_id uuid NOT NULL,
    quantity integer DEFAULT 1 NOT NULL,
    unit_price numeric(10,2) NOT NULL,
    note text,
    created_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: orders ───
CREATE TABLE orders (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    user_id uuid NOT NULL,
    shop_id uuid NOT NULL,
    status order_status DEFAULT 'pending'::order_status NOT NULL,
    total_price numeric(10,2) NOT NULL,
    delivery_address jsonb NOT NULL,
    note text,
    created_at timestamptz DEFAULT now() NOT NULL,
    updated_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: shops ───
CREATE TABLE shops (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    name text NOT NULL,
    description text,
    location text,
    category text,
    is_open boolean DEFAULT true NOT NULL,
    rating numeric(2,1) DEFAULT 5.0,
    phone text,
    business_hours jsonb DEFAULT '{}'::jsonb,
    created_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: user_memories ───
CREATE TABLE user_memories (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    user_id uuid NOT NULL,
    agent_id text DEFAULT 'default'::text NOT NULL,
    memory_type memory_type NOT NULL,
    memory_key text NOT NULL,
    memory_value jsonb NOT NULL,
    confidence numeric(3,2) DEFAULT 0.50 NOT NULL,
    source text,
    created_at timestamptz DEFAULT now() NOT NULL,
    updated_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: user_taste_profiles ───
CREATE TABLE user_taste_profiles (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    user_id uuid NOT NULL,
    flavor_tags jsonb DEFAULT '[]'::jsonb,
    allergy_tags jsonb DEFAULT '[]'::jsonb,
    diet_type text DEFAULT 'normal'::text NOT NULL,
    spice_level integer DEFAULT 2 NOT NULL,
    sweetness_level integer DEFAULT 2 NOT NULL,
    updated_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Table: users ───
CREATE TABLE users (
    id uuid DEFAULT uuid_generate_v4() NOT NULL,
    phone text NOT NULL,
    name text,
    email text,
    default_address_id uuid,
    telegram_id text,
    whatsapp_id text,
    created_at timestamptz DEFAULT now() NOT NULL,
    updated_at timestamptz DEFAULT now() NOT NULL
);

-- ─── Primary Keys ───
ALTER TABLE _ontology_changelog ADD PRIMARY KEY (id);
ALTER TABLE addresses ADD PRIMARY KEY (id);
ALTER TABLE menus ADD PRIMARY KEY (id);
ALTER TABLE order_feedbacks ADD PRIMARY KEY (id);
ALTER TABLE order_items ADD PRIMARY KEY (id);
ALTER TABLE orders ADD PRIMARY KEY (id);
ALTER TABLE shops ADD PRIMARY KEY (id);
ALTER TABLE user_memories ADD PRIMARY KEY (id);
ALTER TABLE user_taste_profiles ADD PRIMARY KEY (id);
ALTER TABLE users ADD PRIMARY KEY (id);

-- ─── Unique Constraints ───
ALTER TABLE user_memories ADD CONSTRAINT user_memories_user_id_agent_id_memory_key_key UNIQUE (user_id, agent_id, memory_key);
ALTER TABLE user_taste_profiles ADD CONSTRAINT user_taste_profiles_user_id_key UNIQUE (user_id);
ALTER TABLE users ADD CONSTRAINT users_phone_key UNIQUE (phone);
ALTER TABLE users ADD CONSTRAINT users_telegram_id_key UNIQUE (telegram_id);
ALTER TABLE users ADD CONSTRAINT users_whatsapp_id_key UNIQUE (whatsapp_id);

-- ─── Foreign Keys ───
ALTER TABLE addresses ADD CONSTRAINT addresses_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE menus ADD CONSTRAINT menus_shop_id_fkey FOREIGN KEY (shop_id) REFERENCES shops(id) ON DELETE CASCADE;
ALTER TABLE order_feedbacks ADD CONSTRAINT order_feedbacks_order_id_fkey FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE;
ALTER TABLE order_feedbacks ADD CONSTRAINT order_feedbacks_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE order_items ADD CONSTRAINT order_items_menu_id_fkey FOREIGN KEY (menu_id) REFERENCES menus(id);
ALTER TABLE order_items ADD CONSTRAINT order_items_order_id_fkey FOREIGN KEY (order_id) REFERENCES orders(id) ON DELETE CASCADE;
ALTER TABLE orders ADD CONSTRAINT orders_shop_id_fkey FOREIGN KEY (shop_id) REFERENCES shops(id);
ALTER TABLE orders ADD CONSTRAINT orders_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id);
ALTER TABLE user_memories ADD CONSTRAINT user_memories_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE user_taste_profiles ADD CONSTRAINT user_taste_profiles_user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
ALTER TABLE users ADD CONSTRAINT fk_users_default_address FOREIGN KEY (default_address_id) REFERENCES addresses(id) ON DELETE SET NULL;

-- ─── Indexes ───
CREATE INDEX idx_addresses_default ON public.addresses USING btree (user_id, is_default) WHERE (is_default = true);
CREATE INDEX idx_addresses_user_id ON public.addresses USING btree (user_id);
CREATE INDEX idx_menus_available ON public.menus USING btree (shop_id, is_available) WHERE (is_available = true);
CREATE INDEX idx_menus_category ON public.menus USING btree (category);
CREATE INDEX idx_menus_name_trgm ON public.menus USING gin (name gin_trgm_ops);
CREATE INDEX idx_menus_shop_id ON public.menus USING btree (shop_id);
CREATE INDEX idx_menus_tags ON public.menus USING gin (tags);
CREATE INDEX idx_feedbacks_order_id ON public.order_feedbacks USING btree (order_id);
CREATE INDEX idx_feedbacks_rating ON public.order_feedbacks USING btree (user_id, rating);
CREATE INDEX idx_feedbacks_user_id ON public.order_feedbacks USING btree (user_id);
CREATE INDEX idx_order_items_menu_id ON public.order_items USING btree (menu_id);
CREATE INDEX idx_order_items_order_id ON public.order_items USING btree (order_id);
CREATE INDEX idx_orders_shop_id ON public.orders USING btree (shop_id);
CREATE INDEX idx_orders_status ON public.orders USING btree (status);
CREATE INDEX idx_orders_user_created ON public.orders USING btree (user_id, created_at DESC);
CREATE INDEX idx_orders_user_id ON public.orders USING btree (user_id);
CREATE INDEX idx_shops_category ON public.shops USING btree (category);
CREATE INDEX idx_shops_is_open ON public.shops USING btree (is_open) WHERE (is_open = true);
CREATE INDEX idx_shops_name_trgm ON public.shops USING gin (name gin_trgm_ops);
CREATE INDEX idx_memories_confidence ON public.user_memories USING btree (user_id, confidence DESC);
CREATE INDEX idx_memories_type ON public.user_memories USING btree (memory_type);
CREATE INDEX idx_memories_updated ON public.user_memories USING btree (updated_at DESC);
CREATE INDEX idx_memories_user_agent ON public.user_memories USING btree (user_id, agent_id);
CREATE INDEX idx_memories_user_id ON public.user_memories USING btree (user_id);
CREATE INDEX idx_taste_user_id ON public.user_taste_profiles USING btree (user_id);
CREATE INDEX idx_users_phone ON public.users USING btree (phone);
CREATE INDEX idx_users_telegram_id ON public.users USING btree (telegram_id) WHERE (telegram_id IS NOT NULL);
CREATE INDEX idx_users_whatsapp_id ON public.users USING btree (whatsapp_id) WHERE (whatsapp_id IS NOT NULL);

-- ─── Check Constraints ───
ALTER TABLE menus ADD CONSTRAINT menus_price_check CHECK ((price >= (0)::numeric));
ALTER TABLE order_feedbacks ADD CONSTRAINT order_feedbacks_rating_check CHECK (((rating >= 1) AND (rating <= 5)));
ALTER TABLE order_items ADD CONSTRAINT order_items_quantity_check CHECK ((quantity > 0));
ALTER TABLE order_items ADD CONSTRAINT order_items_unit_price_check CHECK ((unit_price >= (0)::numeric));
ALTER TABLE orders ADD CONSTRAINT orders_total_price_check CHECK ((total_price >= (0)::numeric));
ALTER TABLE shops ADD CONSTRAINT shops_rating_check CHECK (((rating >= (0)::numeric) AND (rating <= (5)::numeric)));
ALTER TABLE user_memories ADD CONSTRAINT user_memories_confidence_check CHECK (((confidence >= (0)::numeric) AND (confidence <= (1)::numeric)));
ALTER TABLE user_taste_profiles ADD CONSTRAINT user_taste_profiles_spice_level_check CHECK (((spice_level >= 0) AND (spice_level <= 5)));
ALTER TABLE user_taste_profiles ADD CONSTRAINT user_taste_profiles_sweetness_level_check CHECK (((sweetness_level >= 0) AND (sweetness_level <= 5)));

3. Generate associated test data

Use QoderWork to batch-generate associated test data with a natural language prompt. Open QoderWork and enter a prompt similar to the following:

I need a data insertion script for my PostgreSQL database. The connection details are as follows: Endpoint: pgm-XXX.rds.aliyuncs.com, Database: supabase_db, Username: XXX, Password: XXX.
Please check my current table schema and generate 100,000 interrelated records. Ensure that all data for users, orders, shops, and menus is correctly linked.
Note

Replace the placeholders in the prompt, such as pgm-XXX.rds.aliyuncs.com, username, and password, with the connection information from Step 1. QoderWork automatically connects to the RDS PostgreSQL instance, reads the table schema, generates associated data that complies with foreign key constraints, and inserts the data.

Step 3: Build an ontology

An ontology models the entities, properties, and relationships in a business domain. It enables an AI agent to understand your business. In this step, you will generate an ontology from your business data using agent automatic modeling. The process includes starting automatic modeling, creating an ontology dataset, configuring the connection, previewing and refining the ontology, and registering and viewing the knowledge graph.

1. Start agent automatic modeling

  1. Sign in to the knowledge graph workbench with the Dashboard username supabase and your password (see section 3 of Step 1).

  2. In the left navigation pane, under the ONTOLOGY group, click Type Modeling.

  3. In the Type Definition section, click Agent Automatic Modeling to start the automatic ontology modeling workflow.

Note

The Modeling Template section at the top of the page provides predefined ontology templates, such as Agent Structured Memory, which cover common entities like people, projects, tasks, events, documents, and notes. If your business use case aligns with a general agent memory scenario, you can click One-click Apply to skip the automatic modeling process. This document uses a custom "food delivery ordering system" as an example and follows the agent automatic modeling workflow.

2. Create an ontology dataset

On the Automatic Ontology Modeling page, a three-stage workflow appears at the top: Connection ConfigurationPreview & RefineFinish. First, create a dataset for the ontology definition.

  1. In the dataset drop-down list in the upper-right corner of the page, click Create Dataset.

  2. Complete the dataset information as described in the following table.

    Parameter

    Description

    Name

    Required. A name for the dataset. We recommend using a name that reflects the business scenario, such as food_delivery_ontology.

    Description

    Optional. A brief description of the dataset to aid future maintenance.

    RAG type

    The drop-down list supports three types: GraphRAG, Ontology, and Skills. For this scenario, select Ontology.

    Storage type

    Set to Local Storage and cannot be changed. Ontology and Skills datasets only support local storage.

  3. Click Create Dataset. Once created, the dataset is automatically selected and activated, and its status is displayed as active.

3. Configure connection and trigger modeling

  1. In the Connection Configuration stage, select public for the schema and enter the business logic: "This is a food delivery ordering system." This description guides the Large Language Model (LLM) in abstracting entity semantics. The more precise the description, the more closely the generated ontology will align with your business.

  2. After you confirm the configuration, click Start Analysis to enter the Preview & Refine stage. The LLM then scans table structures and foreign key relationships to infer ObjectType, LinkType, and ActionType.

Important

LLM automatic modeling is a one-time, long-running process that typically takes several minutes. During the modeling process, do not switch pages, refresh your browser, or close the tab. This will interrupt the task, which cannot be resumed. You must then restart the modeling process.

4. Preview and refine ontology

  1. When modeling is complete, the inferred results appear on four tabs: ObjectType, LinkType, ActionType, and Mapping. Each ObjectType card shows the primary key (PK), the number of properties, and the creation time.

  2. In the Recommendation Center section, review the refinement suggestions. You can accept or ignore each suggestion based on your business requirements. You can also manually edit entity names, properties, and relationship types to better align the ontology with your business semantics.

  3. Once you confirm the ontology structure is correct, click Register to Dataset and then Confirm Registration to enter the Finish stage.

5. Register and view knowledge graph

  1. In the Finish stage, the system automatically extracts data from your RDS PostgreSQL business database based on the ontology definition. It then builds entity nodes and relationship edges and writes them to the knowledge graph. The duration of the initial synchronization depends on the data volume.

  2. After the registration is complete, go to the ONTOLOGY group in the left navigation pane and click Ontology Graph to view a visualization of your knowledge graph. You can click any node to view its specific instance data and verify the ontology extraction.

  3. In Instance Management, you can view the total number of instances for each ObjectType to verify that the data synchronization is complete.

Step 4: Generate and install a Skill

After you register the ontology in the Finish stage, the LLM can automatically generate an Agent Skill package from it, which AI agents can then call.

1. Click "Generate Skill" to open the dialog box

On the Finish page of the Automatic Ontology Modeling workflow, click Generate Skill in the action bar at the bottom. The Generate Agent Skill from Modeling dialog box opens. The subtitle of the dialog box displays the name of the current dataset, for example, Automatically generate a complete Agent Skill package based on the ontology model of the current dataset (food_delivery_ontology).

2. Configure the Agent Skill

Configure the parameters in the dialog box as described in the table below.

Parameter

Description

Skill Name

A custom name for the Skill, such as food-delivery-agent. We recommend using lowercase letters and hyphens to ensure it can be easily loaded and recognized in QoderWork.

Scene Title

Optional. A brief description of the Skill's use case, such as food delivery business analysis. If you leave this blank, the system automatically infers a title based on the ontology.

API URL

Required. The RAG gateway URL that the Skill uses to access the knowledge graph, for example, http://59.110.XXX.XXX/rag/v1. By default, the system auto-fills the gateway URL with the /rag/v1 path. If the URL you enter does not include this path, the system appends it when you save.

Use Agent Mode (LLM Generation)

This option is selected by default and recommended. When selected, the LLM understands the domain semantics and generates query priorities and an inference chain for the Skill tailored to your business scenario. If you clear this option, only basic ObjectType query templates are generated.

Auto-publish to Skills

Optional. When selected, the generated Skill is automatically published to the Skills dataset, allowing an AI agent to call it without manual publishing. If you want to review SKILL.md before publishing, keep this option cleared.

3. Start LLM inference

  1. After you configure the parameters, click Agent Generate in the lower-right corner of the dialog box. A loading message Agent is generating SKILL.md (LLM inference in progress)... appears, along with the prompt The LLM is understanding the domain semantics and generating the Skill document. Please wait....

  2. Wait for the LLM inference to complete. This typically takes several minutes and depends on the size of the ontology and the number of ObjectTypes. The system then automatically generates the SKILL.md file and its associated Skill package files.

  3. If you did not select Auto-publish to Skills, you can review the content of the SKILL.md file on the preview page after generation. Once you confirm that the content is correct, you can manually install the Skill to the Skills dataset.

Important

During the LLM inference process, do not close the dialog box, refresh your browser, or switch pages. This will interrupt the task, and you must restart the process by clicking Agent Generate again.

4. Install the Skill

After the Skill is generated, install it on your local AI programming client so that an AI agent can load and call it.

  1. In the SKILLHUB area of the left-side navigation pane, click Skills. On the newly created Skill card, such as food-delivery-agent, click Install.

  2. In the Install Skill dialog box, select the tab corresponding to your local client: Claude, Cursor, Gemini, General, or Qoder. The dialog box displays the Target Directory for the selected client (for example, the default for Qoder is ~/.qoder/skills/<skill-name>) and a complete installation command.

  3. Click Copy in the upper-right corner of the command area, and then paste and run the command in your local terminal. The command uses curl to download a ZIP package from the SKILLHUB artifact repository and extracts it to the target directory. If the terminal reports no errors, the installation is successful. Return to the dialog box and click Close.

  4. Reload or restart the Skill list in your local Qoder client. The newly installed Skill appears, and you can proceed to Step 5 to verify that it works correctly.

Step 5: Verify results in QoderWork

1. Select a skill and ask a question

  1. Open the QoderWork client and select an installed Skill, such as food-delivery-agent, from the Skill list.

  2. In the chat window, ask a question in natural language. For example:

    Can you look up my store: Li XX's Chinese Restaurant?

  3. Based on the ontology, the Skill queries the underlying RDS PostgreSQL data through the knowledge graph and returns a structured analysis report.

2. Demo: Analysis report

The following is a sample of the complete analysis report the Skill returned after executing the preceding query on the sample database.

Basic store information

Attribute

Details

Store ID

f28b7494xxxx63defce99c5

Store name

Li XX's Chinese Restaurant

Category

Dessert

Rating

3.2 / 5.0

Business status

Closed

Business hours

09:00 - 22:00

Contact number

1522499****

Address

No. xxx, Jiefang Road, Nanshan District, Hangzhou

Registration date

July 29, 20xx

Dish mix analysis

The store currently offers 5 dishes online, all tagged as "Hot Sellers":

Dish name

Category

Price

Status

Specialty Seafood

Snack

¥149.88

Available

Specialty Chicken

Beverage

¥68.07

Available

Signature Chicken

Signature Dish

¥53.83

Available

Specialty Beef (Style 1)

Signature Dish

¥144.01

Available

Specialty Beef (Style 2)

Signature Dish

¥172.21

Available

Dish strategy highlights:

  • Lean SKU set: With only 5 dishes, the store focuses on core offerings to reduce operational complexity.

  • Premium pricing: The average price of ¥117.60 is well above the platform average for fast food, indicating a premium positioning.

  • Focus on signature dishes: 3 of the 5 dishes are signature dishes, emphasizing a unique competitive edge.

  • Category mismatch: "Specialty Chicken" is categorized as "Beverage," and "Specialty Seafood" as "Snack," indicating data quality issues.

Order operations analysis

Total orders: 24 (ranked #1 on the platform).

Order status distribution

Status

Quantity

Percentage

completed

8

33.3%

delivering

6

25.0%

preparing

5

20.8%

pending

4

16.7%

cancelled

1

4.2%

Key findings:

  • The completion rate of 33.3% is below the platform average of 35.1%.

  • In-progress orders (preparing, delivering, and pending) account for 62.5%, indicating high recent activity.

  • The cancellation rate is only 4.2%, which is better than the platform average of 5%.

Revenue performance

Metric

Value

Total revenue from completed orders

¥7,043.33

Average order value

¥880.42

Highest single order

¥1,496.06

Lowest single order

¥140.77

The average order value of ¥880.42 far exceeds the platform average of ¥549 (60% higher), which validates its high-end positioning strategy.

User behavior insights

Order remarks analysis

Out of 24 orders, 13 included remarks (54.2%). This rate is much higher than the average for delivery restaurants and indicates that users have specific, personalized needs:

Remark

Frequency

"Invoice header: personal"

3

"Extra spicy"

3

"Deliver to the front desk"

2

"Please be quick"

2

"Takeout"

1

"Light on scallions"

1

"Not spicy"

1

Spice preferences vary widely: requests for both "Extra spicy" and "Not spicy" suggest diverse customer tastes.

Monthly order trends

Month

Order count

20xx-04

2

20xx-05

1

20xx-06

2

20xx-07

3

20xx-08

2

20xx-09

5 (peak)

20xx-10

1

20xx-11

4

20xx-12

2

20xx-01

2

September was the peak month for orders (5), possibly due to seasonal autumn demand or store promotions. The overall monthly average is approximately 2.4 orders, indicating a low but stable order volume.

Delivery coverage analysis

Order delivery addresses span multiple cities:

  • Hangzhou: 8 orders

  • Shenzhen: 4 orders

  • Shanghai: 4 orders

  • Beijing: 1 order

  • Guangzhou: 1 order

  • Wuhan: 2 orders

  • Chengdu: 2 orders

  • Xi'an: 2 orders

The delivery coverage is unusually broad, spanning eight cities nationwide. This is rare for a physical restaurant and could indicate one of the following:

  1. The establishment is a virtual store or part of a chain brand.

  2. The data is simulated or for testing purposes.

  3. The store uses an inter-city delivery service.

Key issues and recommendations

Issues

  1. Low rating (3.2/5.0): The store's rating places it near the bottom among the platform's top 10 stores by order volume, making reputation its biggest weakness.

  2. Low completion rate (33.3%): This is below the platform average and may indicate issues with kitchen throughput or service quality.

  3. Category and name mismatch: The store name is "Chinese Restaurant" but its category is "Dessert," and its dish categories are also inconsistent.

  4. Currently closed: The store is missing out on potential orders.

Recommendations

  1. Improve service quality: Focus on user feedback, optimize food preparation speed and dish quality, and aim to raise the rating to 4.0 or higher.

  2. Reopen for business: Resume operations as soon as possible to capitalize on the traffic from current in-progress orders.

  3. Standardize dish categorization: Correct errors such as "Specialty Chicken" being categorized as "Beverage" to improve the user search experience.

  4. Offer spice levels: To accommodate the diverse preferences for "Extra spicy" and "Not spicy," provide options such as Mild, Medium, Hot, and No Spice.

  5. Expand the SKU set: The current offering of five dishes is limited. We recommend adding 10 to 15 dishes at different price points to appeal to more customers.