# ASP-Based Declarative Reasoning in Data-Intensive Enterprise and IoT Applications
## 2 The DLV-EE Framework
### Reasoning over Hive
It refers to an interconnected network of devices, such as vehicles, home appliances, and other items which are embedded with sensors, specific firmware, and network connectivity, allowing them to collect and exchange vast amounts of data. The use of IoT devices is predicted to expand even more in the future, thanks to the new technologies coming from domotics, home automation, healthcare, and smart cities [27]. Moreover, IoT devices are particularly attractive since they allow us to make decisions, automate processes, and improve efficiency in many different contexts. For the above reasons, enabling advanced and complex reasoning capabilities in IoT applications, today, could be largely beneficial, especially when massive groups of sensors need to be leveraged. In general, in the IoT context, devices first acquire information about the surrounding environment, then a decision-making logic takes actions based on the input knowledge. Typically, due to the limited availability of computing power or memory on the edge devices, data is sent to remote/cloud systems that are in charge of actually performing the computation. However, data collected can come at a high pace and high volumes, thus suggesting that the ability to reason on such data locally and in real-time could benefit many advanced applications. _DLV-IoT_ is an ASP system conceived to be profitably used in such contexts, as it can shift the execution of reasoning tasks directly on Smart Devices. DLV-IoT consists of a specific version of DLV that analyzes the requested reasoning task and input data, and performs an estimation of the computational workload, thus deciding whether it can be reasonably executed locally; if this is not the case, it interacts with DLV-EE via the RESTservices made available via the introduction of a REST endpoint, thus enjoying the full computational power of the DLV-EE system, presumably running over more powerful infrastructures (see Figure 2). To date, besides the widespread mobile operating system Android [[https://www.android.com/](https://www.android.com/)]([https://www.android.com/](https://www.android.com/)), DLV-IoT is also able to run on _Raspberry Pi_[[https://www.raspberrypi.com/](https://www.raspberrypi.com/)]([https://www.raspberrypi.com/](https://www.raspberrypi.com/)), which is one of the most commonly used systems for collecting, aggregating and analyzing data coming from a network of IoT devices. Raspberry Pi is a tiny, low-cost, single-board computer that has become increasingly popular for IoT applications thanks to its compact size, portability, versatility, and low power consumption. Moreover, Raspberry Pi can be also directly connected to a variety of sensors, allowing it to gather data immediately from the physical world. The current version of DLV-IoT performs the local evaluation only in the case of Datalog programs; when full ASP language is present, it defaults to DLV-EE; more accurate estimations of the computational workload are under consideration. ### Development Tools for DLV-EE and DLV-IoT

The evolution and the introduction of more advanced hardware and software technologies generally go hand in hand with the implementation of proper tools for supporting developers during the entire development cycle of a given application, such as proper Integrated Development Environments (IDEs). As for \"standard\" ASP, and DLV in particular, _ASPIDE_[17] is one of the most comprehensive IDE for ASP which was followed by further extensions over the years. To support the development of applications based on DLV-EE and DLV-IoT, i.e., applications that require ASP solvers to go beyond reasoning in main memory and gathering input from local files, this work _ASPIDE_ has been properly extended via a synergic integration of multiple Integrated Development Environments suitably adapted to our purpose (Figure 3). Figure 2: Typical architecture of a DLV-IoT-based application over Raspberry.