## 4 Implementation and Application Scenarios  
To study the functionality of the system framework described in the previous section, a model was developed by employing the Python programming language for prototyping [112] and Microsoft Azure platform [113] for cloud computing infrastructure and services. An overview of the software features employed to develop the system's modules is presented in Table 4.  
For accuracy purposes agricultural raw data were collected in actual conditions of use in the \"Kopaida\" farm which is located 120 km north of Athens and managed by the Agricultural University of Athens. The farm covers an area of 1020 hectares divided into 11 sections of arable land, rich in organic matter and calcium, where various crops (cereal, maize, cotton, alfalfa, etc.) are cultivated. Moreover, it is equipped with agricultural machinery, an underground irrigation system, and a modern weather station. The acquisition of raw data was performed during June 2019, by deploying in a maize parcel environmental and soil wireless sensors as depicted in Figure 14. It is worth mentioning \begin{table}
\begin{tabular}{c c c} \hline \hline
**Service Types** & **Rules** & **Actions** \\ \hline Automated & (?air temperature: high) \(\wedge\) (?irrigation valve: off) & Activate irrigation valve\(\rightarrow\) \\  & & Report via pop-up mobile app \\ \hline Symptom Detection & (?humidity: high) \(\wedge\) (leaf physiology: abnormal) & Imminent Disease detected\(\rightarrow\) \\  & & Alert Farmer \\ \hline Emergency & (?smoke detector: on) \(\wedge\) (?smoke level: irregular) & Possible Fire detected\(\rightarrow\) \\  & & Emergency Alert \\ \hline Consultancy & (?smart phone: on) \(\wedge\) (?messenger chatbot: installed) & Real-time agronomist support \\ \hline Software & (?local time: 17.00) \(\wedge\) (?report time: true) & Cultivation status report \\  & & via pop-up mobile app \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Example of service type rules and corresponding actions. that the wireless sensors use the \"SensoTube\" open architecture which has been introduced as part of previous work by [PERSON] and [PERSON] [38]. This architecture can contribute significantly towards the hardware abstraction requirements for the development of a sound middleware by providing an optimized, reliable, flexible, and scalable framework for agricultural WSANs. The hardware of a \"SensoTube\" wireless sensor is illustrated in Figure 15.  
Among the data provided, the implementation process involves 300 sample sets containing parameters in form of numerical values about air temperature and humidity as well soil moisture and pH, considering a sampling rate of 15 min. A piece of random sample sets of raw data in numerical values is presented in Table 5.  
According to the proposed system's workflow, the provided agricultural raw data are classified to high-level contextual data (e.g., temperature is high, pH range is normal, etc.) by four corresponding rule-based classifiers developed as context providers in Python. Subsequently, the data are aggregated by the Python-developed context aggregator and finally the context model is derived by implementing the suggested modeling structure in terms of entities. A screenshot of Python source code for classifying pH range values to high-level contextual data is introduced in Figure 16.  
The results of classifying the random sample sets of agricultural raw data, acquired in a maize field (as in Table 5), to contextual data are presented in Table 6. All sample sets are processed individually inside the context management module of the context-aware middleware cloud. Furthermore, ten service providers (SP) were created, among which diverse fuzzy logic-based rules were distributed, involving all the potential actions for context correlation. These rules are stored in the form of XML code as demonstrated in Figure 17. The most suitable services, among the ones provided by various SP, are selected by the context management module after completing the service mapping operation.