Knowledge graph schema management

Updated at:

You can use natural language commands to instruct code agents, such as Qoder and CodeX, to manage a knowledge graph schema. This includes exporting, editing, importing, and publishing the schema, as well as querying publishing results. This document describes the capability's features, prerequisites, usage examples, and execution results, and includes an appendix with a list of required inputs.

Overview

The knowledge graph schema management capability allows you to use natural language commands to export, import, and publish the schema for a knowledge graph space, and to query the publishing results. To add, modify, or delete entity types, relation types, and their properties, you must follow this workflow: export the schema, edit it locally, import the entire schema, and then publish it.

Applicable scenarios:

  • Exporting the current schema of a knowledge graph space to use as a baseline for editing.

  • Adding, modifying, or deleting entity types, relation types, and their properties.

  • Importing the edited schema and publishing it to the graph engine.

  • Querying the status and logs of a schema publishing task.

Note

Limitations: Schema management supports only schema-level export, import, publish, and publishing result queries. It does not provide fine-grained APIs for adding, deleting, or modifying individual entity or relation types. To change types and properties, you must edit the schema content and re-import the entire schema. To delete existing types, you must import the schema by using the replace strategy. Publishing is an asynchronous process. A successful command response only confirms that the request was accepted. You must query the publishing result to confirm the final outcome. If a space enters a non-editable state due to a publishing failure and a failed rollback, you cannot recover it from the command line. You must restore it manually in the Dataphin console.

Prerequisites

  • You have an existing knowledge graph space and administrative permissions for it.

  • You have the ID of the target space. You must obtain this ID from the knowledge graph space list page in the Dataphin console, as it cannot be retrieved through self-service queries.

  • You know which graph engine (Neo4j or Lindorm) is bound to the space, as the available property data types vary by engine.

Examples

You can instruct the agent in natural language. The following are sample commands:

  • Export the current schema of the knowledge graph space.

  • Add a company entity type to the schema with two properties: name and industry.

  • Add an investment relation type to the knowledge graph, from company to company.

  • Import the edited schema into the knowledge graph space by using the merge strategy.

  • Publish the knowledge graph schema with the publish comments "Add company entity type."

  • Query the publishing result of the schema.

Interaction steps:

  1. The agent first confirms the target knowledge graph space ID and the graph engine bound to the space.

  2. The agent usually exports the current schema as a baseline before adding, modifying, or deleting types and properties.

  3. Before importing, the agent typically confirms the merge strategy (replace or merge) and its potential impact. The replace strategy deletes types not included in the imported schema.

  4. Importing only saves the schema to a draft state. Changes take effect in the graph engine only after they are published. Before publishing, the agent typically confirms the publish comments and checks for any destructive changes.

  5. After publishing, the agent typically polls the publishing status until the task completes or fails.

Execution results

When an operation completes, it provides the following results:

  • Response content: Exporting returns the schema content. Importing saves the schema to a draft state. Publishing returns a schema version number. Querying the publishing result returns the status (Executing, Successful, Partially Completed, or Failed) and the publishing log.

  • Completion status: The publishing query result determines the final status. A successful command response only indicates that the publish request has been accepted.

  • Viewing and verification: To verify the changes, export the schema again to check the list of types, or view the schema and publishing history in the Dataphin console.

Note

A successful response from the command line only indicates that the request has been accepted. The status shown in the Dataphin console reflects the actual result.

Appendix: Input parameters

The following table lists the parameters that may be required when managing a knowledge graph schema. This table is for reference only. In practice, the agent automatically identifies the required information from your commands and prompts you if anything is missing. You do not need to provide items noted as system-generated.

Parameter

Required

Description

Example

tenant ID

Conditionally required

Omit if already specified in the credential configuration.

1234567890123456789

knowledge graph space ID

Yes

The ID of the target space. This ID cannot be retrieved through self-service queries and must be obtained from the knowledge graph space list page in the Dataphin console.

—

Graph engine type

Yes

The graph engine for the space. This determines the available property data types and must be known before editing the schema.

Neo4j

Schema content

Required for import

The complete, edited schema, typically based on an exported version.

—

Merge strategy

Required for import

Options are replace or merge. Use the replace strategy to delete existing types.

merge

Publish comments

Recommended for publishing

A description of the publishing task.

Add company entity type