Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Condition where-inV-is does not work

22 views
Skip to first unread message

Anton Eroshenko

unread,
Dec 15, 2020, 10:15:40 AM12/15/20
to JanusGraph users

Hi, JanusGraph users.
I try a simple query from TinkerPop docs with my JanusGraph installation, but it does not work as expected. How is it possible:
gremlin> g.V(41099392).outE('LINK').inV()
==>v[110792]
==>v[81993864]
gremlin> g.V(41099392).outE('LINK').where(inV().is(V(110792)))
gremlin>

The last query returns nothing...
How to filter out vertices by traversal? Appreciate any help

Amiya

unread,
Dec 15, 2020, 1:45:50 PM12/15/20
to JanusGraph users

Try  g.V(41099392).outE('LINK').where(inV().hasId(110792))

Anton Eroshenko

unread,
Dec 16, 2020, 4:03:33 AM12/16/20
to JanusGraph users
Thanks for reply.
In real query I don't have an ID, that's why I use traversal in where clause. Tried this one, but it does not work either:
g.V(41099392).outE('LINK').where(inV().hasId(V(110792).id()))

HadoopMarc

unread,
Dec 16, 2020, 7:31:00 AM12/16/20
to JanusGraph users
Hi Anton,

To compare objects you need the eq() predicate, not the is() step (see https://tinkerpop.apache.org/docs/current/reference/#a-note-on-predicates). Also note that JanusGraph uses RelationIdentifier objects as id's.
So, give the following a try (not tested):
g.V(110792).as('a').V(41099392).outE('LINK').where(inV().eq('a'))

Best wishes,    Marc

Op woensdag 16 december 2020 om 10:03:33 UTC+1 schreef Anton Eroshenko:
Reply all
Reply to author
Forward
0 new messages