Ontology modeling and knowledge graph construction
Alibaba Cloud Milvus supports ontology modeling and knowledge graph construction. To query information associated with business objects, first use ontology modeling to define the objects, attributes, and relationships, and then build a knowledge graph from your materials. This topic uses laptop after-sales service as an example to describe AI-assisted schema generation, verification and saving, graph construction, and result validation.
Determine the modeling scope from a business question
Start with a question that requires connecting information across materials, such as "If the laptop is still under warranty, can its battery also be replaced free of charge?" This question requires distinguishing at least the laptop, its components, and their respective terms.
|
Definition |
What to determine |
Example |
|
Entity type |
Which objects have distinct business meanings |
Laptop, component, and warranty terms |
|
Attribute |
Which values to record for objects of the same type |
Warranty duration in months, start date basis, and charging conditions |
|
Relationship |
How two types of objects are related and how to express the direction |
A laptop contains components; each object is subject to its own terms |
|
Description and extraction requirements |
Which expressions belong to a type and which inferences to avoid |
Components have separate terms and do not inherit the laptop's warranty period simply because they are part of it |
You do not need to create a type for every sentence in the materials. First cover the objects and relationships required for the current question, and then expand the definitions based on actual results. Reuse types with similar names and the same business meaning where possible.
Draft ontology definitions with AI
If you do not have specific business type requirements, you can start with a generic graph schema. To tailor the schema to your business, use Generate with AI to draft definitions, and then verify and adjust them. First import materials related to the target business, such as product manuals, warranty terms, and service descriptions, and verify that they are parsed correctly.
-
Open Manage graph schema and rules and select Generate with AI. To use imported business materials, enable Use knowledge base materials and select all documents or restrict the sources as needed.
-
In the generation objective, describe the objects and relationships to distinguish. For example:
NoteFor laptop after-sales service, distinguish the laptop, its components, and their respective warranty terms. Identify warranty durations in months, start date bases, charging conditions, and the regions covered by the service. Model only relationships explicitly stated in the materials. Do not apply the laptop's warranty to the battery.
-
Click Start generation. After generation is complete, select View generation results and verify the following business definitions.
-
After verification, select Load into editor, modify the definitions as needed, and click Save settings. Return to the knowledge graph and select Build graph. Loading replaces the definitions in the editor. Preserve any unsaved changes first.
|
Item to verify |
Verification example for after-sales service |
|
Entity type |
Distinguish laptops, components, and warranty terms; retain services and regions as needed |
|
Term attributes |
Use integers for warranty durations in months, and distinguish start date bases and charging conditions |
|
Relationship direction |
A laptop contains components; the laptop and its components are subject to their respective terms; a service covers regions |
|
Extraction rules |
Use only explicit source statements. Do not apply the laptop's warranty period to the battery or infer free replacement solely from an object being under warranty |
Type names, identifiers, and modeling approaches may vary, provided that their business meanings are accurate. For example, both "component is subject to terms" and "terms apply to component" can express a warranty relationship. However, relationship names, source and target types, and extraction requirements must be consistent. You do not need to use fixed English identifiers or reverse an existing relationship that is already correct. Manually add or modify a definition only if the generated results omit or confuse it.
AI generation drafts only type, attribute, and relationship definitions. Facts such as specific warranty periods are still extracted from sources during graph construction. The reference materials are sampled, so verify that the generated results cover key business meanings. Generation, loading, saving, and building are separate steps. Completing generation does not automatically save the configuration or generate graph facts.
After the build is complete, search for "battery". Verify that it is associated with the correct warranty terms and that you can trace the relationship to supporting source text. If the relationship is incorrect, review the parsing results, type definitions, and extraction rules.
Verify and improve graph results
After the results become available, verify objects, attributes, relationships, and sources against actual business questions. Focus on the following items:
|
Symptom |
Checks and adjustments |
|
The battery and laptop are not distinguished |
Check source parsing and the type descriptions and recognition requirements for both objects |
|
The same object appears more than once |
Check whether the names and types refer to the same object, and clarify the recognition scope and naming requirements |
|
The meaning or direction of a relationship is incorrect |
Check the source and target types and relationship name in the type definition, and verify that the source text supports the relationship |
|
Term attributes are missing or assigned to the wrong object |
Check attribute meanings, value types, and extraction requirements, and verify that the sources provide explicit evidence |
|
The graph contains facts that are not stated in the sources |
Tighten recognition and inference requirements, rebuild the graph, and verify the sources |
For example, if the materials specify a 12-month battery warranty and a 24-month laptop warranty, each object must be associated with its own terms. A laptop still being under warranty does not imply free battery replacement. Names and relationship expressions may vary, but their business meanings and supporting evidence must remain consistent.
Validate again after adjusting definitions
Saving a schema or extraction rules does not directly change an existing graph. Rebuild the graph to observe the effects of the new definitions. Adjust the definitions for a specific issue each time, and use the same materials and questions for verification. Avoid changing multiple settings at once, which makes it difficult to identify the cause of a result.
Retain at least one entity type. Relationship endpoints must reference valid types. For information about configuration changes, source scope, and automatic builds, see Data updates and build management.
After verifying the graph, you can enable graph augmentation for question answering as needed, or use object attributes and relationships in your business. For more information, see Use Wiki and knowledge graphs.