To get all vertices of a specific label and their adjacent vertices
(potentially none), run:

g.V().hasLabel(<specificLabel>).
  project("v","a").
    by().                     // by(valueMap()) if you need the vertex
properties
    by(both().dedup().fold()) // by(both().dedup().valueMap().fold()) if
you need the adjacent vertex properties


This will return a bunch of maps, each containing the two keys v and a,
where v is the vertex with the "specific label" and a is a list that
contains its adjacent vertices.

Cheers,
Daniel


On Wed, Jul 11, 2018 at 3:36 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.
>

Reply via email to