# Towards Interactive Analytics over RDF Graphs
## 7 On Interactivity  
As described in the introductory section, and illustrated in Figure 1, our ultimate objective is to provide a user friendly method for interactive analytics over any RDF graph. This requires:  
\(\mathcal{S}\)1\({}_{ctx}\)An interactive method for specifying an Analysis Context. Recall that (according to Definition 3), an analysis context C over RDF data is defined as a set of resources \(R\) to be analyzed along with a set of properties \(p_{1},p_{2},...,p_{n}\) that are relevant for the analysis. An interactive method for formulating the desired HIFUN query \(q=(g,m,op)\), i.e., a method to select \(g\), \(m\), and \(op\). A method to translate the HIFUN query to SPARQL. A method for visualizing the results of the SPARQL query that is derived by translating \(q\). As regards \(\mathcal{S}_{\big{\{}\!\!\big{\}}ctx}\), the analysis context can be specified over the original data (Section 5.3), or after a transformation (Section 5.4). In the former case, the user does not have to do anything: all resources of the RDF dataset and all properties can be exploited as an analysis context. In the latter case the intended transformation can be made by tools like LODSundesiML [40] that allows the user to interactively select the desired features. The output of this step can be either (a) a csv file or an RDF file in RDF Data Cube format that contains the materialization of the defined features, or (b) a set of feature specifications each being a pair (feature name, SPARQL query) which will be exploited in the translation process as discussed in the last part of Section 5.4 and in Section 6.6. As regards \(\mathcal{S}_{\big{\{}\!\!\big{\}}q}\), and assuming that an analysis context has been specified, we developed a tool, called HIFUN\({}_{RDF}\), where the user is asked to select the functions of a HIFUN query i.e., (i) the grouping function, (ii) the measuring function, (iii) the aggregate operation, and optionally, (iv) set restrictions to the grouping, the measuring functions or to the final results. The above are accomplished by interactively selecting the desired properties, i.e., the user does not have to know the SPARQL syntax. Currently, this tool loads data represented in the RDF Data Cube format and stores them in a triplestore, however this period we are extending this tool for supporting any RDF file (not only files in RDF Data Cube format). As regards \(\mathcal{S}_{\big{\{}\!\!\big{\}}tr}\), we implemented the translation method described in Section 6. Please note that the cost of the translation of a HIFUN query to SPARQL is negligible (the translation has linear complexity with respect to the size of the HIFUN string; it does not depend on the size of the data). The translated to SPARQL query is then executed on the triple store OpenLink Virtuoso ([[https://virtuoso.openlinksw.com/](https://virtuoso.openlinksw.com/)]([https://virtuoso.openlinksw.com/](https://virtuoso.openlinksw.com/))) (where the input data has been uploaded) and the returned results are displayed and saved in a \".csv\" file in the form of - \(var_{1},var_{2},...,var_{i}\), TOTALS. As regards \(\mathcal{S}_{\big{\{}\!\!\big{\}}pis}\), we embedded in HIFUN\({}_{RDF}\) the jfreechart library ([[https://www.jfree.org/jfreechart](https://www.jfree.org/jfreechart)]([https://www.jfree.org/jfreechart](https://www.jfree.org/jfreechart))) for reading the results of the SPARQL query and preparing various charts including line, bar, pie and 3D pie charts. Three screenshots are shown in Figure 4 that visualize the results of the query \"total quantities by branch\" over a synthetic RDF dataset that uses the same schema with our running example. The indicative flows that are possible with this implementation, are illustrated in Figure 5. The figure includes a workflow where the process starts with selecting the data set the user wants to analyze using tools like Facetize [43] and LODSundesiML [40], suitable for discovering, cleaning, organizing data in hierarchies. etc.