10

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

cybersam
  • 57,325
  • 5
  • 43
  • 66
Remis Haroon - رامز
  • 2,536
  • 1
  • 28
  • 53

1 Answers1

20

You could do:

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

See the or step in GremlinDocs.

thomaux
  • 17,387
  • 9
  • 71
  • 94
stephen mallette
  • 39,757
  • 4
  • 49
  • 112