修改密码

请输入密码
请输入密码 请输入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

搜索
    中文

      使用 UQL

      uql()

      方法及相关类:

      uql(uql: string, commonReq?: RequestType.RequestConfig): Promise<ULTIPA.UQLResponse>
      

      使用 uql() 进行请求时会返回结果类 ULTIPA.UQLResponse。

      UQLResponse 的字段:

      字段 类型 说明
      data? ULTIPA.UQLReply return 返回的数据、别名等信息
      req? any UQL 请求的信息
      explainPlans? ExplainPlan UQL 语句解析树
      status Status Ultipa Server 返回的执行状态
      statistic? Statistic 执行的统计信息,包含执行时间、影响点边数等

      ULTIPA.UQLResponse 的字段 data 是一个 ULTIPA.UQLReply 类。

      UQLReply 的字段:

      字段 类型 说明
      datas DataItem[] return 返回的数据,每个别名对应的 DataItem 类
      aliasMap object return 返回的别名信息
      statistics Statistics 执行的统计信息,包含执行时间、影响点边数等
      explainPlansTreeTopNode PlanNode UQL 语句解析树顶点

      UQLReply 的方法:

      方法 类型 说明
      toJSON() object 将数据(不含 aliasMap)组合为 json 对象
      singleDataNodes() Node[] 将查询结果中的第一个返回值(必须为 NODE 类型)提取为 Node[]
      singleDataEdges() Edge[] 将查询结果中的第一个返回值(必须为 EDGE 类型)提取为 Edge[]
      singleDataPaths() Path[] 将查询结果中的第一个返回值(必须为 PATH 类型)提取为 Path[]
      singleDataAttrs() AttrAlias 将查询结果中的第一个返回值(必须为 ATTR 类型)提取为 AttrAlias
      singleDataArrays() any[][] 将查询结果中的第一个返回值(必须为 ARRAY 类型)提取为 any[][]
      singleDataTables() Table 将查询结果中的第一个返回值(必须为 TABLE 类型)提取为 Table
      getTables() Table[] 将查询结果中所有 TABLE 类型的返回值提取为 Table[]
      get(index: number) DataItem 按下标获取查询结果中的某一个返回值(DataItem 类)
      alias(alias: string) DataItem 按别名获取查询结果中的某一个返回值(DataItem 类)

      返回值的别名类型有 NODE、EDGE、PATH 等,使用 DataItem 类的相应的方法可以将这些类型转为相应的类,详见下一章《返回值的结构化》。

      toJSON()

      示例:发送语句 insert().into(@default).nodes({}),将结果转为 json 并输出

      import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接,此部分代码省略
        
        let resp = await conn.uql("insert().into(@default).nodes({})");
        console.log(resp.data?.toJSON());
        
      };
      
      sdkUsage();
      

      输出:

      {
        statistics: {
          node_affected: '1',
          edge_affected: '0',
          total_time_cost: '1',
          engine_time_cost: '0'
        },
        explainPlansTreeTopNode: null,
        datas: []
      }
      

      get()

      示例:发送语句 return now() as currentTime, pi() as PI,获取第一个返回值

      import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接,此部分代码省略
        
        let resp = await conn.uql("return now() as currentTime, pi() as PI");
        console.log(resp.data?.get(0));
        
      };
      
      sdkUsage();
      

      输出:

      DataItem {
        data: [ '2022-12-22 02:10:14.816351' ],
        alias: 'currentTime',
        type: 4,
        typeDesc: 'RESULT_TYPE_ATTR'
      }
      

      alias()

      示例:发送语句 return now() as currentTime, pi() as PI,获取第二个返回值

      import { ConnectionPool } from "@ultipa-graph/ultipa-node-sdk";
      
      let sdkUsage = async () => {
      
        // 创建名为 conn 的连接,此部分代码省略
        
        let resp = await conn.uql("return now() as currentTime, pi() as PI");
        console.log(resp.data?.alias("PI"));
        
      };
      
      sdkUsage();
      

      输出:

      DataItem {
        data: [ 3.14159265358979 ],
        alias: 'PI',
        type: 4,
        typeDesc: 'RESULT_TYPE_ATTR'
      }
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写