Gremlin query like SQL IN operator?

Showing 1-3 of 3 messages
Gremlin query like SQL IN operator? Ivan Despic 4/29/13 2:01 AM

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?

Re: [Neo4j] Gremlin query like SQL IN operator? Marko Rodriguez 4/29/13 7:34 AM
Hi,

Assuming you have an index on 'email' property (else a linear can will be invoked) and you want the 'name' property of the vertex with that email:

(xxx,yyy,…).collect{
g.V('email',it).name.next()
}

I don't know what version of Gremlin you are using but that is the way for the most prevalent version.

You can also look into Blueprints 2.3.0 and Graph.query().

HTH,
Marko.


--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Re: [Neo4j] Gremlin query like SQL IN operator? Marko Rodriguez 4/29/13 7:36 AM
Apologies:

[xxx,yyy].collect{ … }

Not, ( ). In other terms, array syntax.

gremlin> ['a','b','c'].collect{ it + it }
==>aa
==>bb
==>cc

Marko.