Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Towards Logic Programming as a Service: Experiments in tuProlog

491 views

Published on

In this talk we explore the perspective of Logic Programming as a Service (LPaaS), with a broad notion of “service” going beyond the mere handling of the logic engine lifecycle, knowledge base management, reasoning queries execution, etc. In particular, we present tuProlog as-a-service, a Prolog engine based on the tuProlog core made available as an encapsulated service to effectively support the spreading of intelligence in pervasive systems—mainly, Internet-of-Things (IoT) applications scenarios. So, after recalling the main features of tuProlog technology, we discuss the design and implementation of tuProlog as-a-service, focussing in particular on the iOS platform because of the many supported smart devices (phones, watches, etc.), the URL-based communication support among apps, and the multi-language resulting scenarios.

Published in: Science
  • Be the first to comment

  • Be the first to like this

Towards Logic Programming as a Service: Experiments in tuProlog

  1. 1. Towards Logic Programming as a Service Experiments in tuProlog Roberta Calegari Enrico Denti Stefano Mariani Andrea Omicini {roberta.calegari, enrico.denti, s.mariani, andrea.omicini}@unibo.it Dipartimento di Informatica – Scienza e Ingegneria (DISI) Alma Mater Studiorum – Universit`a di Bologna XVII Workshop “From Objects to Agents” (WOA 2016) Catania, Italy, 29 July 2016 Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 1 / 26
  2. 2. Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 2 / 26
  3. 3. Scope & Goals Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 3 / 26
  4. 4. Scope & Goals Context & Motivation Context Challenges of today’s pervasive system [MO15] complex distributed situated intelligent distributed situated intelligence light-weight, effective intelligence chunks placed where and when needed to locally tackle the specific reasoning needs Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 4 / 26
  5. 5. Scope & Goals Context & Motivation Motivations Complex Internet-of-Things (IoT) scenarios mobility/cloud ecosystem infrastructure, platforms, and software as a service enabling people to benefit from ubiquitous information access Role of logic-based languages Multiple, distributed Prolog engines intelligence providers technology integrators [OZ04] Logic Programming as a Service (LPaaS) Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 5 / 26
  6. 6. Scope & Goals tuProlog in a Nutshell tuProlog [DOR01, DOC13] light-weight, minimal, easily deployable dynamically configurable inter-operable multi-paradigm, multi-language, multi-platform Java, .NET, Android, iOS open-source @ http://tuprolog.unibo.it Minimality tuProlog core contains just the Prolog engine essentials ↑ other features via libraries Easy deployability e.g., JAR archive/.NET assembly made available at the desired location – Android/iOS app (via the Android/iOS installer) Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 6 / 26
  7. 7. Logic Programming as a Service (LPaaS) Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 7 / 26
  8. 8. Logic Programming as a Service (LPaaS) Architecture LPaaS Architecture Logic Programming as a Service (LPaaS) Presumably at the SaaS level Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 8 / 26
  9. 9. Logic Programming as a Service (LPaaS) Interface & API LPaaS Interface & API (Local) API create engine to instantiate a dedicated engine reset engine to reset the engine to the initial state and possibly the empty knowledge base set theory to load the knowledge base into the engine query to submit queries and retrieve (possibly multiple) results Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 9 / 26
  10. 10. tuProlog as a Service (2PaaS) on iOS Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 10 / 26
  11. 11. tuProlog as a Service (2PaaS) on iOS Architecture 2PaaS Architecture tuProlog as a Service (2PaaS) on iOS is embedded in a tuProlog app acting as the service provider for all other applications running on the mobile device Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 11 / 26
  12. 12. tuProlog as a Service (2PaaS) on iOS Interface & API 2PaaS Interface & API I API create engine implicit—just embedded in the first call to the service reset engine mapped onto the 2P reset primitive set theory mapped onto the 2P theory primitive query mapped onto a set of 2P primitives—namely, query to issue the query, result and solution to retrieve the query result, and nextSol to explore further solutions iOS built-in URL scheme functionality simple and effective way for application inter-communication ↑ via a user-defined, URL-based protocol Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 12 / 26
  13. 13. tuProlog as a Service (2PaaS) on iOS Interface & API 2PaaS Interface & API II tuProlog app URL scheme tuPrologMobile://?src=srcURL&command=argument&dst=dstURL srcURL is the client URL scheme command is one of theory, query, nextSol, reset, with argument respectively being theory, query (the text of the query) dstURL is the URL scheme of the client to which the result should be sent, possibly different from srcURL Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 13 / 26
  14. 14. tuProlog as a Service (2PaaS) on iOS Interface & API 2PaaS Interface & API III Query result returned by the tuProlog service dstURL://command=commandresult dstURL is the URL scheme of the client receiving the result command is either result, solution, nextSol, or reset, with the respective commandresult Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 14 / 26
  15. 15. Application Scenarios Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 15 / 26
  16. 16. Application Scenarios The “Derivative” Case Study The “Derivative” Case Study The symbolic derivative query, and its result on iPhone and iWatch Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 16 / 26
  17. 17. Application Scenarios The Multi-language Case Study The Multi-language Toy Example exploiting tuProlog multi-paradigm programming support (OOLibrary) Swift or Objective-C apps interacting with Java entities Swift app creates Java objects, calls methods, and elaborates the (Java) result back in Swift Example query a Java string member(X,[a,d]). is bound to the Prolog var Q then a Java Prolog engine is bound to the Prolog var P P is used to solve the query Q the result is bound to the Prolog var S the result is converted to a Java string via toString then it is bound to the final result to the Prolog var SOL the result is printed by the Swift app on its console Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 17 / 26
  18. 18. Application Scenarios Complex Pervasive Systems Towards Home Intelligence need for situatedness—i.e., smart fridge, geo-localised reasoning instability of the connection limits to the availability of bandwidth and computational power Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 18 / 26
  19. 19. Related Work Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 19 / 26
  20. 20. Related Work Related Work [CH01] — PiLLoW library (Programming in Logic Languages on the Web): developed in Ciao Prolog and available for SWI-Prolog, SICStus Prolog, and YAP and Ciao [MS02] — Logic programming for the composition of Semantic Web Services [BGHK97] — ALP-Prolog library aiming at embedded HTTP servers for controlling appliances Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 20 / 26
  21. 21. Conclusion & Further Work Outline 1 Scope & Goals 2 Logic Programming as a Service (LPaaS) 3 tuProlog as a Service (2PaaS) on iOS 4 Application Scenarios 5 Related Work 6 Conclusion & Further Work Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 21 / 26
  22. 22. Conclusion & Further Work Conclusions Distributed light-weight logic programming engines for pervasive and situated systems → modular, multi-platform, and multi-language logic engine → LPaaS → tuProlog as a service (2PaaS) on iOS Further Work precisely defining and further extending the LPaaS paradigm providing logic engines within SOA – e.g., tuProlog as a RESTful web service designing the architecture of a general-purpose Prolog middleware building a full-fledged specialised tuProlog middleware Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 22 / 26
  23. 23. References References I Manfred Bathelt, Ulrich Gall, Bernd Hindel, and Christian Kurzke. Accessing embedded systems via WWW: The ProWeb toolset. Computer Networks and ISDN Systems, 29(8-13):1065–1073, September 1997. Papers from the 6th International World Wide Web Conference. Daniel Cabeza and Manuel V. Hermenegildo. Distributed WWW programming using (Ciao-) Prolog and the PilloW library. Theory and Practice of Logic Programming, 1(3):251–282, May 2001. Enrico Denti, Andrea Omicini, and Roberta Calegari. tuProlog: Making Prolog ubiquitous. ALP Newsletter, October 2013. Enrico Denti, Andrea Omicini, and Alessandro Ricci. tuProlog: A light-weight Prolog for Internet applications and infrastructures. In I.V. Ramakrishnan, editor, Practical Aspects of Declarative Languages, volume 1990 of Lecture Notes in Computer Science, pages 184–198. Springer Berlin Heidelberg, 2001. 3rd International Symposium (PADL 2001), Las Vegas, NV, USA, 11–12 March 2001. Proceedings. Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 23 / 26
  24. 24. References References II Stefano Mariani and Andrea Omicini. Coordinating activities and change: An event-driven architecture for situated MAS. Engineering Applications of Artificial Intelligence, 41:298–309, May 2015. Sheila Mcilraith and Tran Cao Son. Adapting GOLOG for composition of Semantic Web Services. In Dieter Fensel, Fausto Giunchiglia, Deborah L. McGuinness, and Mary-Anne Williams, editors, 8th International Conference on Principles and Knowledge Representation and Reasoning (KR-02), pages 482–493. Morgan Kaufmann, 22–25 April 2002. Andrea Omicini and Franco Zambonelli. MAS as complex systems: A view on the role of declarative approaches. In Jo˜ao Alexandre Leite, Andrea Omicini, Leon Sterling, and Paolo Torroni, editors, Declarative Agent Languages and Technologies, volume 2990 of Lecture Notes in Computer Science, pages 1–17. Springer, May 2004. 1st International Workshop (DALT 2003), Melbourne, Australia, 15 July 2003. Revised Selected and Invited Papers. Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 24 / 26
  25. 25. Extras URLs Slides on APICe → http://apice.unibo.it/xwiki/bin/view/Talks/LpaasWoa2016 on SlideShare → http://www.slideshare.net/andreaomicini/ towards-logic-programming-as-a-service Paper on APICe → http://apice.unibo.it/xwiki/bin/view/Publications/LpaasWoa2016 on CEUR → http://ceur-ws.org/Vol-????/paper ?.pdf Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 25 / 26
  26. 26. Towards Logic Programming as a Service Experiments in tuProlog Roberta Calegari Enrico Denti Stefano Mariani Andrea Omicini {roberta.calegari, enrico.denti, s.mariani, andrea.omicini}@unibo.it Dipartimento di Informatica – Scienza e Ingegneria (DISI) Alma Mater Studiorum – Universit`a di Bologna XVII Workshop “From Objects to Agents” (WOA 2016) Catania, Italy, 29 July 2016 Calegari, Denti, Mariani, Omicini (UniBo) Towards Logic Programming as a Service WOA 2016, 29/07/2016 26 / 26

×