问题
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?
回答1:
What you wanna do here is:
g.V().has('anyProperty', within('possibleValue1', 'possibleValue2'))
回答2:
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
回答3:
g.V('table_name','User').has('email',IN,[xxx,yyy....]).transform({['email':it.getProperty('email')]}) //assuming u have a table name attribute
来源:https://stackoverflow.com/questions/16273667/gremlin-query-like-sql-in-operator