# Towards Interactive Analytics over RDF Graphs
## 5 Applicability of HIFUN over RDF
### II: Defining an Analysis Context after Transforming the Original RDF Data  
A few feature operators that could be used for transforming the original (RDF) data to be in compliance with the assumptions of HIFUN are indicated in Table 1. That table lists the nine most frequent Linked Data-based Feature Creation Operators (for short _FCOs_), as defined in [40], and they have been re-grouped according to our requirements. \(\mathcal{T}\) denotes a set of triples, \(P\) a set of properties and \(p,p_{1}\), \(p_{2}\) properties. In detail,  
* \(fco_{1}\) suits to the normal case and it can be exploited to confirm that all the properties are functional e.g., the date that each product was delivered, the branch where each invoice took place. The value can be numerical or categorical. * \(fco_{2}\) and \(fco_{3}\) relate to issues that concern missing and multi-valued properties and can be used for turning properties with empty values into integers. * \(fco_{4}\) can be used for converting a multi-valued property to a set of single-valued features, e.g., one boolean feature for each nationality that a founder may have. * \(fco_{5}\) and \(fco_{6}\) concern the degree of an entity and can be used to find the set of triples that contains a specific entity, defining its importance. * \(fco_{7}\) to \(fco_{9}\) investigate paths in an RDF graph, e.g., whether at least one founder of a brand is \"French\". It can be used for specifying a path (i.e., a sequence of properties \(p_{1},p_{2},...,p_{n}\) etc.) and treat it as an individual property \(p\). These features can be used for deriving a new RDF dataset that will be analyzed with HIFUN. This transformation can be done by using SPARQL CONSTRUCT queries: Suppose that the pair \((R,F)\) expresses a context, where \(R\) is a set of resources and \(F\) the set of the features, the objects in \(R\) have. Then, the resources \(R\), as well as the features \(F\), can be defined by the triple patterns i.e., \"\(\mathcal{S}\)? ?o\" in the \(CONSTRUCT\) clause of a SPARQL query, i.e., the bindings of \"\(\mathcal{S}\)\" (or \"\(\mathcal{O}\)\") can correspond to the resources, whereas the bindings of \"\(p\)\" to the set of features. Alternatively, these features can be defined by queries, but instead of constructing the triples, the definition of the features can be included in the analytic queries in the form of nested queries (subqueries); in general any query \begin{table}
\begin{tabular}{c c c c} \hline \hline
**id** & **Operator Defining \(f_{i}\)** & **Type** & \(f_{i}(e)\) \\ \hline \multicolumn{3}{c}{**Plain selection of one property**} \\ \hline
1 & p.value & num/categ & \(f_{i}(e)=\{\;v\;|\;(e,p,v)\in\mathcal{T}\}\) \\ \hline \multicolumn{3}{c}{**For missing values and multi-valued properties**} \\ \hline
2 & p.exists & boolean & \(f_{i}(e)=1\) if \((e,p,o)\) or \((o,p,e)\in\mathcal{T}\), otherwise \(f_{i}(e)=0\) \\ \hline
3 & p.count & int & \(f_{i}(e)=|\{\;v\;|\;(e,p,v)\in\mathcal{T}\}|\) \\ \hline \multicolumn{3}{c}{**For multi-valued properties**} \\ \hline
4 & p.values.AsFeatures & boolean & for each \(v\in\{\;v\;|\;(e,p,v)\in\mathcal{T}\}\) we get the feature \(f_{iv}(e)=1\) if \((e,p,v)\) or \((v,p,e)\in\mathcal{T}\), otherwise \(f_{iv}(e)=0\) \\ \hline \multicolumn{3}{c}{**General ones**} \\ \hline
5 & degree & double & \(f_{i}(e)=|\{(s,p,o)\in\mathcal{T}\;|\;s=e\;\text{or}\;o=e\}|\) \\ \hline
6 & average degree & double & \(f_{i}(e)=\frac{|\{triples(C)\}|}{|C|}\) s.t. \(C=\{\;c\;|\;(e,p,c)\in\mathcal{T}\}\) and \(triples(C)=\{(s,p,o)\in\mathcal{T}\;|\;s\in C\;\text{or}\;o\in C\}\) \\ \hline \multicolumn{3}{c}{**Indicative extensions for paths**} \\ \hline
7 & p1.p2.exists & boolean & \(f_{i}(e)=1\) if \(\exists\;o2\) s.t. \(\{(e,p1,01),(01,p2,02)\}\subseteq\mathcal{T}\) \\ \hline
8 & p1.p2.count & int & \(f_{i}(e)=|\{\;o2\;|\;(e,p1,01),(01,p2,02)\in\mathcal{T}\}|\) \\ \hline
9 & p1.p2.value.maxFreq & num/categ & \(f_{i}(e)=\text{most frequent }o2\) in \(\{\;o2\;|\;(e,p1,01),(01,p2,02)\in\mathcal{T}\}\) \\ \hline \hline \end{tabular}
\end{table}