## 3 The Semantic Social Network of Things Middleware (S2 NeTM)
### S2 NeTM Ontology  
The S2 NeTM ontology is a lightweight and interoperable ontology that represents the relationships between heterogeneous entities in IoT environments. The scope of the ontology includes IoT devices, open data entities, and crowdsensing entities, along with their social relationships. The ontology is designed to facilitate the creation of more personalized and context-aware IoT applications by leveraging the social relationships between users and devices. The S2 NeTM ontology is composed of several main classes, including _Entity_, _User_, _Service_, _Service Property_, _Location_ and _Platform_. The _Entity_ class represents the different types of entities in the IoT environment, such as devices and open data entities. The _User_ class represents the human users of the system, while the _Service_ class represents the various services offered by the system. The _Service Property_ class represents the properties of the services, such as their quality and reliability. Finally, the _Platform_ class represents the hardware and software infrastructure of the system. To represent the relationships between entities, the ontology uses the _husRelationshipWith_ object property. This property has several sub-properties, including _co-work_, _co-location_, and _co-semantics_. The _co-work_ sub-property represents entities that work together towards a common goal, while the _co-location_ sub-property represents entities that are physically located in the same place. The _co-semantics_ sub-property represents entities that share a similar meaning or context. To ensure interoperability with other ontologies, the S2 NeTM ontology reuses several widely adopted ontologies, such as friend of a friend (FOAF), semantic sensor network (SSN), and IoT-lite. FOAF is used to represent the social relationships between users, while SSN is used to represent sensors and their observations. IoT-lite is used to represent the properties of IoT devices and the relationships between devices. Figure 3 provides a visual representation of the structure of the S2 NeTM ontology. This diagram shows the different classes and object properties of the ontology, as well as how they relate to each other. By using the S2 NeTM ontology, developers can create more personalized and context-aware IoT applications that leverage the social relationships between users and devices. As shown in Figure 4, the S2 NeTM ontology defines an object property called _need_ to represent the relationship between a _User_ and a _Service_ within the smart environment. This property is crucial in capturing the dependencies between users and services, allowing for better management and optimization of the smart environment. The ontology also introduces new classes and properties to represent sensors that are associated with entities in the smart environment. The _Sensor_ class from the SSN ontology is reused to represent sensors in S2 NeTM, providing a standardized way of representing sensor data and enabling interoperability between different sensor networks. The _need_ property is used to represent the requirement of a user for a particular service. For example, a user might require a temperature control service to operate efficiently in a smart home. By representing this requirement as a relationship within S2 NeTM, it becomes possible to identify which services are essential for each user, and to manage them more effectively. This can lead to improved energy efficiency, cost savings, and a more personalized user experience. Entities within the S2 NeTM can establish social relationships with one another, which are represented using the _hasRelationshipWith_ object property. In addition to the _User_ relationships provided by the FOAF ontology, S2 NeTM also defines its own types of social relationships. These types of social relationships include _co-work_, _co-location_, and _co-semantics_, which are also considered sub-properties of _hasRelationshipWith_.