Handle path with java client

Hi,

I use a request like :

SELECT $path FROM (TRAVERSE inE(),outV() FROM (SELECT FROM MyClass) )

I want to handle the $ path with the java client, the operations I want to do are:

  • Retrieve the last element of the path
  • Retrieve the list of links from a path
  • Retrieves the node list of a path

Do yo have a tools for that ?

Hi @TheMalloum

Are you on v 2.2 or on v 3.0?
There are some slight differences between the two

Thanks

Luigi

Hi @luigidellaquila,

I’m on 2.2

Hi @TheMalloum

In v 2.2 it’s a bit complex, because the $path is just a string representing the traversal.
You can elaborate it of course, but you have to write your own function for that.

In v 3.0 the situation is slightly different, the $path is an actual list of RIDs, so you can take the last element easily.

Thanks

Luigi

Hi,

Thanks a lot i will see.

Hi,

I switch to the 3.0.21 version and it’is the same $path when i do this :

String sql = “select $path FROM (TRAVERSE inE(),outV() FROM (SELECT FROM V))”

Iterable iterable = graph.command(new OCommandSQL(sql)).execute();

    for (Object object : iterable) {

        ((OrientVertex) object).getProperty("$path"))

}

Is it Correct ?