First, you should be using the Traversal API - http://tinkerpop.apache.org/docs/current/reference/#traversal - instead of the Graph API. Then you would return a map that represents the vertex: g.V().out("valid_for").path().by(valueMap(true))
gremlin> g.V().out().path().by(valueMap(true)) ==>[[id:1,label:person,name:[marko],age:[29]],[id:3,label:software,name:[lop],lang:[java]]] ==>[[id:1,label:person,name:[marko],age:[29]],[id:2,label:person,name:[vadas],age:[27]]] ==>[[id:1,label:person,name:[marko],age:[29]],[id:4,label:person,name:[josh],age:[32]]] ==>[[id:4,label:person,name:[josh],age:[32]],[id:5,label:software,name:[ripple],lang:[java]]] ==>[[id:4,label:person,name:[josh],age:[32]],[id:3,label:software,name:[lop],lang:[java]]] ==>[[id:6,label:person,name:[peter],age:[35]],[id:3,label:software,name:[lop],lang:[java]]] Robert Dale On Wed, Jul 11, 2018 at 6:51 AM [email protected] < [email protected]> wrote: > Hi guys, > > > my name is Antonio and i'm java developer. First of all i want to > congratulate with you for the great work you have done with Tinkerpop > framework. > > I' m working with Dse Graph using Tinkerpop for developing a feature of my > app and i'm facing a problem that i want to share with you. > > I've got a Rest service that must return all the vertices of a graph that > has a certain Label and for each of them i should return also the adjacent > vertices. > > I've built my Traversal properly and then i've performed the terminal step > "toList()" for having the vertices found on Dse Graph. For each of these > vertices i've called the "vertices" method for finding the adjacent > vertices (with Direction.OUT as first arg and "valid_for" as second arg) . > > After that i've run a junit test with TinkerGraph object to simulate a db > in memory and everything works fine but when i perform a test with Dse > Graph remote connection i've seen that the list of vertices returned by > "toList()" step are DetachedVertex and the method "vertices" is returning > an empty Collection. My question is the following: is there a way for > returning the original elements and not a DetachedVertex when i perform the > "toList()" step, so i can call the method "vertices" and get all the > adjacent vertices from my db? > > > Thanks. >
