# Towards Interactive Analytics over RDF Graphs
## 3 Background
### HIFIN- A High Level Functional Query Language for Big Data Analytics  
HIFUN [14] is a high-level functional query language for defining analytic queries over big data sets, independently of how these queries are evaluated. It can be applied over a data set that is structured or unstructured, homogeneous or heterogeneous, centrally stored or distributed. Data set AssumptionsTo apply that language over a data set \(D\), two assumptions should hold. The data set should (i) consist of uniquely identified data items, and (ii) have a set of attributes each of which is viewed as a function associating each data item of \(D\) with a value, in some set of values. For example, if the data set \(D\) is a set of all delivery invoices over a year in a distribution center (e.g., Walmart) which delivers products of various types in several branches, then the attribute \"product type\" (denoted as \(pt\)) is seen as a function \(pt:D\to String\) such that, for each invoice \(i\), \(pt(i)\), the type of product is delivered according to the invoice \(i\). **Definition 1** (Analysis Context). : _Let \(D\) be a data set and \(A\) be the set of all attributes (\(a_{1},...,a_{k}\)) of \(D\). An analysis context over \(D\) is any set of attributes from \(A\), and \(D\) is considered the origin (or root) of that context._  
Roughly speaking, an analysis context is an acyclic directed labeled graph whose nodes and arrows satisfy the following conditions:  
1. one or more roots (i.e., nodes with no entering arrows representing the objects of an application) may exist
2. at least one path from a root to every other node (i.e., attributes of the objects) exists
3. all arrow labels are distinct
4. each node is associated with a non-empty set of values  
The number of roots of an analysis context indicates the number of data sets it is related to. While one root means that data analysis concerns a single data set, the existence of two or more roots means that data analysis relates to two or more different data sets, possibly sharing one or more attributes. Figure 3 shows our running example, expressed as a context. From a syntactic point of view, the edges of it can be seen as triples of the form (source, label, target). Figure 2: Running example. Direct and Derived Attributes. The attributes of a context are divided into two groups, the _direct_ and the _derived_. The first group contains the attributes with origin \(D\): these are the attributes whose values are given. The second group contains the attributes whose origins are different than \(D\) and whose values are computed based on the values of the direct attributes. For example, in Figure 3 the attributes \(d\), \(b\), \(p\) and \(q\) are direct as their values appear on the delivery invoice \(D\), whereas \(m\) and \(y\) are derived, since their values can be computed from those of the attribute \(d\) (e.g., from the date 26/06/2019 one can derive the month 06 and the year 2019). **Definition 2** (HIFUN Analytic Query). : _A query in HIFUN is defined as an ordered triple \(Q=(g,m,op)\) such that \(g\) and \(m\) are attributes of the data set \(D\) with a common source and \(op\) is an aggregate operation (or reduction operation) applicable on \(m\)-values. The first component of the triple is called grouping function, the second measuring function (or the measure) and the third aggregate operation (or reduction operation)._  
Roughly speaking, an analytical query \(Q\) is a path expression over an analysis context \(C\); a well formed expression whose operands are arrows from \(C\) and whose operators are those of the functional algebra. It is formulated using paths starting at the root and is evaluated in a three-step process, as follows: (i) items with the same \(g\)-value \(g_{i}\) are grouped, (ii) in each group of items created, the \(m\)-value of each item in the group is extracted from \(D\) and (iii) the \(m\)-values obtained in each group are aggregated to obtain a single value \(v_{i}\). Actually, the aggregate value \(v_{i}\) is the answer of \(Q\) on \(g_{i}\).