I have two properties on my Edges that I want to filter on: a
and b
. I want to filter these properties using the following list:
lst = [['0102', '2017-01-01'], ['4920', '2018-07-01'], ..., ['2198', '2018-04-01']]
... and using the following logic:
('a1' AND 'b1') OR ('a2' AND 'b2') OR ... OR ('an' AND 'bn')
For filtering the Edges on a single one of the value pairs in lst
I could:
g.E().and(has('a', '0102'), has('b', '2017-01-01'))
For filtering on all of them, I could:
s.E().or(and(has('a', '0102'), has('b', '2017-01-01')),
and(has('a', '4920'), has('b', '2018-07-01')),
...
and(has('a', '2198'), has('b', '2018-04-01')))
The approach works, but requires manually inputing the filter parameters. It will therefore break as soon as the contents of variable lst
changes.
Is there a way to, given the format of variable lst
, computationally solve this problem by passing lst
into the query?