1
votes

Can I do one query to achieve vertex and all of his edges (including the other vertexes)?

now I'm doing multiple queries to achieve it:

For getting the vertex:

select from V where entity_name = 'SomeEntity'

Then going over each edge and select it:

select from #EDGE@rid // Multiple in the number of edges for this node

And at the end going over the edges and getting all other vertexes (except the original)

select from #VERTEX@rid // Multiple in the number of vertexes in the edges
2

2 Answers

0
votes
SELECT *,in(),out() FROM V WHERE entity_name = 'SomeEntity'
0
votes

I used the following to get all Vertexes and Edges in the required depth from my Vertex:

TRAVERSE inE(), outE(), inV(), outV() 
FROM (select from V where entity_name = 'SomeEntity') 
WHILE $depth <= 2