IoT queries and data processing