Gremlin : Multiple filter condition "OR"
Asked Answered
Q

1

12

I want to query my TITAN 0.4 graph, based on two filter conditions with "OR" logical operator (return vertices if either of conditions is true).

I searched this on http://sql2gremlin.com/, but only "AND" operator is given,

My requirement is something as given below:

SELECT *
  FROM Products
 WHERE Discontinued = 1
   OR UnitsInStock = 0

g.V('type','product').has('discontinued', true) "OR"
                     .has('unitsInStock', 0)

Please help

Quenchless answered 5/5, 2015 at 3:26 Comment(0)
R
25

You could do:

g.V('type','product').or(_().has('discontinued', true), _().has('unitsInStock', 0))

See the or step in GremlinDocs.

Reside answered 5/5, 2015 at 10:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.