Change Password

Please enter the password.
Please enter the password. Between 8-64 characters. Not identical to your email address. Contain at least 3 of: uppercase, lowercase, numbers, and special characters.
Please enter the password.
Submit

Change Nickname

Current Nickname:
Submit

Apply New License

License Detail

Please complete this required field.

  • Ultipa Blaze (v4)
  • Ultipa Powerhouse (v5)

Standalone

learn more about the four main severs in the architecture of Ultipa Powerhouse (v5) , click

here

Please complete this required field.

Please complete this required field.

Please complete this required field.

Please complete this required field.

Leave it blank if an HDC service is not required.

Please complete this required field.

Leave it blank if an HDC service is not required.

Please complete this required field.

Please complete this required field.

Mac addresses of all servers, separated by line break or comma.

Please complete this required field.

Please complete this required field.

Cancel
Apply
ID
Product
Status
Cores
Maximum Shard Services
Maximum Total Cores for Shard Service
Maximum HDC Services
Maximum Total Cores for HDC Service
Applied Validity Period(days)
Effective Date
Expired Date
Mac Address
Reason for Application
Review Comment
Close
Profile
  • Full Name:
  • Phone:
  • Company:
  • Company Email:
Change Password
Apply

You have no license application record.

Apply
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

Product Created On ID Amount (USD) Invoice
Product Created On ID Amount (USD) Invoice

No Invoice

v5.3
Search
    English
    v5.3

      Graph

      This section introduces methods for managing graphs in the database.

      showGraph()

      Retrieves all graphs from the database.

      Parameters

      • config?: RequestConfig: Request configuration.

      Returns

      • GraphSet[]: The list of retrieved graphs.

      // Retrieves all graphs
      const graphs = await driver.showGraph();
      graphs.forEach((graph) => console.log(graph.name));
      

      Display_Ad_Click
      ERP_DATA2
      wikiKG
      

      getGraph()

      Retrieves a specified graph from the database.

      Parameters

      • graphName: string: Name of the graph.
      • config?: RequestConfig: Request configuration.

      Returns

      • GraphSet: The retrieved graph.

      // Retrieves the graph named 'miniCircle'
      const graph = await driver.getGraph("miniCircle");
      console.log(graph);
      

      GraphSet {
        id: '9',
        name: 'miniCircle',
        totalNodes: '97',
        totalEdges: '632',
        shards: [ '1' ],
        partitionBy: 'CityHash64',
        status: 'NORMAL',
        description: '',
        slotNum: 256
      }
      

      hasGraph()

      Checks the existence of a specified graph in the database.

      Parameters

      • graphName: string: Name of the graph.
      • config?: RequestConfig: Request configuration.

      Returns

      • boolean: Check result.

      // Checks the existence of a graph named 'miniCircle'
      const graphName = "miniCircle";
      const response = await driver.hasGraph(graphName);
      console.log("Graph", graphName, "exists:", response);
      

      Graph miniCircle exists: true
      

      createGraph()

      Creates a graph in the database.

      Parameters

      • graphSet: GraphSet: The graph to be created; the filed name is mandatory, shards, partitionBy and description are optional.
      • config?: RequestConfig: Request configuration.

      Returns

      • Response: Response of the request.

      // Creates a graph
      const graph: GraphSet = {
        name: "myGraph",
        shards: ["1"],
        partitionBy: "Crc32",
        description: "My first graph"
      };
      const response = await driver.createGraph(graph)
      console.log(response.status?.message);
      

      SUCCESS
      

      createGraphIfNotExist()

      Creates a graph in the database and returns whether a graph with the same name already exists.

      Parameters

      • graphSet: GraphSet: The graph to be created; the filed name is mandatory, shards, partitionBy and description are optional.
      • config?: RequestConfig: Request configuration.

      Returns

      • ResponseWithExistCheck: Response of the request.

      // Creates a graph with existence check
      const graph: GraphSet = {
        name: "myGraph",
        shards: ["1"],
        partitionBy: "Crc32",
        description: "My first graph"
      };
      const result = await driver.createGraphIfNotExist(graph);
      console.log("Graph already exists:", result.exist);
      if (result.response.status?.code !== 0) {
        console.log("Error message:", result.response.status?.message);
      } else {
        if (result.response.statistics?.totalCost === 0) {
          console.log("New graph created: No");
        } else {
          console.log("New graph created: Yes");
        }
      };
      

      Graph already exists: true
      New graph created: No
      

      alterGraph()

      Alters the name and description of a graph in the database.

      Parameters

      • graphName: string: Name of the graph.
      • alterGraphset: GraphSet: A GraphSet object used to set new name and/or description for the graph.
      • config?: RequestConfig: Request configuration.

      Returns

      • Response: Response of the request.

      // Alters the name and description of the graph 'myGraph'
      const newGraphInfo: GraphSet = {
        name: "newGraph",
        description: "a new graph"
      };
      const response = await driver.alterGraph("myGraph", newGraphInfo);
      console.log(response.status?.message);
      

      SUCCESS
      

      dropGraph()

      Deletes a specified graph from the database.

      Parameters

      • graphName: string: Name of the graph.
      • config?: RequestConfig: Request configuration.

      Returns

      • Response: Response of the request.

      // Drops a graph
      const response = await driver.dropGraph("myGraph");
      console.log(response.status?.message);
      

      SUCCESS
      

      truncate()

      Truncates (Deletes) the specified nodes or edges in a graph or truncates the entire graph. Note that truncating nodes will cause the deletion of edges attached to those affected nodes. The truncating operation retains the definition of schemas and properties in the graph.

      Parameters

      • params: TruncateParams: The truncate parameters; the filed graphName is mandatory, schemaName and dbType are optional.
      • config?: RequestConfig: Request configuration.

      Returns

      • Response: Response of the request.

      // Truncates User nodes in 'myGraph'
      const param1: TruncateParams = { graphName: "myGraph", schemaName: "User", dbType: DBType.DBNODE }
      const response1 = await driver.truncate(param1);
      console.log(response1.status?.message);
      
      // Truncates all edges in the 'myGraph'
      const param2: TruncateParams = { graphName: "myGraph", schemaName: "*", dbType: DBType.DBEDGE }
      const response2 = await driver.truncate(param2);
      console.log(response2.status?.message);
      
      // Truncates 'myGraph'
      const param3: TruncateParams = { graphName: "myGraph" }
      const response3 = await driver.truncate(param3);
      console.log(response3.status?.message);
      

      SUCCESS
      SUCCESS
      SUCCESS
      

      compact()

      Clears invalid and redundant data for a graph. Valid data will not be affected.

      Parameters

      • graphName: string: Name of the graph.
      • config?: RequestConfig: Request configuration.

      Returns

      • JobResponse: Response of the request.

      // Compacts the graph 'miniCircle'
      const requestConfig: RequestConfig = { graph: "miniCircle" };
      const jobResponse = await driver.compact("miniCircle", requestConfig);
      console.log("Start compacting:", jobResponse.status?.message)
      const jobID = jobResponse.jobId;
      
      await new Promise(resolve => setTimeout(resolve, 3000))
      
      const jobs = await driver.showJob(jobID, requestConfig);
      for (const job of jobs) {
        console.log("Compact graph job:", `${job.id} - ${job.status}`);
      }
      

      Start compacting: SUCCESS
      Compact graph job: 4 - FINISHED
      Compact graph job: 4_1 - FINISHED
      

      Full Example

      import { UltipaDriver } from "@ultipa-graph/ultipa-driver";
      import type { ULTIPA } from "@ultipa-graph/ultipa-driver/dist/types/index.js";
      import { GraphSet } from "@ultipa-graph/ultipa-driver/dist/types/types.js";
      
      let sdkUsage = async () => {
        const ultipaConfig: ULTIPA.UltipaConfig = {
          // URI example: hosts: ["xxxx.us-east-1.cloud.ultipa.com:60010"]
          hosts: ["10.xx.xx.xx:60010"],
          username: "<username>",
          password: "<password>"
        };
      
        const driver = new UltipaDriver(ultipaConfig);
      
        // Creates a graph
        const graph: GraphSet = {
          name: "myGraph1",
          shards: ["1"],
          partitionBy: "Crc32",
          description: "My first graph"
        };
        const response = await driver.createGraph(graph)
        console.log(response.status?.message);
      };
      
      sdkUsage().catch(console.error);
      
      Please complete the following information to download this book
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      Privacy Policy
      Please agree to continue.

      Copyright © 2019-2025 Ultipa Inc. – All Rights Reserved   |  Security   |  Legal Notices   |  Web Use Notices