更新时间:2022-06-30 GMT+08:00

点过滤查询

GES提供点过滤查询接口,您可以使用该接口查询满足过滤条件的顶点集合。示例代码如下:

 public static void vertexQuery(GraphClient graphClient) throws ApiException
{
//点过滤查询请求
VertexFilterQueryReq req = new VertexFilterQueryReq();
 List<String> labels = new ArrayList<>();
 labels.add("movie");
//按label过滤点
req.setLabels(labels);
//设置offset和limit
req.setOffset(0);
 req.setLimit(5);
//发送请求,拿到异步API结果
AsyncAPIResp asyncAPIResp = graphClient.vertexQuery(req);
//点过滤查询为异步API,取出jobId
String jobId = asyncAPIResp.getJobId();
//点查询Job请求
VertexQueryJobReq req1 = new VertexQueryJobReq();
//设置jobId
req1.setJobId(jobId);
//获取job查询结果
JobResp<QueryData<VertexQueryResult>> resp = graphClient.queryJobStatus(req1);
 System.out.println(resp);
}