With an estimated number of more than 15 billion, objects, the management of architectures for the Internet of Things is a veritable challenge. The inherent mobility (in terms of devices and users) of the IoT means that the architecture has to be resilient to appearance and disappearance of devices. In this paper, we address the problem of autonomic management of IoT architecture by the means of ontologies. The problem we address is that given a dynamic system which is built upon a multitude of entities abstracted as services and characterized by their inputs and outputs, evolving targets that aim to provide services in terms of data or in terms of control, our goal is to enable autonomic management of these kinds of systems to cope with changes and evolutions so that the specified targets are fulfilled throughout the execution according to the specifics and dynamic needs of the system's users. We propose an innovative architecture that relies on ontologies to enable context-aware application to self-compose on demand. This architecture is being deployed to two smart campuses in two universities from Toulouse, France and Wollongong, Australia.