## 4 Social Awareness in the Semantic Web of Things
### Managing Dynamic Social Relationships  
The proposal aims to extend the framework described in [9] to endow social objects with proactive adaptivity to environmental modifications in order to improve self-organization through social relationship refinement. Based on past experience (i.e., previous interactions over the social network), each object is able to adapt its relationships dynamically according to context changes, in order to improve not only the processing on the single node but also the overall network performance. Removing unnecessary relationships aims to reduce network traffic, e.g., fewer messages will be forwarded during a service discovery process. Conversely, new meaningful interactions can increase the network effectiveness and reduce the relative computational load per node: a request could be satisfied with lower processing time and activating the minimum set of services. The following models are proposed to suggest and remove friendship relationships based on the experience of each social object. _Suggestion._ After every time period \(T\), each smart device queries its wall to retrieve the list of devices that sent a comment to or were tagged in a post. For each such device \(D\), the _suggest_ function \(S(D)\) is computed as follows:  
\[S(D)=[w\cdot C(D)+(1-w)\cdot U(D)]\cdot\frac{X-1}{X} \tag{1}\]  
with  
\[C(D)=\sum_{i}^{N_{c}(D)}X^{(t_{i}-T)} \tag{2}\]  
\[U(D)=\sum_{j}^{N_{w}(D)}X^{(t_{j}-T)} \tag{3}\]  
The following symbols are used in the above formulae:  
* \(N_{c}(D)\): number of comments created by \(D\);
* \(N_{u}(D)\): number of useful services provided by \(D\), i.e., \(D\)'s services tagged as result of Concept Covering;* \(w\) (between 0 and 1): used to weigh the contribution of \(U(D)\), considering a device as direct provider of useful services, and \(C(D)\), representing the ability of \(D\) to contribute to service discovery by acting as a \"bridge\" toward other useful devices;
* \(T\): timestamp at which all functions are evaluated;
* \(t_{i/j}\leq T\): timestamp at which a comment/post was created;
* \(X>1\): decay rate coefficient, weighing the past history of a device: the higher the value, the lower the relevance of older contributions. Division by \(\frac{X}{X-1}\) normalizes \(S(D)\) with reference to the theoretical convergence value of the geometric series with ratio \(\frac{1}{X}\), implying that \(0\leq S(D)\leq 1\). According to the proposed model, a device will be suggested as a good candidate friend if it provides services frequently and/or it is a friend of many useful devices. New friendship requests will be sent to devices with an \(S\) score higher than a reference threshold (_TH-suggest_). Considering the example in Figure 4(a), if device \(D_{1}\) frequently activates services of \(D_{5}\) through intermediate friends \(D_{2}\) and \(D_{4}\), it will learn and ask for \(D_{5}\)'s direct friendship as in Figure 4(b). _Retraction._ Along with the suggestion of new friends, a _retraction_ score \(R(D)\) is calculated for each friend device \(D\) to identify worthless relationships:  
\[R(D)=S(D)-P(D) \tag{4}\]  
with  
\[P(D)=[\sum_{k}^{N_{i}(D)}X^{(t_{k}-T)}\cdot P_{k}(D)]\cdot\frac{X-1}{X} \tag{5}\]  
where \(P(D)\) exploits past results of local Concept Covering processes. In detail:  
* \(N_{i}(D)\) is the number of \(D\)'s services, detected as incompatible with reference to the requests received in the period \(T\);
* \(t_{k}\leq T\) is the timestamp at which the covering process was performed and the incompatibility was identified;
* \(P_{k}(D)\in[0,1]\) is the penalty score measured by Concept Contraction. Figure 5: Sample network with loosely connected nodes. For each friend device, if \(R(D)\) (which is always in \([-1,1]\)) is less than a _TH-retract_ threshold, the friendship will be removed: the meaning is that \(D\) often provides conflicting services (wasting processing and communication resources) and/or it does not have a useful impact in satisfying received requests.