diff --git a/macros.tex b/macros.tex index d50997a..13763b8 100644 --- a/macros.tex +++ b/macros.tex @@ -3,6 +3,17 @@ % NOTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%RA-to-Poly Notation +\newcommand{\rel}{R} +\newcommand{\reli}{S} +\newcommand{\relii}{T} +\newcommand{\query}{Q} +\newcommand{\join}{\Join} +\newcommand{\select}{\sigma} +\newcommand{\project}{\pi} +\newcommand{\union}{\cup} + %Polynomial Reformulation \newcommand{\wbit}{w} \newcommand{\expct}{\mathop{\mathbb{E}}} @@ -324,8 +335,8 @@ \newcommand{\schemaOf}{\textsc{Sch}} \newcommand{\arity}[1]{arity({#1})} \newcommand{\db}{D} -\newcommand{\rel}{R} -\newcommand{\query}{Q} +%\newcommand{\rel}{R} +%\newcommand{\query}{Q} \newcommand{\qClass}{\mathcal{C}} % \newcommand{\uDom}{\mathcal{U}} \newcommand{\tup}{t} @@ -339,10 +350,7 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Algebra %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\newcommand{\selection}{\sigma} -\newcommand{\projection}{\pi} -\newcommand{\join}{\Join} -\newcommand{\union}{\cup} + \newcommand{\intersection}{\cap} \newcommand{\rename}{\rho} \newcommand{\aggregation}[2]{{}_{#1}\gamma_{#2}} diff --git a/ra-to-poly.tex b/ra-to-poly.tex index 2ffabfe..d0e9a40 100644 --- a/ra-to-poly.tex +++ b/ra-to-poly.tex @@ -1,6 +1,29 @@ %root: main.tex \section{Query translation into polynomials} -This section will involve the set of queries (RA+) that we are interested in, the probabilistic/incomplete models we address, and the outer aggregate functions we perform over the output \textit{annotation}. +\AH{This section will involve the set of queries (RA+) that we are interested in, the probabilistic/incomplete models we address, and the outer aggregate functions we perform over the output \textit{annotation} +1) RA notation +2) DB (TIDB) notation +3) How queries translate into polynomials +} + +Given tables $\rel, \reli$, an arbitrary query $\query(\rel)$ over the positive relational operators (SPJU), abusing notation slightly denote the query polynomial as $\poly(X_1,\ldots, X_\numTup)$. The annotation for arbitrary tuple $\tup$ can be viewed as an element of the image of $\rel$, where relation $\rel$ can be thought of as a function with preimage of all tuples in $\rel$, such that $\rel(\tup) = \poly(X_1,\ldots, X_\numTup)$. Further, it is known that the algebraic semiring structure aptly models the translation and computation of query operations into tuple annotation, aka polynomials. +To make things more concrete, consider the $\{\mathbb{N}, \times, +, 1, 0\}$ bag semiring. Here the set in which the tuple annotations (computed polynomials) exist is the natural numbers. Query operations are translated into one of the two semiring operators, with $\project$ and $\union$ of agreeing tuples being the equivalent of the '+' opertator in polynomial $\poly$, $\join$ translating into the $\times$ operator, and finally, $\select$ is better modeled as a function that returns either $\rel(\tup)$ or $0$ based on some predicate. + +Consider the translation of relational operators to polynomial operators in greater detail. + +\begin{align*} +&\project_A(\rel)(\tup) = &&\sum_{\tup' s.t. \tup[A] = \tup'} \rel(\tup')\\ +& (\rel_1 \union \rel_2)(\tup) = &&\rel_1(\tup) + \rel_2(\tup)\\ +&(\rel_1 \join_\theta \rel_2)(\tup) = &&\begin{cases} + \rel_1(\tup_1) \times \rel_2(\tup_2) &\text{if }\theta(\tup_1, \tup_2)\\ + 0 &\text{otherwise} + \end{cases} \\ +&\select_\theta(\rel) = &&\begin{cases} + \rel(\tup) &\text{if }\theta(\tup) = 1\\ + 0 &\text{otherwise}. + \end{cases} +\end{align*} + \AR{This section needs to be written up {\bf before} you go forwad in the next section. In particular, this section should setup definitions/notation (e.g. how you to denote a general query on TIDB) that will be used later on so better get thet setup first.}