Querying Vertices That Meet Filtering Conditions
You can use a specific API provided by GES to query the vertex set that meet the filtering conditions. The sample code is as follows:
public static void vertexQuery(GraphClient graphClient) throws ApiException
{
//Request of querying vertices that meet the filtering conditions
VertexFilterQueryReq req = new VertexFilterQueryReq();
List<String> labels = new ArrayList<>();
labels.add("movie");
//Filter vertices by label.
req.setLabels(labels);
//Set the offset and limit.
req.setOffset(0);
req.setLimit(5);
//Send the request to obtain the asynchronous API result.
AsyncAPIResp asyncAPIResp = graphClient.vertexQuery(req);
//This API is an asynchronous API. Obtain the jobId.
String jobId = asyncAPIResp.getJobId();
//Vertex query job request
VertexQueryJobReq req1 = new VertexQueryJobReq();
//Set the jobId.
req1.setJobId(jobId);
//Obtain the job query result.
JobResp<QueryData<VertexQueryResult>> resp = graphClient.queryJobStatus(req1);
System.out.println(resp);
}
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.