1. A computer-implemented method of querying a sensor network, said network being hierarchically organized sensor network with a global coordinator node at a top level which receives data from lower level intermediate nodes, said intermediate nodes being either leader nodes for lower level nodes or sensor nodes, wherein a sensor node i at a lowest level receives a signal Y(i,t) at time t, said method comprising the steps of: constructing a sketch S wkt = ( S wkt 1 , … ⁢ , S wkt n ) for an internal node k from S wkt j = ∑ i ∈ LeafDescendents ⁡ ( k ) ⁢ ∑ q = 1 t ⁢ b wiq · r iq j , wherein component S j wkt is a sketch of a descendant of node k, r j it is a random variable drawn from {−1, 1} associated with each sensor node i and time instant t wherein index j refers to independently drawn instantiations of the random variable, the bit B wit in {0,1} represents a state of sensor node i for signal value w=Y(i,t) at time t, and LeafDescendents(k) are the lowest level sensor nodes under node k, wherein said sketch is adapted for responding to queries regarding the state of said network, wherein said step of constructing is performed by a processor.