Reputation: 861
I am trying to query a Vertex (B) that is linked to a vertex (A) that I'm querying. I tried below query, but it returns the linked vertex(B) not the vertex (A) that I've selected .
select expand(out(A)[title='xyz']) from A
This returns all Vertices from B. I need to how this fits in the where clause.
Upvotes: 2
Views: 206
Reputation: 116977
Apart from being more direct, wouldn't the following generally be more efficient than beginning at A?
select in(E) from (select from B where title='xyz') unwind in
Upvotes: 1
Reputation: 1418
I created this structure to try your case:
I have these options to get the results you're looking for:
Query 1:
select from A where out(E)[title='xyz'].size() > 0
Output:
----+-----+------+-----+--------
# |@RID |@CLASS|title|out_
----+-----+------+-----+--------
0 |#12:0|A |abc |[size=3]
----+-----+------+-----+--------
Query 2:
select from A where out(E).title contains 'xyz'
Output:
----+-----+------+-----+--------
# |@RID |@CLASS|title|out_
----+-----+------+-----+--------
0 |#12:0|A |abc |[size=3]
----+-----+------+-----+--------
Hope it helps
Upvotes: 3