# Wolfram Function Repository

Instant-use add-on functions for the Wolfram Language

Function Repository Resource:

Present a query as a tree

Contributed by:
Seth J. Chandler

ResourceFunction["QueryTreeForm"][ presents a Query | |

ResourceFunction["QueryTreeForm"][{ presents a list of operations for Query as a tree with depth-first descent. |

ResourceFunction["QueryTreeForm"] takes the same options as TreeForm.

Show the order of operations of a Query that is constructed of an ascending operator *f* and an ascending operator *g* as its arguments:

In[1]:= |

Out[48]= |

Show the order of operations of a Query that is constructed of: (1) a right composition of two descending operators and an ascending operator; (2) the All operator; and (3) the ascending operator *i*:

In[49]:= |

Out[97]= |

Visualize a Query composed of an ascending and a descending operator to aggregate values of a column after filtering the rows:

In[98]:= |

Out[173]= |

Visualize the order of operations of a Query that applies functions to each column independently:

In[174]:= |

Out[250]= |

Visualize a Query that constructs a new table by specifying operators that will compute each column:

In[251]:= |

Out[331]= |

QueryTreeForm is useful in thinking through the order of operations in complex queries:

In[470]:= |

Out[556]= |

QueryTreeForm can be combined with other visualization functions to present additional information:

In[557]:= |

Out[557]= |

Any ResourceFunction that does not format well within TreeForm does not format well in QueryTreeForm either:

In[558]:= |

Out[668]= |

Determine the order of operations in a Query designed to produce several statistics of a dataset involving age, gender and class, broken down by gender:

In[669]:= |

Out[784]= |

A function that, if applied to the *Titanic* dataset, will yield a breakdown of survival by gender and class in an attractive format:

In[785]:= |

In[786]:= |

Out[922]= |

- 1.0.0 – 15 July 2019

This work is licensed under a Creative Commons Attribution 4.0 International License