# Sustainable IoT Sensing Applications Development through GraphQL-Based Abstraction Layer
## 4 Proposed Approach
### Scheme Formulation  
Cloud computing, fog computing [28] and edge computing [29] are different computational models being explored in the paradigm of IoT. Cloud computing focuses on centralised management, whereas the other two involve computation near the source devices. These technologies are vital for the realisation of IoT. We can use the cloud computing for the delegation of computationally intensive processing and centralised management of IoT. It can facilitate implementing and executing different software applications across diverse devices involved in the IoT network. This suits the incorporation of abstraction layer in our proposed approach. Implementation of GraphQL-based proposal is workable as it is an application layer framework and we can use it with any back-end frameworks meeting its protocol specification. Another point of its implementation feasibility is that GraphQL is not dependent on any specific transport protocol for client-server communication because of keeping its data of queries and responses in the payload. In typical IoT networks, sensor nodes are generating data at some specific rate or when some particular event is detected. Data are usually sent to the neighbouring gateway node where necessary processing can be carried out. Gateway nodes then forward the data to the central server (sink) node for further analysis. Figure 7 shows the typical scenario of IoT network where multiple source nodes are connected to the central sink node through intermediate gateway nodes. Let's consider \(S_{i}\) be the \(i\)thsource generating data of total size \(d_{i}\) with a particular data rate \(r_{i}\). Every source node \(S_{i}\) is connected to a gateway node \(G_{i}\) where GraphQL client is deployed to perform necessary aggregation and then data are forwarded to the sink node. Data aggregation at each gateway node depends upon the data receiving rate from the connected source nodes. Afterwards, data transmission time \(t_{b}i\) for a single packet by each gateway node depends on the aggregated data size \(b_{i}\) at respective gateway node. Brief descriptions of the various symbols used in the formulation are given in Table 1.  
Data transmission time \(t_{b}i\) for a single packet by each gateway node can be computed as below  
\[t_{bi}=RTS+CTS+T_{x}(b_{i})+Ack \tag{1}\]  
For total data \(d_{i}\) generated by source node \(S_{i}\) with data sending rate \(r_{i}\), minimum transmission time \(minTx_{i}\) is given by  
\[minTx_{i}=\frac{d_{i}}{p_{i}\times r_{i}} \tag{2}\]  
The actual total transmission time to send out the application data amount from the sensor node to sink node is the sum of the time spend in transmission, receiving, idle and sleep states [30]. However, Equation (2) provides a simplified model for minimum transmission time (theoretical) from sensor node to its next-hop gateway node assuming the node is not facing any interference or contention. For instance, a node has to send 1000 Bytes of data (including packet headers) to its gateway node and the data sending rate is 5 packets per second where packets size is 100 Bytes. Then, the minimum transmission time \(minTx_{i}\) for this node becomes 2 s, computed using Equation (2). Figure 7: Typical scenario of IoT network where multiple source nodes are connected to the central sink node through intermediate gateway nodes. Total number of aggregated packets \(A_{i}\) at gateway \(G_{i}\) becomes  
\[A_{i}=\frac{d_{i}}{b_{i}} \tag{3}\]  
As all gateway nodes are directly connected with the sink node, at any given time instant, only one gateway node can forward the packets. Let \(\phi_{i,k}=[\alpha,\beta]\) be time interval at which kth packet at gateway \(G_{i}\) node is scheduled where \(\alpha\) and \(\beta\) are the start and end time of this particular interval.