The transitive function causes a reflexive link to be traversed recursively, creating a set of objects for evaluation. Consider this clause:This clause selects people that have at least one DirectReports value whose Name is Fred. Each clause considers the immediate DirectReports of each object.We can change the search to transitively follow DirectReports links by adding the transitive operator ‘^’ after the reflexive link’s name:DirectReports^.Name = FredThis selects people with a direct report named Fred or a direct report that has a second-level direct report named Fred, recursively down the org chart. The transitive operator ‘^’ expands the set of objects evaluated in the place where the reflexive link (DirectReports) occurs recursively. The recursion stops when either:
• A cycle is detected: If an object is found that was already visited in evaluating the DirectReports^ expression, that object is not evaluated again.In some cases, we know that a reflexive graph is not very deep for any given object, so we can let the recursion continue until the leaf nodes are reached. But in some cases, the graph may be arbitrarily large and we need to restrict the number of levels searched. In this case, a limit can be passed to the transitive operator in parentheses:This query searches “up” the org chart for all Manager objects. Only managers whose LastName is Smith and whose FirstName begins with the letters do are selected.