Data like this
a->b,c,d
b->c,d
d->a,b
Query like this
FOR n in Nodes
FOR v,e,p IN 1 ANY n GRAPH 'MyGraph'
// Only need a
// HOW TO WRITE: FILTER n have an edge to `b` and n have an edge to `d`
// This will select a,b,c
FILTER v._key in [ 'b', 'd' ]
RETURN p
I want to select a node with edge to b and d, not b or d, but how ?
EDIT
Data
insert {_key:'a'} in nodes
insert {_key:'b'} in nodes
insert {_key:'c'} in nodes
insert {_key:'d'} in nodes
insert {_from:'nodes/a',_to:'nodes/b'} into relate
insert {_from:'nodes/a',_to:'nodes/c'} into relate
insert {_from:'nodes/a',_to:'nodes/d'} into relate
insert {_from:'nodes/b',_to:'nodes/c'} into relate
insert {_from:'nodes/b',_to:'nodes/d'} into relate
insert {_from:'nodes/c',_to:'nodes/d'} into relate
A very dummy solution is
for n in nodes
for v,e,p in 1 OUTBOUND n graph 'MyGraph'
filter v._key == 'b'
for v2,e2,p2 in 1 INBOUND v graph 'MyGraph'
sort v2._key == 'd'
return v2
But this query only work for two conditions,if I need one more condition I have to write one more for
query.