Discussion:
[arangodb-google] How to query for a specific combination of nodes in Arango DB graph
Malsha Ranawaka
2018-07-11 10:37:37 UTC
Permalink
Hi All,

I posted this question on stackoverflow
<https://stackoverflow.com/questions/49898180/how-to-query-for-a-specific-combination-of-nodes-in-arango-db-graph>as
well but could not resolve it, so am posting it here again.

I have a graph containing two vertex collections: Attraction (green) and
Hotel (orange).

I want to query for a certain combination of Attractions and Hotels, such
as the one given below:


Attraction (start vertex) ---> Attraction ---> Hotel
|
|
v
Attraction


Graph has directed edges as shown.

The query I have now (below) gives any part of the above combination,
instead of four nodes connected exactly as above.


FOR document IN Attraction FOR vertex, edge, path IN 1..2 OUTBOUND document GRAPH "LondonAttractionDB"
FILTER path.vertices[0].entityTypes[0] == "Attraction"
FILTER path.vertices[1].entityTypes[0] == "Attraction"
FILTER path.vertices[2].entityTypes[0] == "Hotel" OR path.vertices[2].entityTypes[0] == "Attraction"
RETURN path


Please see the attached image for the result generated by the above query.


Above query gives all *combinations containing two, three or four nodes* as
shown in attached image. How can I get only the results (*combinations of
exactly four nodes*) shown within circles?


Any help is much appreciated.


Thanks.
--
You received this message because you are subscribed to the Google Groups "ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to arangodb+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...