I am using a Github example to generate a graph (https://github.com/Azure-Samples/azure-cosmos-db-graph-java-getting-started). And now I want to query it and hold a vertex instance in my hand to traverse further depending on further inputs from the user in a knowledge graph.
Submitting this gremlin query: g.V().hasLabel('schedule').inE().outV().hasLabel('url').as('a').dedup()
.where(and(out().hasLabel('schedule').has('name','3'),out()
.hasLabel('states').has('name', 'federal'))).select('a')
// Submitting remote query to the server.
ResultSet results = client.submit(query);
CompletableFuture<List<Result>> completableFutureResults = results.all();
List<Result> resultList = completableFutureResults.get();
for (Result result : resultList) {
System.out.println("My vertex--"+result.getVertex());
System.out.println("\nQuery result:");
System.out.println("resultssssss-"+result.toString());
}
How can I do that as right now I am getting a class cast exception as mentioned below:
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to org.apache.tinkerpop.gremlin.structure.Vertex
at org.apache.tinkerpop.gremlin.driver.Result.getVertex(Result.java:131)
at GetStarted.Dynamic.main(Dynamic.java:155)