## 2 Related Work
### Contribution of the Opportunistic Computing  
This subsection first explains what opportunistic computing is and to what extent it could benefit smart agriculture. Then, it thoroughly describes how a support for opportunistic computing was implemented in a Web of Things platform. .1.1 Definitions of Opportunistic Computing and Sensing, and Their Suitability for Smart Agriculture  
Opportunistic networking is a research field that can be considered as being a derivative of the Delay-Tolerant Networking (DTN) research domain. While DTN [27] characterizes networks with long-delay communications and/or with an unreliable connectivity, opportunistic networks denote mobile networks that exploit transient--and sometimes non-predictable--radio contacts between mobile devices to exchange data [28]. Opportunistic networking therefore mostly targets disconnected mobile ad hoc networks (D-MANETs), as illustrated on Figure 1. However, the differences between these two approaches, which both rely on the \"store-carry-and-forward\" principle, are marginal,and both terms are indistinctly used in this paper. Numerous opportunistic forwarding protocols have been proposed over the past years [22], investigating forwarding strategies based notably on epidemic approaches or on social criteria (computed from mobility patterns, history of contacts or location information). Opportunistic computing [29] is an extension of opportunistic networking, where resources offered by devices are, in general, abstracted and made available through services, thus allowing devices to access resources provided by the devices they have encountered directly or via intermediate devices. Opportunistic computing and networking do not make assumptions about the network topology and support frequent and unpredictable changes in this one, as well as its fragmentation. Such features make opportunistic computing and networking interesting for the development of systems dedicated to the smart agriculture. Unlike urban areas that may offer solid network infrastructure favorable to environmental sensing, farms are usually located in rural areas where the cellular network coverage is often lackluster and therefore does not provide a reliable network infrastructure. Furthermore, devices involved in smart agriculture (e.g., sensors, agribots, and drones) are by nature likely to fall in the D-MANET category, because devices may run out of battery or enter a sleep mode for energy-saving purposes, and because mobile devices enter and exit the communication radius of other nodes as they roam. Computing systems relying on opportunistic communications, however, make it possible to collect data generated by sparsely distributed sensors, even if these ones are not up at the same time and/or if it does not exist an end-to-end path between some sensors and the gathering point. For this purpose, mobile devices (e.g., tractors, agribots, drones, and smartphones carried by farmers) can in addition be used as \"data mules\" to collect data from sensors directly or to transfer data between the different parts of the network that are isolated from one another. Opportunistic computing furthermore allows farmers to deploy sensors or actuators in their fields and/or in their farms, even on their animals [30], without having to worry about the location, the radio range, the duty cycle and the sleep phases of these devices. For the sake of illustration, let us consider a crop irrigation management application that can process soil moisture data produced by sensors deployed in agricultural fields, and that can trigger the watering system if the soil is too dry and if no rainfall is expected soon. As shown in Figure 2, two farming vehicles A and B, which act as data mules in this smart agriculture scenario, can participate to the collect of data and to their transmission to the gateway, where they will be analyzed by a WoT application in order to decide if the watering system must be triggered or not. In Figure 2A, gateway \(G\) emits a service invocation message to query sensor \(S\).