has('x', eq('y')) that always returns false

21 views
Skip to first unread message

Guy Ellis

unread,
Dec 1, 2016, 8:59:46 AM12/1/16
to Gremlin-users
Is there a syntax for:

has('x', <predicate>('y'))

that always returns false.

I have a really weird use case where I want to use "has" but I always want it to return false against all the vertices at that point in the traversal.

e.g.

has('dummy', eq('dummy'))

works for me but is very hacky. I want something like:

has(true, eq(false))

which semantically conveys the nonsensical usage that it will always be false.

Marko Rodriguez

unread,
Dec 1, 2016, 9:03:46 AM12/1/16
to gremli...@googlegroups.com
Hi,

Can you replace your has(), with not(identity())?

Marko.
--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/04d8e023-141c-4079-9f4a-ea63e56033ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Guy Ellis

unread,
Dec 1, 2016, 9:54:45 AM12/1/16
to Gremlin-users
I think that might work - thanks Marko!

Guy Ellis

unread,
Dec 13, 2016, 4:21:57 PM12/13/16
to Gremlin-users
Marko - I couldn't get that syntax to work. How would I use that off "g.V()" for example to not return any results? Thanks.

Daniel Kuppitz

unread,
Dec 13, 2016, 4:51:08 PM12/13/16
to gremli...@googlegroups.com
g.V().not(identity())

But if you don't want to waste too much compute power:

g.V().limit(0)

Cheers,
Daniel


To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/b8c52588-45f4-4c4a-8a64-25ddb5713d4f%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages