International Journal of Computer Applications (0975 8887) Volume 43No.23, April 2012 5 XQuery based Query Processing Architecture in Wireless Sensor Networks Manish Kumar IIIT, Allahabad India Monalisa Panigrahi IMS College, Ghaziabad India Shekhar Verma IIIT, Allahabad India ABSTRACT A wireless sensor network (WSN) deployed to sense an environment should be able to send information as per the requirements of the sink. For this, the sink needs a query language to formulate its needs and fire queries to the network. The queried nodes must be able to process the multiple queries in their limited memory and computational capacity in a time bound manner. In this paper, an XQuery based query processing architecture that satisfies the unique needs of WSN has been proposed and evaluated. Traditional SQL does not satisfy the time limitations, source specificity and node constraints required by a WSN. X-query architecture allows spatial aware queries that can be processed by resource constrained nodes. TOSSIM based simulation of X-query processing is energy efficient and the nodes are able to process multiple queries within a small time period. General Terms Query Processing, Sensor Networks Keywords WSN, Query Processing, X-query, SQL 1. INTRODUCTION A wireless sensor network (WSN) is distributed system of wireless sensor nodes. These small sensors measure environmental and physical properties like temperature, pressure, humidity [1, 2] and organize themselves to deliver this data to a common data collector sink over the wireless medium. A sensor node is a low cost small hardware device suited for large scale deployment and autonomous operations. The cost, physical size, deployment regions, operational requirements and wireless communication medium restrict the memory size, processor capacity, operating platform, energy and reliability etc. of the nodes and the sensor network. The sensor network can be considered as a network database [3]. Such a logical database is a distributed database which contains a large number of nodes that contain environmental data and respond to user queries. The data sensed by sensor nodes have location specific significance. If the location of the occurrence of an event observed by a sensor node is not known, the data about the event is meaningless. Moreover, the data reported by sensor nodes are largely raw. Thus, there is a need for a query system [4, 5] and distributed query processing [6, 7] that requires sophisticated processing of data generation and storage of distributed data. The wired distributed networks have high capacity storage, continuous power supply and high end processors required for high performance data manipulation. A WSN is at the lowest end of distributed networks with differentiation in terms of power, communication, storage etc. Hence, alternative ways have to be devised for querying, data gathering and other unique requirements. A middleware [8, 9, 10, 11] is used as an interface between high-level abstraction and system-level programming concept in WSN. It can be used in such applications to hide the heterogeneity and distributed nature of the networks. The middleware [12, 13] is a software that can be used to fill the gap between the user applications and low level constructs. An important middleware used in query processing in WSN is TinyDB [15]. TinyDB provides a single unified declarative query (such as SQL) interface for the ease of communication between user and sensor networks. A user can fire Tiny-SQL queries (similar to SQL queries) to the base station. These queries are distributed to all the relevant nodes in the WSN from the base station that gather the result and send the response back to the user. Due to limited resources, Tiny-SQL does not support all type of SQL queries. The traditional TinySQL has several limitations. It does not give optimized result in multiple query scenarios. TinyDB uses a distributed in-network query processing architecture. The components of the TinyDB are built on top of TinyOS [14]. The user query should pass through these entire components [15]. Fig. 1 Query Processing Layers The different layers of the query processing as shown in Fig. 1: i) Network Management Layer: The function of this layer is to improve query performance in multihop network. This layer also supports query dissemination [16] and query sharing. It