修改密码

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

v5.0
搜索
    v5.0

      执行UQL

      本节介绍如何使用uql()uqlStream()方法在数据库中执行UQL。

      UQL由嬴图开发,用于操作嬴图数据库。详情参阅UQL文档

      uql()

      在数据库中执行UQL语句。

      参数

      • uql: String:待执行的UQL语句。
      • config: RequestConfig(可选):请求配置。

      返回值

      • Response:请求结果。

      // Retrieves 5 movie nodes from the graph 'miniCircle'
      
      RequestConfig requestConfig = new RequestConfig();
      requestConfig.setGraph("miniCircle");
      
      Response response = driver.uql("find().nodes({@movie}) as n return n{*} limit 5", requestConfig);
      List<Node> nodeList = response.alias("n").asNodes();
      for (Node node : nodeList) {
        System.out.println(node.get("name"));
      }
      

      The Shawshank Redemption
      Farewell My Concubine
      Léon: The Professional
      Titanic
      Life is Beautiful
      

      uqlStream()

      在数据库中执行UQL语句并以增量形式返回结果。在处理大型数据集时,避免同时加载所有数据至内存中。

      参数

      • uql: String:待执行的UQL语句。
      • cb: QueryResponseListener:流处理监听器。
      • config: RequestConfig(可选):请求配置。

      返回值

      • None

      // Retrieves all 1-step paths from the graph 'miniCircle'
      
      RequestConfig requestConfig = new RequestConfig();
      requestConfig.setGraph("miniCircle");
      
      driver.uqlStream("n().e().n() as paths return paths{*}", new QueryResponseListener() {
        int count = 0;
      
        public void onReady() {
          System.out.println("Start downloading");
        }
      
        public void next(Response response) {
          if (response.getStatus().getErrorCode() != Ultipa.ErrorCode.SUCCESS){
            System.out.println(response.getStatus().getMsg());
          }
          List<Path> paths = response.get(0).asPaths();
          count += paths.size();
          System.out.println("count = " + count);
        }
      
        public void onComplete() {
          System.out.println("Done");
          System.out.println("count = " + count);
        }
      
        public void onError(Throwable throwable) {
          System.out.println("Error");
      
        }
      }, requestConfig);
      

      count = 1024
      count = 2048
      count = 3072
      count = 3220
      count = 3621
      count = 3849
      Done
      count = 3849
      

      完整示例

      package com.ultipa.www.sdk.api;
      
      import com.ultipa.sdk.UltipaDriver;
      import com.ultipa.sdk.connect.conf.RequestConfig;
      import com.ultipa.sdk.connect.conf.UltipaConfig;
      import com.ultipa.sdk.operate.entity.Node;
      import com.ultipa.sdk.operate.response.Response;
      import org.assertj.core.util.Lists;
      
      import java.util.List;
      
      public class Main {
          public static void main(String[] args) throws InterruptedException {
              UltipaConfig ultipaConfig = UltipaConfig.config()
                      // URI example: .hosts(Lists.newArrayList("d3026ac361964633986849ec43b84877s.eu-south-1.cloud.ultipa.com:8443"))
                      .hosts(Lists.newArrayList("192.168.1.85:60061","192.168.1.88:60061","192.168.1.87:60061"))
                      .username("<username>")
                      .password("<password>");
      
              UltipaDriver driver = null;
      
              try {
                  driver = new UltipaDriver(ultipaConfig);
                  Boolean isSuccess = driver.test();
      
                  // Retrieves 5 movie nodes from the graph 'miniCircle'
      
                  RequestConfig requestConfig = new RequestConfig();
                  requestConfig.setGraph("miniCircle");
      
                  Response response = driver.uql("find().nodes({@movie}) as n return n{*} limit 5", requestConfig);
                  List<Node> nodeList = response.alias("n").asNodes();
                  for (Node node : nodeList) {
                      System.out.println(node.get("name"));
                  }
              } finally {
                  if (driver != null) {
                      driver.close();
                  }
              }
          }
      }
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写