# Building Topic-Driven Virtual IoTs in a Multiple IoTs Scenario
## 5 Topic-Guided Virtual IoTs in a MIoT and Approaches to Constructing Them
### Supervised Approach  
The supervised approach for the construction of topic-guided virtual IoTs in a MIoT requires the user to specify a query \(Q\) consisting of some keywords of her interest. It tries to construct a thematic virtual IoT in such a way that each of its instances contains at least one keyword of \(Q\) in the content-based component of its profile. If such a virtual IoT does not exist, our approach returns a minimal set of thematic IoTs that, on the whole, contain, in the content-based component of the profile of their instances, all the keywords specified by the user. In this last case, she can choose whether to accept this set of IoTs or modify her query. Before describing in detail this approach, we must introduce a new operator \(J^{*}\) that represents a modified Jaccard coefficient, as we will see below. \(J^{*}\) receives two sets of topics (We recall that, in our context, a topic is a pair \((kw,nkw)\), where \(kw\) is a keyword and \(nkw\) is the corresponding number of occurrences.) \(topicSet=\{(kw_{1},nkw_{1}),(kw_{2},nkw_{2}),\cdots,(kw_{p},nkw_{p})\}\) and \(topicSet^{\prime}=\{(kw^{\prime}_{1},nkw^{\prime}_{1}),(kw^{\prime}_{2},nkw^{ \prime}_{2}),\cdots,(kw^{\prime}_{p},nkw^{\prime}_{p})\}\) and computes the Jaccard coefficient between them. In carrying out this task, it considers the number of occurrences of each keyword and its possible synonyms. More formally, first it computes the set:  
\[ \begin{array}{c}commonTS=\{(kw,nkw+nkw^{\prime})|(kw,nkw)\in topicSet,(kw^ {\prime},nkw^{\prime})\in topicSet^{\prime},\\ \hskip 142.26378 ptkw\text{ is identical to or synonymous of }kw^{\prime}\}\end{array}  \tag{25}\]  
Then, it computes the final result as:  
\[ \begin{array}{c}J^{*}(topicSet,topicSet^{\prime})=\frac{\sum_{(kw,nkw)\in commonTS}nkw}{\sum_{(kw,nkw)\in topicSet}nkw+\sum_{(kw^{\prime},nkw^{ \prime})\in topicSet^{\prime}}nkw^{\prime}}\end{array}  \tag{26}\]  
After having introduced \(J^{*}\), we can describe our approach. Specifically:  
* It starts when a user specifies a query \(Q\) consisting of \(r\) keywords: \[Q=\{kw_{1},kw_{2},\cdots,kw_{r}\}\] (27) It searches for all the instances of the MIoT having at least one topic whose keyword is identical to, or synonymous of, at least one keyword specified in \(Q\). These instances, as a whole, represent the set of candidate instances to be included in the new thematic view. We call this set \(\mathcal{CI}\) (Candidate Instances). * However, the fact that an instance \(\iota\in\mathcal{CI}\) has a keyword in common with \(Q\) is necessary but not sufficient for it to be chosen. In fact, it is advisable that \(\iota\) has more keywords in common with \(Q\) and, possibly, that the common keywords are among the ones of \(\iota\) with the highest number of occurrences. This condition can be guaranteed by the usage of the operator \(J^{*}\). In particular, our approach first constructs \(Q^{\prime}=\{(kw,1)|kw\in Q\}\) in such a way as to make the application of \(J^{*}\) on the keywords specified by the user possible. Then, it constructs the set \(\mathcal{RI}\) (Real Instances) of those instances of \(\mathcal{CI}\) whose topics have a significant similarity with the keywords of \(Q\): \[\mathcal{RI}=\{\iota\in\mathcal{CI}|J^{*}(topicSet_{\iota},Q^{\prime})>th_{I}\}\] (28) Here, \(th_{I}\) is a suitable tuning threshold. * Now, our approach can start to construct the thematic view \(\mathcal{V}_{Q}\) corresponding to \(Q\). It first creates a node \(n_{i}\) in \(\mathcal{V}_{Q}\) for each instance \(\iota\) of \(\mathcal{RI}\). Let \(n_{i_{1}}\) and \(n_{i_{2}}\) be the nodes corresponding to two instances \(\iota_{1}\) and \(\iota_{2}\) belonging to \(\mathcal{RI}\). * If an i-arc exists between the nodes corresponding to \(\iota_{1}\) and \(\iota_{2}\) in the MIoT \(\mathcal{M}\), then an i-arc is also created between the nodes \(n_{i_{1}}\) and \(n_{i_{2}}\) in \(\mathcal{V}_{Q}\).