修改密码

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

修改昵称

当前昵称:
提交

申请证书

证书详情

Please complete this required field.

  • Ultipa Blaze (v4)

Standalone

Please complete this required field.

Please complete this required field.

Please complete this required field.

Please complete this required field.

如果不需要 HDC 服务,则此项留空。

Please complete this required field.

如果不需要 HDC 服务,则此项留空。

Please complete this required field.

Please complete this required field.

所有服务器的MAC地址,由换行符或逗号分隔。

Please complete this required field.

Please complete this required field.

取消
申请
ID
产品
状态
核数
Shard 服务最大数量
Shard 服务最大总核数
HDC 服务最大数量
HDC 服务最大总核数
申请天数
审批日期
过期日期
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

      数据导出

      本节介绍用于导出点、边的方法。

      export()

      导出图中的点或边。

      参数

      • exportRequest: ExportRequest:导出请求的配置,包括dbTypeschemaselectPropertiesgraph
      • listener: ExportListener:导出数据时执行的监听函数。
      • config: RequestConfig(可选):请求配置。

      返回值

      // Exports 'account' nodes in the graph 'miniCircle'
      
      Ultipa.ExportRequest exportRequest = Ultipa.ExportRequest.newBuilder()
      		.setDbType(Ultipa.DBType.DBNODE)
        		.setSchema("account")
        		.setGraph("miniCircle")
        		.addSelectProperties("_id")
        		.addSelectProperties("name")
        		.addSelectProperties("year")
        		.build();
      
      driver.export(exportRequest, new ExportListener() {
          FileWriter csvWriter;
          String schemaName = exportRequest.getSchema();
          String suffix = exportRequest.getDbType() == Ultipa.DBType.DBNODE ? "_node.csv" : "_edge.csv";
          String fileName = schemaName + suffix;
      
          {
              try {
            		csvWriter = new FileWriter(fileName);
            		csvWriter.append("_id,name,year\n"); // header row
              } catch (IOException e) {
            	    throw new RuntimeException("Failed to create CSV file", e);
              }
          }
      
          public void onReady() {
          	System.out.println("Start downloading");
          }
      
          public void onError(Throwable t) {
          	System.out.println("Error occurred while downloading: " + t.getMessage());
          }
      
          public void onComplete() {
          	System.out.println("Download complete");
          	try {
            		if (csvWriter != null) csvWriter.close();
          	} catch (IOException e) {
            		e.printStackTrace();
          	}
        	}
      
          public void next(ExportData result) {
          	List<Node> nodes = result.getNodes();
          	for (Node node : nodes) {
            		try {
              		List<String> values = Arrays.asList(
                		String.valueOf(node.getID()),
                		String.valueOf(node.get("name")),
                		String.valueOf(node.get("year"))
              	).stream().map(val -> "\"" + val + "\"").collect(Collectors.toList()); // wrap values in quotes
      
              	csvWriter.append(String.join(",", values)).append("\n");
      			} catch (IOException e) {
              		System.err.println("Failed to write a row to CSV: " + e.getMessage());
            		}
          	}
          }
      });
      

      Download complete
      

      导出文件account_nodes.csv将保存到项目文件根目录中。

      完整示例

      package com.ultipa.www.sdk.api;
      
      import com.ultipa.Ultipa;
      import com.ultipa.sdk.UltipaDriver;
      import com.ultipa.sdk.connect.conf.UltipaConfig;
      import com.ultipa.sdk.operate.command.listener.ExportListener;
      import com.ultipa.sdk.operate.entity.*;
      import com.ultipa.sdk.operate.response.ExportData;
      import org.assertj.core.util.Lists;
      
      import java.util.Arrays;
      import java.util.List;
      import java.io.FileWriter;
      import java.io.IOException;
      import java.util.stream.Collectors;
      
      public class Main {
          public static void main(String[] args) {
              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);
      
                  // Exports 'account' nodes in the graph 'miniCircle'
      
                  Ultipa.ExportRequest exportRequest = Ultipa.ExportRequest.newBuilder()
                          .setDbType(Ultipa.DBType.DBNODE)
                          .setSchema("account")
                          .setGraph("miniCircle")
                          .addSelectProperties("_id")
                          .addSelectProperties("name")
                          .addSelectProperties("year")
                          .build();
      
                  driver.export(exportRequest, new ExportListener() {
                      FileWriter csvWriter;
                      String schemaName = exportRequest.getSchema();
                      String suffix = exportRequest.getDbType() == Ultipa.DBType.DBNODE ? "_node.csv" : "_edge.csv";
                      String fileName = schemaName + suffix;
      
                      {
                          try {
                              csvWriter = new FileWriter(fileName);
                              csvWriter.append("_id,name,year\n"); // header row
                          } catch (IOException e) {
                              throw new RuntimeException("Failed to create CSV file", e);
                          }
                      }
      
                      public void onReady() {
                          System.out.println("Start downloading");
                      }
      
                      public void onError(Throwable t) {
                          System.out.println("Error occurred while downloading: " + t.getMessage());
                      }
      
                      public void onComplete() {
                          System.out.println("Download complete");
                          try {
                              if (csvWriter != null) csvWriter.close();
                          } catch (IOException e) {
                              e.printStackTrace();
                          }
                      }
      
                      public void next(ExportData result) {
                          List<Node> nodes = result.getNodes();
                          for (Node node : nodes) {
                              try {
                                  List<String> values = Arrays.asList(
                                          String.valueOf(node.getID()),
                                          String.valueOf(node.get("name")),
                                          String.valueOf(node.get("year"))
                                  ).stream().map(val -> "\"" + val + "\"").collect(Collectors.toList()); // wrap values in quotes
      
                                  csvWriter.append(String.join(",", values)).append("\n");
                              } catch (IOException e) {
                                  System.err.println("Failed to write a row to CSV: " + e.getMessage());
                              }
                          }
                      }
                  });
              } catch (InterruptedException e) {
                  throw new RuntimeException(e);
              } finally {
                  if (driver != null) {
                      driver.close();
                  }
              }
          }
      }
      
      请完成以下信息后可下载此书
      *
      公司名称不能为空
      *
      公司邮箱必须填写
      *
      你的名字必须填写
      *
      你的电话必须填写
      *
      你的电话必须填写