## 3 The Semantic Social Network of Things Middleware (S2 NeTM)
### Trustworthiness Management (TM)  
TM is a central component of the S2 NeTM, which ensures the reliability and security of the system. This component is responsible for managing the trust relationships between devices and users. It assesses the trustworthiness of the devices and users based on their behavior, past interactions, and reputation. This information is used to make informed decisions about the reliability of the devices and users and to take appropriate actions in case of any anomalies or security threats. The trustworthiness management component uses a combination of trust models and trust evaluation techniques to assess the trustworthiness of devices and users. It appliestrust metrics such as reputation, credibility, and reliability to evaluate the behavior of devices and users. It also uses algorithms to detect and mitigate security threats, such as malicious attacks or data breaches. The TM component ensures that only trusted devices and users are allowed to access an SIoT system and its services. It also monitors the behavior of devices and users to detect any suspicious activity, and takes appropriate measures to prevent security breaches. Moreover, the TM component provides mechanisms for users to report any issues or incidents related to an SIoT system. It ensures that the reported incidents are appropriately addressed and resolved in a timely and efficient manner, thus increasing the overall trust and reliability of the system. **Friendship Selection (FS)**  
The FS component is responsible for selecting and recommending potential friends for the devices or users based on their services, interests, location, and other social attributes. This component uses the data collected from the devices and the users to identify potential friends and their interests. Once potential friends are identified, the component uses the relationship management component to manage the social relationships between users and devices. **Relationship Management (RM)**  
The RM component is responsible for managing the social relationships between users and devices. This component uses social network analysis techniques to analyze the data collected from the devices and the users, and identifies the relationships between them. These relationships can take various forms, such as _co-location_, _co-work_, _co-semantics_, _Users_ and _FOAF_. By leveraging these relationships, the RM component can provide personalized services to the users and devices, resulting in more intelligent and efficient interactions. The FS and RM components play a crucial role in creating and managing these relationships, thereby enhancing the overall functionality of an SIoT system. **Semantic Engines (SEs)**  
SEs represent another vital component of the S2 NeTM architecture, responsible for interpreting and processing the semantic data generated by the IoT devices and users. In particular, SEs provide support for reasoning and inference mechanisms, which are essential for making intelligent decisions and deriving new knowledge from the existing data. One of the key aspects of the S2 NeTM is the development of a new interoperable ontology, which is used to represent the semantic data generated by IoT devices and users. The S2 NeTM ontology is based on OWL2 and extends existing ontologies, such as SSN, IoT-Lite, and M3-Lite. The ontology includes new concepts and relationships that are specific to the social aspect of an SIoT system. Another important aspect of SEs is the semantic annotation module. This module is responsible for enriching the data generated by the IoT devices with semantic metadata, making it easier for other devices and systems to understand and process. The module uses algorithmic techniques to extract semantic information from unstructured data. The extracted metadata are then mapped to the ontology and stored in the Neo4j knowledge graph (i.e., a type of knowledge base that represents knowledge in the form of interconnected entities and relationships), allowing for easy access and retrieval of relevant information.