In a highly dynamic environment like the Internet of Things, data is being continuously generated by IoT devices. These amounts of data make its processing and querying challenging tasks. Materialized views are ideal for query processing optimization by caching the results of queries. However, one of the main issues of the views materialization is their inconsistency with data sources. For this reason, we present a novel approach of query answering and data management in IoT systems. Our approach is based on new materialization and maintenance of views strategies. This last was carried out by factoring maintenance treatments of identical views and those sharing sources using a clustering technique. The results of experiments show that our approach is suitable for query processing under IoT environments.