Abstract:As the infrastructure supporting smart home evolves, smart home has entered a new stage featured by intelligent services. A large number of complex and heterogeneous smart devices cooperate with each other, and make up plenty of intelligent and integrated smart home applications, in which context-aware services can be regarded as typical representatives. The context-aware services aim to provide accurate services to users according to their contexts. Developers usually design and develop these services based on scenario, and face huge challenges from device and demand variations. They first have to be familiar with the APIs provided by smart devices and then build the program upon them according to functional and nonfunctional requirements of services. In order to customize and develop these services more efficiently, this study proposes an approach to model and execute context-aware services at runtime, which introduces the knowledge graph into development process. First, concepts and relations of context-aware services are defined in the concept model of knowledge map. Second, runtime instances of concepts and relations in knowledge map are used to represent the knowledge of user's context. Third, knowledge reasoning based on the runtime knowledge map is implemented to perform device functions automatically. The proposed framework is evaluated on a prototype system, and the results show that the proposed approach can model and execute context-aware services at runtime and LOC (lines of code) is reduced by 90%.