Q:

Path traversal with multiple conditions filter on all vertices

I would like to perform a path traversal where I apply a multiple condition filter on all vertices.
Basically I would like that every vertices matches either a == true or b == true.
It is easy to do it for one of the two:
FOR v, e, p IN 0..5 OUTBOUND 'objects/key' GRAPH 'stix_graph'
    FILTER p.vertices[*].a ALL == true
    RETURN p

or even both condition reunited:
FOR v, e, p IN 0..5 OUTBOUND 'objects/key' GRAPH 'graph'
    FILTER p.vertices[*].a ALL == true AND p.vertices[*].b ALL == true
    RETURN p

But I don see how I could achieve either a or b for on every vertex...

A:

You can use inline projection or inline filter in order to achieve the result you want.
Here is a sample AQL using inline projection:
FOR v, e, p IN 0..5 OUTBOUND 'objects/key' GRAPH 'graph'
    FILTER p.vertices[* RETURN CURRENT.a OR CURRENT.b] ALL == true
    RETURN p

Here is a sample AQL using inline filter:
FOR v, e, p IN 0..5 OUTBOUND 'objects/key' GRAPH 'graph'
    FILTER COUNT(p.vertices[* FILTER CURRENT.a OR CURRENT.b]) == COUNT(p.vertices) 
    RETURN p

Important Note: This approach will only perform well if you traverse a relatively small graph. If you have really huge and deep graph the performance may suffer as both inline projection and inline filter are considered by ArangoDB query optimizer as a CalculationNode. I.e. ArangoDB will not stop the traversal on a first vertex where the condition returns false. It will have to continue the traversal because the filter condition has a calculated value and  it can not know in advance if the result of that calculation is true of false for the next vertices. So, it will do a bit of extra traversals/calculations under the hood, but it will still return the result you expect.
If you want to apply this filter for a really huge graph I believe the correct approach would be to add a bit of redundancy to your data and put that a == true or b == true value into a separate attribute which you can efficiently use in your filter condition.

