1. A method comprising: receiving a first query in an online analytic processor (OLAP) executing on one or more computers; generating a model, the model specifying a graph defining a plurality of nodes and a plurality of tiers, each node corresponding to a different operation on data; generating a second query based on the model, the second query including a plurality of layered subqueries each corresponding to one of the nodes in the graph for specifying the different operations on the data: and receiving the second query in a relational engine coupled to a datastore, wherein the relational engine executes the second query, and in accordance therewith, retrieves data.