J Ambient Intell Human Comput manuscript No. (will be inserted by the editor) CoAP-based Collaborative Sensor Networks in the Semantic Web of Things Michele Ruta · Floriano Scioscia · Agnese Pinto · Filippo Gramegna · Saverio Ieva · Giuseppe Loseto · Eugenio Di Sciascio Received: date / Accepted: date Abstract The Semantic Web of Things (SWoT) in- tegrates knowledge representation and reasoning tech- niques originally devised for the Semantic Web into In- ternet of Things architectures, in order to provide more advanced service/resource management and discovery. This paper proposes a novel SWoT framework, enabling collaborative discovery of sensors and actuators in per- vasive contexts. It is based on a backward-compatible extension of the Constrained Application Protocol (CoAP), supporting advanced semantic matchmaking via non-standard inference services. The proposed mo- bile agent is able to discover devices and share smart- phone embedded sensors in a peer-to-peer fashion. Ef- ficient data stream mining is also integrated to ana- lyze raw data gathered from the environment and de- tect high-level events, annotating them with machine- understandable metadata. Finally, a case study about cooperative environmental risk monitoring and preven- tion in Hybrid Sensor and Vehicular Networks is pre- sented. Experimental performance results on a real testbed assess the approach. Keywords Semantic Web of Things · CoAP · Collab- orative sensing · Resource discovery · Matchmaking · Data mining 1 Introduction The emerging Semantic Web of Things (SWoT) vision, introduced by Ruta et al (2012), couples the Semantic M. Ruta, F. Scioscia, A. Pinto, F. Gramegna, S. Ieva, G. Loseto, E. Di Sciascio Polytechnic University of Bari via E. Orabona 4, Bari (I-70125), Italy Tel.: +39-080-5963515 E-mail: michele.ruta@poliba.it Web and the Internet of Things (IoT). According to Linked Data (LD) best practices summarized by Heath and Bizer (2011), each available information resource in the Semantic Web is denoted by a dereferenceable URI (i.e., a Uniform Resource Identifier pointing to an accessible HTTP resource). The SWoT paradigm aims to enable new classes of smart applications and services by augmenting real-world objects, locations and events with semantically rich and machine-understandable in- formation. Knowledge fragments are conveyed through unobtrusive, inexpensive and often disposable micro- devices such as wireless sensors and Radio Frequency IDentification (RFID) tags. SWoT environments are intrinsically dynamic: the availability of hosts, data sources and services can vary frequently and unpre- dictably, due to device and people mobility, battery lim- itations and wireless networks unreliability. Resource discovery is therefore both more necessary and more challenging than in conventional Web scenarios. The Constrained Application Protocol (CoAP) Bor- mann et al (2012) is an application-layer protocol expressly defined for networks of objects with lim- ited computational, memory and bandwidth resources. Unfortunately, it currently allows only a basic data- oriented representation of resources. In addition, el- ementary retrieval procedures are allowed relying on string matching between requests and resource at- tributes. Just binary “in/out” outcomes are possible. Exact request/resource matches are uncommon in real- world scenarios with heterogeneous devices, sensors and actuators from several independent providers. The SWoT needs more effective resource discovery, support- ing also approximate matches and possibly providing a relevance metric of available resources. This could strongly promote interoperable collaboration in large IoT environments and scenarios as multi-party Wire-