修改密码

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

      下载与导出

      本节为您介绍如何使用Connection对象的方法下载算法结果文件,从图集导出点和边。

      每个示例主要展示如何使用所列方法。点击完整示例查看完整代码示例。

      downloadAlgoResultFile()

      下载当前图集一个算法任务中的一个结果文件。

      参数:

      • String:文件名称。
      • String:生成结果文件的算法任务ID。
      • DownloadFileResultListener:下载进程的监听器。
      • RequestConfig(可选):配置请求。

      返回值:

      • Response:请求的结果。

      RequestConfig requestConfig = new RequestConfig();
      requestConfig.setGraphName("miniCircle");
      
      // 在图集miniCircle上运行鲁汶算法并打印任务ID
      
      Response response = client.uql("algo(louvain).params({phase1_loop_num: 20, min_modularity_increase: 0.001}).write({file:{filename_community_id: 'communityID', filename_ids: 'ids', filename_num: 'num'}})", requestConfig);
      Table table = response.alias("_task").asTable();
      String taskId = (String) table.getRows().get(0).get(0);
      System.out.println("taskId = " + taskId);
      
      Thread.sleep(2000);
      
      // 下载以上算法任务生成的一个文件,打印文件内容和下载响应信息
      
      Response resDownLoad = client.downloadAlgoResultFile("communityID", taskId, new DownloadFileResultListener() {
          public void onReady(String s) {
              System.out.println("Start downloading");
          }
          public void next(String filename, DownloadFileResult result) {
              System.out.println("Content of the file '" + filename + "':");
              System.out.println("-----------------------");
              System.out.println(new String(result.getBytes(), StandardCharsets.UTF_8));
              System.out.println("-----------------------");
          }
          public void onComplete(String s) {
              System.out.println("Download complete");
          }
          public void onError(String s, Throwable throwable) {
              System.out.println("Error occurred while downloading");
          }
      }, requestConfig);
      
      System.out.println("resDownLoad = " + new Gson().toJson(resDownLoad));
      

      taskId = 54228
      Content of the file 'communityID':
      -----------------------
      ULTIPA8000000000000001,94
      ...
      ULTIPA8000000000004E6E,154
      
      -----------------------
      Download complete
      resDownLoad = {"host":"192.168.1.88:60611","status":{"errorCode":"SUCCESS","msg":"","clusterInfo":{"redirect":"","leaderAddress":"","followers":[]}},"aliases":[],"items":{}}
      

      downloadAllAlgoResultFile()

      下载当前图集一个算法任务中的全部结果文件。

      参数:

      • String:生成结果文件的算法任务ID。
      • DownloadFileResultListener:下载进程的监听器。
      • RequestConfig(可选):配置请求。

      返回值:

      • Response:请求的结果。

      RequestConfig requestConfig = new RequestConfig();
      requestConfig.setGraphName("miniCircle");
      
      // 在图集miniCircle上运行鲁汶算法并打印任务ID
      
      Response response = client.uql("algo(louvain).params({phase1_loop_num: 20, min_modularity_increase: 0.001}).write({file:{filename_community_id: 'communityID', filename_ids: 'ids', filename_num: 'num'}})", requestConfig);
      Table table = response.alias("_task").asTable();
      String taskId = (String) table.getRows().get(0).get(0);
      System.out.println("taskId = " + taskId);
      
      Thread.sleep(2000);
      
      // 下载以上算法任务生成的全部文件,打印每个文件的内容和下载响应信息
      
      Response resDownLoad = client.downloadAllAlgoResultFile(taskId, new DownloadFileResultListener() {
          public void onReady(String s) {
              System.out.println("Start downloading");
          }
          public void next(String filename, DownloadFileResult result) {
              System.out.println("Content of the file '" + filename + "':");
              System.out.println("-----------------------");
              System.out.println(new String(result.getBytes(), StandardCharsets.UTF_8));
              System.out.println("-----------------------");
          }
          public void onComplete(String s) {
              System.out.println("Download complete");
          }
          public void onError(String s, Throwable throwable) {
              System.out.println("Error occurred while downloading");
          }
      }, requestConfig);
      
      System.out.println("resDownLoad = " + new Gson().toJson(resDownLoad));
      

      taskId = 54229
      Content of the file 'communityID':
      -----------------------
      ULTIPA8000000000000001,137
      ...
      ULTIPA8000000000004E6E,284
      
      -----------------------
      Download complete
      Content of the file 'ids':
      -----------------------
      284,ULTIPA800000000000001A,ULTIPA8000000000000412,...
      ...
      179,ULTIPA800000000000001E,ULTIPA800000000000002B,...
      -----------------------
      Download complete
      Content of the file 'num':
      -----------------------
      284,89
      ...
      179,23
      
      -----------------------
      Download complete
      resDownLoad = {"status":{"errorCode":"SUCCESS","msg":"success"},"aliases":[],"items":{}}
      

      export()

      从当前图集导出点和边。

      参数:

      • ExportRequest:导出请求的配置信息,包括dbType:Ultipa.DBTypeschema:Stringlimit:IntegerselectPropertiesName:List<String>
      • ExportListener:导出进程的监听器。
      • RequestConfig(可选):配置请求。

      返回值:

      • Response:请求的结果。

      // 从图集miniCircle名为account的schema导出10个点,并打印点的信息
      
      RequestConfig requestConfig = new RequestConfig();
      requestConfig.setGraphName("miniCircle");
      
      ExportRequest exportRequest = new ExportRequest();
      exportRequest.setDbType(Ultipa.DBType.DBNODE);
      exportRequest.setLimit(10);
      exportRequest.setSchema("account");
      exportRequest.setSelectPropertiesName(Arrays.asList("_id", "_uuid", "name", "year"));
      
      Response response = client.export(exportRequest, new ExportListener() {
          public void onReady() {
              System.out.println("Start downloading");
          }
          public void onError(Throwable t) {
              System.out.println("Error occurred while downloading");
          }
          public void onComplete() {
              System.out.println("Download complete");
          }
      
          public void next(ExportData result) {
              List<Node> nodes = result.getNodes();
              for (Node node : nodes) {
                  System.out.println(node.toString());
              }
          }
      }, requestConfig);
      

      Node(uuid=1, id=ULTIPA8000000000000001, schema=account, values={_id=ULTIPA8000000000000001, name=Yu78, year=1978})
      Node(uuid=2, id=ULTIPA8000000000000002, schema=account, values={_id=ULTIPA8000000000000002, name=jibber-jabber, year=1989})
      Node(uuid=3, id=ULTIPA8000000000000003, schema=account, values={_id=ULTIPA8000000000000003, name=mochaeach, year=1982})
      Node(uuid=4, id=ULTIPA8000000000000004, schema=account, values={_id=ULTIPA8000000000000004, name=Win-win0, year=2007})
      Node(uuid=5, id=ULTIPA8000000000000005, schema=account, values={_id=ULTIPA8000000000000005, name=kevinh, year=1973})
      Node(uuid=6, id=ULTIPA8000000000000006, schema=account, values={_id=ULTIPA8000000000000006, name=alexyhel, year=1974})
      Node(uuid=7, id=ULTIPA8000000000000007, schema=account, values={_id=ULTIPA8000000000000007, name=hooj, year=1986})
      Node(uuid=8, id=ULTIPA8000000000000008, schema=account, values={_id=ULTIPA8000000000000008, name=vv67, year=1990})
      Node(uuid=9, id=ULTIPA8000000000000009, schema=account, values={_id=ULTIPA8000000000000009, name=95smith, year=1988})
      Node(uuid=10, id=ULTIPA800000000000000A, schema=account, values={_id=ULTIPA800000000000000A, name=jo, year=1992})
      Download complete
      

      完整示例

      package com.ultipa.www.sdk.api;
      
      import com.google.gson.Gson;
      import com.ultipa.sdk.connect.Connection;
      import com.ultipa.sdk.connect.conf.RequestConfig;
      import com.ultipa.sdk.connect.conf.UltipaConfiguration;
      import com.ultipa.sdk.connect.driver.UltipaClientDriver;
      import com.ultipa.sdk.operate.command.listener.DownloadFileResultListener;
      import com.ultipa.sdk.operate.entity.*;
      import com.ultipa.sdk.operate.response.DownloadFileResult;
      import com.ultipa.sdk.operate.response.Response;
      import java.nio.charset.StandardCharsets;
      
      public class Main {
          public static void main(String[] args) {
              // 设置连接
              UltipaConfiguration myConfig = UltipaConfiguration.config()
                  // URI示例: .hosts("mqj4zouys.us-east-1.cloud.ultipa.com:60010")
                  .hosts("192.168.1.85:60611,192.168.1.87:60611,192.168.1.88:60611")
                  .username("<username>")
                  .password("<password>");
      
              UltipaClientDriver driver = null;
              try {
                  // 建立与数据库的连接
                  driver = new UltipaClientDriver(myConfig);
                  Connection client = driver.getConnection();
      
                  Thread.sleep(3000);
                
                  RequestConfig requestConfig = new RequestConfig();
                  requestConfig.setGraphName("miniCircle");
      
                  // 运行鲁汶算法并打印任务ID
      
                  Response response = client.uql("algo(louvain).params({phase1_loop_num: 20, min_modularity_increase: 0.001}).write({file:{filename_community_id: 'communityID', filename_ids: 'ids', filename_num: 'num'}})", requestConfig);
                  Table table = response.alias("_task").asTable();
                  String taskId = (String) table.getRows().get(0).get(0);
                  System.out.println("taskId = " + taskId);
      
                  Thread.sleep(2000);
      
                  // 下载以上算法任务生成的全部文件,打印每个文件的内容和下载响应信息
      
                  Response resDownLoad = client.downloadAllAlgoResultFile(taskId, new DownloadFileResultListener() {
                      public void onReady(String s) {
                          System.out.println("Start downloading");
                      }
                      public void next(String filename, DownloadFileResult result) {
                          System.out.println("Content of the file '" + filename + "':");
                          System.out.println("-----------------------");
                          System.out.println(new String(result.getBytes(), StandardCharsets.UTF_8));
                          System.out.println("-----------------------");
                      }
                      public void onComplete(String s) {
                          System.out.println("Download complete");
                      }
                      public void onError(String s, Throwable throwable) {
                          System.out.println("Error occurred while downloading");
                      }
                  }, requestConfig);
      
                  System.out.println("resDownLoad = " + new Gson().toJson(resDownLoad));
              } catch (InterruptedException e) {
                  throw new RuntimeException(e);
              } finally {
                  if (driver != null) {
                      driver.close();
                  }
              }
          }
      }
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写