Reputation: 778
Im stuck with gremlin. I have emails like array and I need to make query to find all user with those emails.
In SQL I have
SELECT email(s)
FROM user
WHERE email IN (xxx, yyy...)
How can I do this in Gremlin query language?
Upvotes: 3
Views: 2404
Reputation: 56
What you wanna do here is:
g.V().has('anyProperty', within('possibleValue1', 'possibleValue2'))
Upvotes: 4
Reputation: 57
g.V('table_name','User').has('email',IN,[xxx,yyy....]).transform({['email':it.getProperty('email')]}) //assuming u have a table name attribute
Upvotes: 0
Reputation: 46226
If it is acceptable for you to do a linear scan of all vertices, then you could do something like:
gremlin> g = TinkerGraphFactory.createTinkerGraph()
==>tinkergraph[vertices:6 edges:6]
gremlin> s = ['marko','josh'] as Set
==>marko
==>josh
gremlin> g.V.filter{s.contains(it.name)}.name
==>marko
==>josh
Upvotes: 0