# ASP-Based Declarative Reasoning in Data-Intensive Enterprise and IoT Applications
## 2 The DLV-EE Framework
### Reasoning over Hive
#### 3.1.1 Development of DLV-EE Solutions

In the case of applications that make direct use of DLV-EE, the development can rely on direct access to the REST services; however, one can also use _ASPIDE_ which has been purposely extended to ease the whole process. In particular, once the ASP programs are written, it is possible to decide either to save them directly to the local disk or interact with the REST interface to access a remote workspace and store ASP programs and facts directly to the DLV-EE storage location. Moreover, it is possible to invoke DLV-EE from _ASPIDE_ itself by exploiting the REST interface. #### 3.1.2 Development of DLV-IoT Solutions

For the development of DLV-IoT based solutions for _Android_ and _Raspberry Pi_ systems, in this work _ASPIDE_ has been extender to make the system suitable for implementing and deploying ASP programs into external libraries. In such a way, the final libraries can be integrated, on one hand, to the _Android Studio_ environment [[https://developer.android.com/studio](https://developer.android.com/studio)]([https://developer.android.com/studio](https://developer.android.com/studio)) for the development of software solutions based on _Android_, and on the other hand, to the Eclipse environment [[https://www.eclipse.org/](https://www.eclipse.org/)]([https://www.eclipse.org/](https://www.eclipse.org/)), for implementing e.g., _Raspberry Pi_ solutions. More in detail, an ASP programmer can first write the ASP program in _ASPIDE_, export the program into an AAR [[https://developer.android.com/studio/projects/android-library/JAR](https://developer.android.com/studio/projects/android-library/JAR)]([https://developer.android.com/studio/projects/android-library/JAR](https://developer.android.com/studio/projects/android-library/JAR)) [[https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jarGuide.html](https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jarGuide.html)]([https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jarGuide.html](https://docs.oracle.com/javase/8/docs/technotes/guides/jar/jarGuide.html)) library and then import the library into a Java program for _Android_ or _Raspberry Pi_ applications: the Java programmer just needs to import the library into the desired environment like _Android Studio_ or Eclipse and use it (note that the DLV-IoT system will be included in the library as well). ## 4 DLV-EE and DLV-IoT at Work: Some Use Cases

This section presents two real-world scenarios and shows how applications based on DLV-EE and DLV-IoT can be conveniently developed. The first scenario consists of an _Android_ app, namely _NavTour_, allowing users to exploit an intelligent navigator system (_DLV Navigator_); the second scenario makes use of the DLV-IoT system in a Smart Cities context. ### Planning Touristic Itineraries

_DLVNaigator_ is a web service, based on DLV-EE, which has been endowed with additional features to automatically generate tourist itineraries. The web service can be easily accessed from multiple clients via a _RESTful_ architecture that exposes _APIs_ capable of providing a rich set of services, which are briefly described in the following. The service provides the user with a planned itinerary enriched with information about locations

Figure 3: Integrated Development Environment for DLV-EE and DLV-IoT. and the visiting times of the points of interest (_POIs_) (e.g., historic squares, museums, monuments, etc.). Itineraries are guaranteed to be free of loops and dead ends, also ensuring compliance with the preferences and time constraints coming from the user and paying attention to other details (e.g., do not place _POIs_ to be visited in time slots in which they are not available to the public).