Check if vertex in multiple paths


#1

Hi,

I need to run a query where I retrieve only the vertices that exist in multiple subtrees in a polytree, but I can’t quite work out the syntax to perform it.

e.g. I have objects with out edges to folders in a hierarchy, and another edge to an employee vertex. I want to be able to retrieve all objects from a folder and its subfolders, but only if they also belong to a particular team, with multiple employees in the team.

So I need to be able to traverse both the folder hierarchy, and the team tree, and find the objects that are common to both.

Any help would be appreciated.

Thanks,
Barry


#2

Sorry, solved it myself right after posting this :slight_smile:

SELECT expand($c)
LET $a = (TRAVERSE in() FROM (SELECT FROM Team WHERE name = 'team-a')),
$b = (TRAVERSE in() FROM (SELECT FROM Folder WHERE name = 'hr')),
$c = intersect($a, $b)

#3

bmclarnon,

Good to hear. Please feel free to share more details if you need any additional support.