## 4 Related Work
### Portability Core (PoCo)
#### 5.5.2 PoCo Components
For instance, a data mining algorithm can be added for data analysis. * CoAP requests: Once resources or groups have been received in the user applications, they can be requested directly without a PoCo interaction. However, some user applications cannot provide a CoAP support to interact directly with resources or groups. In this case they can send a message to the PoCo to make the requests on behalf of the user application. This component makes a request for the resources or groups received and returns back the operation result. * Access control: Lastly, this component provides access control to create personalised behaviours. Although this component can be mandatory in most uses cases, sometimes the access control is not necessary, e.g., public sensors or collaborative actuators. If this component is deployed, the access control is enabled in the system, otherwise it is disabled. Monitoring applications are not the only application logic that can be created in Appdaptivity. Actuation trigger and Alerts components enable the definition of automatic actuation and configurable notifications. For instance, a user can define the actuation with some devices (e.g., windows) when there is change in the environment (e.g, high temperature). Users can also receive notifications when the underlying infrastructure matches a configurable criteria. This application logic allows automatic behaviours and actuation without any user interaction. Thereby, the main goals of the IoT, sense and actuate over the physical world [2] have been included. Furthermore, in the cases where a specific logic is necessary, the Function component enables the inclusion of specific source code like a data mining algorithm in the JavaScript programming language. As can the rest of the components in Appdaptivity, the Function component can be added in run-time and the application logic will be adapted with it. When behaviours become complex, programming can become a tedious task due to the number of PoCo components and necessary data flows to define them. For that reason, behaviours can be reused creating a subflow component. Subflow can be defined by selecting a group of PoCo components and selecting the option \"create a subflow\". Once a subflow has been defined, a new PoCo component with the selected behaviours will be available in the system. Therefore, subflow components enable the programming reuse in addition to reducing the complexity of large flows and facilitating programming for non-expert users. Although the possible PoCo configurations are large, the configuration presented in Figure 6 covers most of the behaviours presented above. The top flow is responsible for the discovery of the IoT infrastructure, thanks to the observation of the end points (RD EP component) and resources (RD RES component). The next components allow it to get the end point locations and enable the location and building flows. Note that this flow can be grouped into a subflow to simplify the development. The middle block contains, from top to bottom, temperature, humidity and light filters respectively. Lastly, three different behaviours have been created in the bottom flow: an average chart of temperature, an alert of humidity, and a group of lights. As can be seen, Appdaptivity provides an intuitive way to program IoT applications with just a few components.