# Sustainable IoT Sensing Applications Development through GraphQL-Based Abstraction Layer
## 4 Proposed Approach  
Energy is the most scare resource in IoT devices as they are mainly powered by dry batteries and, according to a study [27], around 60% of the node energy is consumed by the communication sub-system. Due to a shared wireless channel, the chances of collision in data transmission and packet losses arise when data transmission rate or number of active data sending nodes are increasing. A suitable approach to address this challenge is to reduce the number of transmissions at individual node level, which is beneficial in two ways: (a) energy consumption is reduced by the fraction of transmissions reduced; and (b) reduced number of transmissions results in reduction of collision in data transmission, thus avoiding energy wastage in packets re-transmission. Our proposed scheme addresses the energy efficiency challenge. As discussed in the previous section, GraphQL framework has suitable features which can be used in sensing applications and it has no implementation dependency, which means it can be integrated with  
Figure 4: Smart car example scenario with IoT device POSTing data to multiple end-points in single request using GraphQL architecture. constrained IoT libraries. We expected it to furnish efficient energy and bandwidth utilisation as well as reduction in communication delays in IoT applications. Therefore, we were motivated to propose an approach based on integration of its abstraction layer, cloud services and constrained application protocol for IoT. In this paper, we interface a GraphQL abstraction layer with IoT CoAP protocol both on client and server modules, and integrate in cloud services for efficient energy utilisation and data management. We implemented a testbed based on our proposed incorporation of web/cloud technologies for IoT applications, to evaluate on different scenarios posing various data injection challenges. The proposed integration of graph-based web framework and constrained application request/response structure is targeted for both scalar and multimedia sensing data. The experimental study presented in this paper focused on the high injection of sensing traffic that is not sustainable by the sensor network. Traffic minimisation is also possible by using local data fusion at IoT node level to reduce the data into some scalar values. However, such techniques can fail where sensing data are of different types and to be delivered to different end-points. The proposed interfacing of GraphQL modules with CoAP protocol has the features to optimise network traffic of diverse data, serving the respective data repositories and the clients. GraphQL framework adds hierarchical data communication possibility with data having multiple relationships, otherwise needing separate trip times for delivery in REST style. IoT networks with large deployments and frequent data communication even having scalar sensor data can become congested and need lightweight schemes such as the one presented here. The proposed approach for wireless sensor networks-based IoT applications involves cloud services and maintaining client-server architecture, where implementation is running client side on sensor nodes and cloud services are providing residence for the server side. We integrate the GraphQL abstraction module on our client side in the form of GraphQL query language and we incorporate its default module named as Runtime on the server side hosted in Google cloud functions. This implemented Runtime provides data exchange according to the configuration by clients where they can mention the filters, operations and structure of the received data in the aggregated queries. Figure 5 presents the block components of the proposed scheme integrating cloud services, web framework, and interfacing with IoT CoAP protocol, showing their positions on client/server side of the system. In our proposed methodology, GraphQL abstraction layer is used to represent IoT data in graphs and queries notion, which makes the paradigm scalable and flexible.