修改密码

请输入密码
请输入密码 请输入8-64长度密码 和 email 地址不相同 至少包括数字、大写字母、小写字母、半角符号中的 3 个
请输入密码
提交

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Graph V4

Standalone

Please complete this required field.

Please complete this required field.

服务器的MAC地址

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
申请天数
审批时间
过期时间
MAC地址
申请理由
审核信息
关闭
基础信息
  • 用户昵称:
  • 手机号:
  • 公司名称:
  • 公司邮箱:
  • 地区:
  • 语言:
修改密码
申请证书

当前未申请证书.

申请证书
Certificate Issued at Valid until Serial No. File
Serial No. Valid until File

Not having one? Apply now! >>>

ProductName CreateTime ID Price File
ProductName CreateTime ID Price File

No Invoice

搜索
    中文

      批量插入

      数据类型

      Ultipa 属性与 NodeJS 数据类型的对应关系:

      Ultipa NodeJS
      string string
      text string
      float string
      double number
      int32 number
      uint32 number
      int64 string
      uint64 string
      datetime string
      timestamp number

      由于 NodeJS 中 number 的范围有限,故 int64 和 uint64 需用 string 表示;出于精度的考虑,float 也需要用 string 来表示。

      insertNodesBatchBySchema()

      InsertNodesBatchBySchema() 可以为某一个点 schema 导入多条数据。

      方法及相关接口:

      insertNodesBatchBySchema(schema: ULTIPA.Schema, 
      						 rows: ULTIPA.Node[], 
                               config: RequestType.InsertRequestConfig
      ): Promise<ULTIPA.Response<ResponseType.InsertNodes>>
      
      type Schema = {
      	name: string;
          properties: Property[];
      }
      
      type Property = {
      	name: string;
          type: PropertyType;
      }
      
      class Node {
      	schema: string;
          id: string;
          uuid: string;
          values: object;
      }
      

      示例:为图集 test 的点 schema 'card' 插入多条数据,采用普通插入模式

      import { ConnectionPool, RequestType, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接并使用 default 图集,此部分代码省略
        
        let schema = <ULTIPA.Schema>{
          name: "card",
          properties: [
            {
              name: "balance",
              type: ULTIPA.PropertyType.PROPERTY_FLOAT,
            },
            {
              name: "level",
              type: ULTIPA.PropertyType.PROPERTY_INT32,
            },
          ],
        };
      
        let node1 = new ULTIPA.Node();
        node1.values = { balance: 3235.2, level: 2 };
        let node2 = new ULTIPA.Node();
        node2.values = { level: 1 };
        let nodes = [node1, node2];
      
        let insertRequestConfig = <RequestType.InsertRequestConfig>{
          graphSetName: "test",
          insertType: ULTIPA.InsertType.INSERT_TYPE_NORMAL,
        };
      
        let resp = await conn.insertNodesBatchBySchema(schema, nodes, insertRequestConfig);
        console.log(resp.status.code_desc);
        
      };
      
      sdkUsage();
      

      insertNodesBatchAuto()

      InsertNodesBatchAuto() 可以同时为多个点 schema 导入多条数据,需保证数据携带 schema 信息。

      方法及相关接口:

      insertNodesBatchAuto(rows: ULTIPA.Node[], 
      					 config?: RequestType.InsertRequestConfig
      ): Promise<ULTIPA.Response<ResponseType.InsertNodes>>
      
      class Node {
      	schema: string;
          id: string;
          uuid: string;
          values: object;
      }
      

      示例:为图集 test 的多个点 schema 插入多条数据,采用插入更新模式

      import { ConnectionPool, RequestType, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接并使用 default 图集,此部分代码省略
        
        let node1 = new ULTIPA.Node();
        node1.schema = "card";
        node1.id = "ULTIPA8000000000000001";
        node1.values = { level: 1 };
      
        let node2 = new ULTIPA.Node();
        node2.schema = "client";
        node2.id = "ULTIPA800000000000002C";
        node2.values = { name: "Grace" };
      
        let nodes = [node1, node2];
      
        let insertRequestConfig = <RequestType.InsertRequestConfig>{
          graphSetName: "test",
          insertType: ULTIPA.InsertType.INSERT_TYPE_UPSERT,
        };
      
        let resp = await conn.insertNodesBatchAuto(nodes, insertRequestConfig);
        console.log(resp.status.code_desc);
        
      };
      
      sdkUsage();
      

      insertEdgesBatchBySchema()

      insertEdgesBatchBySchema() 可以为某一个边 schema 导入多条数据。

      方法及相关接口:

      insertEdgesBatchBySchema(schema: ULTIPA.Schema, 
      						 rows: ULTIPA.Edge[], 
                               config: RequestType.InsertRequestConfig
      ): Promise<ULTIPA.Response<ResponseType.InsertNodes>>
      
      type Schema = {
      	name: string;
          properties: Property[];
      }
      
      type Property = {
      	name: string;
          type: PropertyType;
      }
      
      class Edge {
      	schema: string;
          from: string;
          to: string;
          uuid: string;
          from_uuid: string;
          to_uuid: string;
          values: object;
      }
      

      示例:为图集 test 的边 schema 'transfer' 插入多条数据,采用普通插入模式,允许创建不存在的端点

      import { ConnectionPool, RequestType, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接并使用 default 图集,此部分代码省略
        
        let schema = <ULTIPA.Schema>{
          name: "transfer",
          properties: [
            {
              name: "amount",
              type: ULTIPA.PropertyType.PROPERTY_DOUBLE,
            },
            {
              name: "remark",
              type: ULTIPA.PropertyType.PROPERTY_STRING,
            },
          ],
        };
      
        let edge1 = new ULTIPA.Edge();
        edge1.from = "CARD00001";
        edge1.to = "CARD00004";
        edge1.values = { amount: 140.5, remark: "retail" };
        
        let edge2 = new ULTIPA.Edge();
        edge2.from = "CARD00002";
        edge2.to = "CARD00004";  
        edge2.values = { amount: 1999 };
        
        let edges = [edge1, edge2];
      
        let insertRequestConfig = <RequestType.InsertRequestConfig>{
          graphSetName: "test",
          insertType: ULTIPA.InsertType.INSERT_TYPE_NORMAL,
          createNodeIfNotExist: true,
        };
      
        let resp = await conn.insertEdgesBatchBySchema(schema, edges, insertRequestConfig);
        console.log(resp.status.code_desc);
        
      };
      
      sdkUsage();
      

      insertEdgesBatchAuto()

      insertEdgesBatchAuto() 可以同时为多个边 schema 导入多条数据,需保证数据携带 schema 信息。

      方法及相关接口:

      insertEdgesBatchAuto(rows: ULTIPA.Edge[], 
      					 config: RequestType.InsertRequestConfig
      ): Promise<ULTIPA.Response<ResponseType.InsertEdges>>
      
      class Edge {
      	schema: string;
          from: string;
          to: string;
          uuid: string;
          from_uuid: string;
          to_uuid: string;
          values: object;
      }
      

      示例:为图集 test 的多个边 schema 插入多条数据,采用插入覆盖模式,允许创建不存在的端点

      import { ConnectionPool, RequestType, ULTIPA } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接并使用 default 图集,此部分代码省略
        
        let edge1 = new ULTIPA.Edge();
        edge1.schema = "transfer";
        edge1.uuid = "33";
        edge1.from = "CARD00001";
        edge1.to = "CARD00004";
        edge1.values = { amount: 164.5 };
        
        let edge2 = new ULTIPA.Edge();
        edge2.schema = "has";
        edge2.from = "ULTIPA0000001";
        edge2.to = "CARD00004";  
        
        let edges = [edge1, edge2];
      
        let insertRequestConfig = <RequestType.InsertRequestConfig>{
          graphSetName: "test",
          insertType: ULTIPA.InsertType.INSERT_TYPE_OVERWRITE,
          createNodeIfNotExist: true,
        };
      
        let resp = await conn.insertEdgesBatchAuto(edges, insertRequestConfig);
        console.log(resp.status.code_desc);
        
      };
      
      sdkUsage();
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写