This paper proposes a context data management framework for efficient context data collection and evaluation to support contextaware applications. The proposed framework named SCARF leverages two architectures: a server-based centralized architecture and an edge-based architecture to address the problem of scalability of context collection and evaluation. SCARF collects the context data efficiently from resource constrained mobile/edge and multiple insitu sensors (not resource constrained) deployed in smart environments. In particular, SCARF takes a set of contextual queries from applications and optimizes the rate at which the context data needs to be collected and/or transmitted from the sensor to the server. Furthermore, SCARF decides whether the code for evaluating context should be executed on the server or on the edge. Execution on the edge will result in reduced communication between the server and the edge but can result in low performance due to resource constraints of the edge. On the other hand, evaluation of context on the server, will require SCARF to transmit sensor data from the sensor to the server but can result in high performance due to high resource availability of the server. SCARF is an adaptive framework which generates an optimal context acquisition plan and a context evaluation plan such that the overall latency is minimized.