0

I am using Dse 5.x graph.

In documentation, Datastax says that it is compatible to 'TinkerTop' API.

This below gremlin query run perfect in Orientdb(a tinkerTop based graph database)

public static List<Vertex> getAllNeighbour(Vertex vertex) {

        List<Vertex> list = new ArrayList<Vertex>();

        GremlinPipeline<Vertex, Vertex> vPipe = new GremlinPipeline<Vertex, Vertex>();
        vPipe.start(vertex).out();

        // Add all neighbors to array list
        for(Object oo : vPipe) {
            Vertex v = (Vertex) oo;
            list.add(v);
        }
        return list;
    }

but, when I am running this on Dse graph it says :

Exception in thread "main" java.lang.ClassCastException: com.datastax.driver.dse.graph.DefaultVertex cannot be cast to com.tinkerpop.blueprints.Vertex
    at com.tinkerpop.pipes.transform.VertexQueryPipe.processNextStart(VertexQueryPipe.java:85)
    at com.tinkerpop.pipes.transform.VertexQueryPipe.processNextStart(VertexQueryPipe.java:19)
    at com.tinkerpop.pipes.AbstractPipe.hasNext(AbstractPipe.java:98)
    at com.tinkerpop.pipes.util.Pipeline.hasNext(Pipeline.java:105)

What I want to achieve is:

Getting all the neighboring vertex of a vertex in DSE graph.

Is there any way I can run 'GremlinPipeline' query in Dse graph? or Any other way to do it.

Thanks..!

Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23
Prakash P
  • 3,582
  • 4
  • 38
  • 66

1 Answers1

2

What you are showing is the old TinkerPop 2 API. DSE Graph uses TinkerPop 3. In TinkerPop 3 your code would look more like this:

public static List<Vertex> getAllNeighbour(Vertex vertex) {
    return g.V(vertex).out().toList()
}
Daniel Kuppitz
  • 10,846
  • 1
  • 25
  • 34