Skip to main content

Logic programming as a service


New generations of distributed systems are opening novel perspectives for logic programming (LP): On the one hand, service-oriented architectures represent nowadays the standard approach for distributed systems engineering; on the other hand, pervasive systems mandate for situated intelligence. In this paper, we introduce the notion of Logic Programming as a Service (LPaaS) as a means to address the needs of pervasive intelligent systems through logic engines exploited as a distributed service. First, we define the abstract architectural model by re-interpreting classical LP notions in the new context; then we elaborate on the nature of LP interpreted as a service by describing the basic LPaaS interface. Finally, we show how LPaaS works in practice by discussing its implementation in terms of distributed tuProlog engines, accounting for basic issues such as interoperability and configurability.

    • Send article to Kindle

      To send this article to your Kindle, first ensure is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about sending to your Kindle. Find out more about sending to your Kindle.

      Note you can select to send to either the or variations. ‘’ emails are free but can only be sent to your device when it is connected to wi-fi. ‘’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

      Find out more about the Kindle Personal Document Service.

      Logic programming as a service
      Available formats
      Send article to Dropbox

      To send this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Dropbox.

      Logic programming as a service
      Available formats
      Send article to Google Drive

      To send this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your <service> account. Find out more about sending content to Google Drive.

      Logic programming as a service
      Available formats
Hide All
Alkhabbas, F., Spalazzese, R. and Davidsson, P. 2017. Architecting emergent configurations in the internet of things. In Proc. of IEEE International Conference on Software Architecture (ICSA). IEEE, Los Alamitos, CA, USA, 221–224.
Bettini, C., Brdiczka, O., Henricksen, K., Indulska, J., Nicklas, D., Ranganathan, A. and Riboni, D. 2010. A survey of context modelling and reasoning techniques. Pervasive and Mobile Computing 6, 2, 161180.
Brogi, A. and Ciancarini, P. 1991. The concurrent language, Shared Prolog. ACM Transactions on Programming Languages and Systems 13, 1, 99123.
Brogi, A. and Gorrieri, R. 1989. A distributed, net oriented semantics for Delta Prolog. In International Joint Conference on Theory and Practice of Software Development (TAPSOFT '89), Díaz, J. and Orejas, F., Eds. Lecture Notes in Computer Science, vol. 351. Springer, Berlin Heidelberg, 162177.
Brownlee, J. 2011. Clever Algorithms: Nature-Inspired Programming Recipes. Lulu Press, Morrisville, NC, USA.
Bugliesi, M., Lamma, E. and Mello, P. 1994. Modularity in logic programming. Journal of Logic Programming 19–20, 443502. Special Issue: Ten Years of Logic Programming.
Calegari, R., Denti, E., Dovier, A. and Omicini, A. 2018. Extending logic programming with labelled variables: Model and semantics. Fundamenta Informaticae 161, 5374.
Calegari, R., Denti, E., Mariani, S. and Omicini, A. 2017. Logic programming as a service (LPaaS): Intelligence for the IoT. In Proc. of IEEE 14th International Conference on Networking, Sensing and Control (ICNSC 2017), Fortino, G., Zhou, M., Lukszo, Z., Vasilakos, A. V., Basile, F., Palau, C., Liotta, A., Fanti, M. P., Guerrieri, A. and Vinci, A., Eds. IEEE, Los Alamitos, CA, USA, 72–77.
Calegari, R., Denti, E., Mariani, S. and Omicini, A. 2018. Logic programming as a service in multi-agent systems for the Internet of Things. International Journal of Grid and Utility Computing (in press). URL:
Cannata, A., Karnouskos, S. and Taisch, M. 2010. Evaluating the potential of a service oriented infrastructure for the factory of the future. In Proc. of 8th IEEE International Conference on Industrial Informatics (INDIN 2010). IEEE, Los Alamitos, CA, USA, 592–597.
Chen, H., Finin, T. and Joshi, A. 2003. An ontology for context-aware pervasive computing environments. The Knowledge Engineering Review 18, 3, 197207.
Cheng, B., Wang, M., Zhao, S., Zhai, Z., Zhu, D. and Chen, J. 2017. Situation-aware dynamic service coordination in an IoT environment. IEEE/ACM Transactions on Networking 25, 4, 20822095.
Clark, K. L. 1978. Negation as failure. Logic and Data Bases. Springer, Boston, MA, USA, 293322.
Clark, K. L. 1987. PARLOG: The language and its applications. In Proc. of PARLE Parallel Architectures and Languages Europe. Volume II: Parallel Languages. Eindhoven, The Netherlands, 15–19 June 1987, de Bakker, J. W., Nijman, A. J., and Treleaven, P. C., Eds. Lecture Notes in Computer Science, vol. 259. Springer, Berlin, Heidelberg, 30–53.
Clark, K. L. and Gregory, S. 1981. A relational language for parallel programming. In 1981 Conference on Functional Programming Languages and Computer Architecture (FPCA '81). ACM, New York, NY, USA, 171–178.
Cunha, J. C., Ferreira, M. C. and Pereira, L. M. 1989. Programming in Delta Prolog. In Proc. of the 6th International Conference on Logic Programming (ICLP 1989), Lisbon, Portugal, 19–23 June 1989, Levi, G. and Martelli, M., Eds. MIT Press, Cambridge, MA, USA, 487–504.
Cusumano, M. 2010. Cloud computing and SaaS as new computing platforms. Communications of the ACM 53, 4, 2729.
Denti, E., Omicini, A. and Ricci, A. 2001. tuProlog: A light-weight Prolog for Internet applications and infrastructures. In Proc. of 3rd International Symposium Practical Aspects of Declarative Languages (PADL 2001), Las Vegas, NV, USA, 11–12 Mar. 2001, Ramakrishnan, I. V., Ed. Lecture Notes in Computer Science, vol. 1990. Springer, Berlin, Heidelberg, 184–198.
Deransart, P., Ed-Dbali, A. and Cervoni, L. 1996. Prolog: The Standard. Reference Manual. Springer, Berlin, Heidelberg.
Dey, A. K. 2001. Understanding and using context. Personal and Ubiquitous Computing 5, 1, 47.
EJB. Home Page. URL: Accessed 10 May 2018.
Erl, T. 2005. Service-Oriented Architecture: Concepts, Technology, and Design. Prentice Hall/Pearson Education International, Upper Saddle River, NJ, USA.
Etter, R., Costa, P. D., and Broens, T. 2006. A rule-based approach towards context-aware user notification services. In Proc. of 2006 ACS/IEEE International Conference on Pervasive Services (ICPS 2006). IEEE, Lyon, France, 281–284.
Familiar, B. 2015. Microservices, IoT, and Azure: Leveraging DevOps and Microservice Architecture to Deliver SaaS Solutions, 1st ed. Apress, Berkely, CA, USA.
Fielding, R. T. and Taylor, R. N. 2002. Principled design of the modern Web architecture. ACM Transactions on Internet Technology 2, 2, 115150.
Finin, T., Joshi, A., Kagal, L., Ratsimore, O., Korolev, V. and Chen, H. 2001. Information agents for mobile and embedded devices. In Proc. of 5th InternationalWorkshop Cooperative Information Agents V (CIA 2001), Modena, Italy, 6–8 May 2001, Klusch, M. and Zambonelli, F., Eds. Springer, Berlin, Heidelberg, 264–286.
Gallaire, H. and Minker, J., Eds. 1978. Logic and Data Bases. Springer, Boston, MA, USA.
Gelernter, D. 1985. Generative communication in Linda. ACM Transactions on Programming Languages and Systems 7, 1, 80112.
Guinard, D., Trifa, V., Karnouskos, S., Spiess, P. and Savio, D. 2010a. Interacting with the SOA-based Internet of Things: Discovery, query, selection, and on-demand provisioning of Web Services. IEEE Transactions on Services Computing 3, 3, 223235.
Guinard, D., Trifa, V. and Wilde, E. 2010b. A resource oriented architecture for the web of things. In Proc. Internet of Things (IOT). IEEE, Los Alamitos, CA, USA, 1–8.
Hachem, S., Pathak, A. and Issarny, V. 2014. Service-oriented middleware for large-scale mobile participatory sensing. Pervasive and Mobile Computing 10, 6682. Selected Papers from the Eleventh Annual IEEE International Conference on Pervasive Computing and Communications (PerCom 2013).
Heuer, J., Hund, J. and Pfaff, O. 2015. Toward the web of things: Applying web technologies to the physical world. Computer 48, 5, 3442.
Hu, B., Wang, Z. and Dong, Q. 2012. A modeling and reasoning approach using description logic for context-aware pervasive computing. In Proc. of Emerging Research in Artificial Intelligence and Computational Intelligence: International Conference, AICI 2012, Chengdu, China, October 26–28, 2012, Lei, J., Wang, F. L., Deng, H. and Miao, D., Eds. Communications in Computer and Information Science, vol. 315. Springer, Berlin, Heidelberg, 155–165.
J2EE. 2017. Home Page. URL: Accessed 10 May 2018.
Java Persistence API. 2017. Home Page. URL: Accessed 10 May 2018.
Jersey. 2017. Home Page. URL: Accessed 10 May 2018.
jose.4.j. 2017. Home Page. URL: Accessed 10 May 2018.
JSON. 2017. Home Page. URL: Accessed 10 May 2018.
Karnouskos, S., Colombo, A. W., Bangemann, T., Manninen, K., Camp, R., Tilly, M., Stluka, P., Jammes, F., Delsing, J. and Eliasson, J. 2012. A SOA-based architecture for empowering future collaborative cloud-based industrial automation. In Proc. of 38th Annual Conference on IEEE Industrial Electronics Society (IECON 2012). IEEE, Los Alamitos, CA, USA, 5766–5772.
Loke, S. W. 2004. Representing and reasoning with situations for context-aware pervasive computing: a logic programming perspective. The Knowledge Engineering Review 19, 3, 213233.
LPaaS. 2018. Home page. URL: Accessed 10 May 2018.
Mariani, S. and Omicini, A. 2015. Coordinating activities and change: An event-driven architecture for situated MAS. Engineering Applications of Artificial Intelligence 41, 298309.
Martelli, M. 1995. Constraint logic programming: Theory and applications. In 1985–1995: Ten years of Logic Programming in Italy, Sessa, M., Ed. Editrice, Palladio, Salerno, Italy, 137166.
Messina, F., Mikkilineni, R. and Morana, G. 2017. Middleware, framework and novel computing models for grid and cloud service orchestration. International Journal of Grid and Utility Computing 8, 71.
Michelson, B. M. 2006. Event-driven architecture overview: Event-driven SOA is just part of the EDA story. Report, Patricia Seybold Group. Feb.
Monteiro, L. 1984. A proposal for distributed programming in logic. In Implementations of Prolog, Campbell, J. A., Ed. Artificial Intelligence. Ellis Horwood Limited, Chicester, UK, 329340.
MQTT. 2017. Home Page. URL: Accessed 10 May 2018.
Naish, L. 1988. Parallelizing NU-Prolog. In Proc. of the 5th International Conference and Symposium on Logic Programming, Seattle, Washington, 15–19 Aug. 1988, Kowalski, R. A. and Bowen, K. A., Eds. MIT Press, Cambridge, MA, USA, 1546–1564.
Nalepa, G. J. and Bobek, S. 2014. Rule-based solution for context-aware reasoning on mobile devices. Computer Science and Information Systems 11, 1, 171193.
Niezen, G. 2013. Ontologies for interaction: Enabling serendipitous interoperability in smart environments. Journal of Ambient Intelligence and Smart Environments 5, 1, 135137.
Nii, H. P. 1986. The blackboard model of problem solving and the evolution of blackboard architectures. The AI Magazine 7, 2, 38106.
Oliya, M. and Pung, H. K. 2011. Towards incremental reasoning for context aware systems. In Proc. of Advances in Computing and Communications: 1st International Conference, ACC 2011, Kochi, India, July 22-24, 2011, Part I, Abraham, A., Mauri, J. Lloret, Buford, J. F., Suzuki, J. and Thampi, S. M., Eds. Communications in Computer and Information Science, vol. 190. Springer, Berlin, Heidelberg, 232–241.
Omicini, A. and Zambonelli, F. 1999. Coordination for Internet application development. Autonomous Agents and Multi-Agent Systems 2, 3, 251269. Special Issue: Coordination Mechanisms for Web Agents.
Palù, A. D. and Torroni, P. 2010. 25 years of applications of logic programming in Italy. In A 25-Year Perspective on Logic Programming, Dovier, A. and Pontelli, E., Eds. Springer, Berlin, Heidelberg, 300328.
Parker, L. E. 2008. Distributed intelligence: Overview of the field and its application in multi-robot systems. Journal of Physical Agents 2, 1, 514.
Payara. 2017. Home Page. URL: Accessed 10 May 2018.
Pontelli, E., Cao Son, T. and Baral, C. 2008. A logic programming based framework for intelligent Web Service composition. In Managing Web Service Quality: Measuring Outcomes and Effectiveness. IGI Global, Hershey, PA, USA, 193221.
Prado, A. G. D., Ortiz, G. and Boubeta-Puig, J. 2017. CARED-SOA: A context-aware event-driven service-oriented architecture. IEEE Access 5, 46464663.
Ranganathan, A., Al-Muhtadi, J. and Campbell, R. H. 2004. Reasoning about uncertain contexts in pervasive computing environments. IEEE Pervasive Computing 3, 2, 6270.
Ranganathan, A. and Campbell, R. H. 2003. An infrastructure for context-awareness based on first order logic. Personal and Ubiquitous Computing 7, 6, 353364.
Reiter, R. 1978. On closed world data bases. Logic and Data Bases. Springer, Boston, MA, USA, 5576.
Ricci, A., Viroli, M., Omicini, A., Mariani, S., Croatti, A. and Pianini, D. 2017. Spatial Tuples: Augmenting physical reality with tuple spaces. In Intelligent Distributed Computing X. Proc. of the 10th International Symposium on Intelligent Distributed Computing – IDC 2016, Paris, France, October 10–12 2016, Badica, C., El Fallah Seghrouchni, A., Beynier, A., Camacho, D., Herpson, C., Hindriks, K. and Novais, P., Eds. Studies in Computational Intelligence, vol. 678. Springer, Berlin, Heidelberg, 121–130.
Richards, M. 2016. Microservices AntiPatterns and Pitfalls. O'Reilly, Sebastopol, CA, USA.
Robinson, J. A. 1965. A machine-oriented logic based on the resolution principle. Journal of the ACM 12, 1, 2341.
Salber, D., Dey, A. K. and Abowd, G. D. 1999. The context toolkit: Aiding the development of context-enabled applications. In Proc. of SIGCHI Conference on Human Factors in Computing Systems (CHI '99). ACM, New York, NY, USA, 434–441.
Schulte, R. W. and Natis, Y. V. 2003. Event-driven architecture complements SOA. Research note, Gartner. 8 July.
Shapiro, E. Y. 1987. Concurrent Prolog – Vol. 1: Collected Papers. Logic Programming. The MIT Press, Cambridge, MA, USA.
Smart, P. 2017. Situating machine intelligence within the cognitive ecology of the Internet. Minds and Machines 27, 2, 357380.
Ueda, K. 1986. Guarded Horn clauses. In Proc. of the 4th Conference on Logic Programming '85, Tokyo, Japan, 1–3 July 1985, Wada, E., Ed. Lecture Notes in Computer Science, vol. 221. Springer, Berlin, Heidelberg, 168–179.
Wang, H., Mehta, R., Supakkul, S. and Chung, L. 2011. Rule-based context-aware adaptation using a goal-oriented ontology. In Proc. of 2011 International Workshop on Situation Activity & Goal Awareness (SAGAware '11). ACM, New York, NY, USA, 67–76.
Wolfram, D. A., Maher, M. J. and Lassez, J.-L. 1984. A unified treatment of resolution strategies for logic programs. In Proc. of 2nd International Conference on Logic Programming (ICLP 1984), Tärnlund, S.-Å., Ed. Association for Logic Programming, Uppsala, Sweden, 263–276.
Zambonelli, F., Omicini, A., Anzengruber, B., Castelli, G., DeAngelis, F. L., Di Marzo Serugendo, G., Dobson, S., Fernandez-Marquez, J. L., Ferscha, A., Mamei, M., Mariani, S., Molesini, A., Montagna, S., Nieminen, J., Pianini, D., Risoldi, M., Rosi, A., Stevenson, G., Viroli, M. and Ye, J. 2015. Developing pervasive multi-agent systems with nature-inspired coordination. Pervasive and Mobile Computing 17, 236252. Special Issue “10 years of Pervasive Computing” In Honor of Chatschik Bisdikian.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *



Altmetric attention score

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed