-
Notifications
You must be signed in to change notification settings - Fork 22
Transitive Function (OLAP)
[Table of Contents](https://github.com/dell-oss/Doradus/wiki/OLAP Databases: Table-of-Contents) | Previous | Next
Doradus Query Language: Transitive Function
The transitive function causes a _reflexive_ link to be traversed recursively, creating a set of objects for evaluation. Consider this clause:
DirectReports.Name = Fred
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 = Fred
This 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. - A null is detected: The recursion stops at the "edges" of the graph, in this case someone with no direct reports.
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:
DirectReports^(5).LastName = Smith
This clause selects people with any direct report up to 5 levels deep whose last name is Smith.
The transitive function can be combined with quantifiers as shown below:
ALL(InternalRecipient.Person).Manager^.Name : Fred
This clause selects messages whose every internal recipient has a superior (manager, manager's manager, etc.) named Fred
.
The transitive function can also be used with WHERE filter clauses, as long as the filter appears after the transitive operator. For example:
Manager^.WHERE(LastName=Smith).FirstName : Do*
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.
Technical Documentation
[Doradus OLAP Databases](https://github.com/dell-oss/Doradus/wiki/Doradus OLAP Databases)
- Architecture
- OLAP Database Overview
- OLAP Data Model
- Doradus Query Language (DQL)
- OLAP Object Queries
- OLAP Aggregate Queries
- OLAP REST Commands
- Architecture
- Spider Database Overview
- Spider Data Model
- Doradus Query Language (DQL)
- Spider Object Queries
- Spider Aggregate Queries
- Spider REST Commands
- [Installing and Running Doradus](https://github.com/dell-oss/Doradus/wiki/Installing and Running Doradus)
- [Deployment Guidelines](https://github.com/dell-oss/Doradus/wiki/Deployment Guidelines)
- [Doradus Configuration and Operation](https://github.com/dell-oss/Doradus/wiki/Doradus Configuration and Operation)
- [Cassandra Configuration and Operation](https://github.com/dell-oss/Doradus/wiki/Cassandra Configuration and Operation)