0

I have a graph with multiple ways of reaching an end-vertice from the start-vertice and what I'm trying to achive is to only return those vertices visited by traversing ALL outbound edges of a user's role.

Details:

The user has N roles where each role is connected to different hierarchical subjects.

Articles are published to the same hiearchical subjects.

Search: A user has access to an article if the user has a role where ALL the user's subjects are in the articles published subjects. Where a subject is a tree structure meaning that articles published higher up in a hierarchy matches users connected lower in the subject hierarchy.

FOR role IN OUTBOUND "users/bob" has

   //Here I want to define 
   //$count = how many outbound edges 'definedAs' from 'role'

   FOR type IN OUTBOUND role definedAs
        FOR supertype IN 0..100 INBOUND type validFor //Subject hiearchy
            FOR article IN INBOUND supertype published

               //Only include 'article' that have been visited >= $count 

               return article

Is this possible in ArangoDB?

Niclas
  • 1,306
  • 5
  • 15
  • 28

1 Answers1

0

Answering my own question:

The solution is to visit each hieararchy separatly and the do an INTERSECTION between the two results.

Niclas
  • 1,306
  • 5
  • 15
  • 28
  • Other relevant posts: http://stackoverflow.com/questions/35661231/intersection-of-n-arrays-in-arangodb-aql and http://stackoverflow.com/a/39981990/2044940 – CodeManX Oct 17 '16 at 09:22