Hostname: page-component-8448b6f56d-wq2xx Total loading time: 0 Render date: 2024-04-21T09:50:00.869Z Has data issue: false hasContentIssue false

Using SWISH to Realize Interactive Web-based Tutorials for Logic-based Languages

Published online by Cambridge University Press:  15 February 2019

Centrum Wiskunde & Informatica, Amsterdam, Netherlands (e-mail:
Department of Mathematics and Computer Science, University of Ferrara (e-mail:
Imperial College, London, UK (e-mail:
University of Gothenburg, Gothenburg, Sweden (e-mail:
Imperial College, London, UK (e-mail:
Logical Contracts, Lisbon, Portugal (e-mail:


Programming environments have evolved from purely text based to using graphical user interfaces, and now we see a move toward web-based interfaces, such as Jupyter. Web-based interfaces allow for the creation of interactive documents that consist of text and programs, as well as their output. The output can be rendered using web technology as, for example, text, tables, charts, or graphs. This approach is particularly suitable for capturing data analysis workflows and creating interactive educational material. This article describes SWISH, a web front-end for Prolog that consists of a web server implemented in SWI-Prolog and a client web application written in JavaScript. SWISH provides a web server where multiple users can manipulate and run the same material, and it can be adapted to support Prolog extensions. In this article we describe the architecture of SWISH, and describe two case studies of extensions of Prolog, namely Probabilistic Logic Programming and Logic Production System, which have used SWISH to provide tutorial sites.

Original Article
Copyright © Cambridge University Press 2019 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)


This research was partially supported by the VRE4EIC project, a project that has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreement no. 676247. The SWISH implementation of LPS was developed under an EPSRC grant administered by Imperial College London. We thank the referees for their helpful comments.


Alberti, M., Bellodi, E., Cota, G., Riguzzi, F. and Zese, R. 2017. cplint on SWISH: Probabilistic logical inference with a web browser. Intelligenza Artificiale 11, 1, 4764.CrossRefGoogle Scholar
Bellodi, E. and Riguzzi, F. 2013. Expectation maximization over binary decision diagrams for probabilistic logic programs. Intelligent Data Analysis 17, 2, 343363.CrossRefGoogle Scholar
Bellodi, E. and Riguzzi, F. 2015. Structure learning of probabilistic logic programs by searching the clause space. Theory and Practice of Logic Programming 15, 2, 169212.CrossRefGoogle Scholar
Blackburn, P., Bos, J. and Striegnitz, K. 2006. Learn Prolog Now!, vol. 7. College Publications, London, UK.Google Scholar
Byrd, L. 1980. Understanding the control flow of Prolog programs. In Logic Programming Workshop. Department of Artificial Intelligence, University of Edinburgh, Debrecen, Hungary.Google Scholar
De Raedt, L. and Kimmig, A. 2015. Probabilistic (logic) programming concepts. Machine Learning 100, 1, 547.CrossRefGoogle Scholar
De Raedt, L., Kimmig, A. and Toivonen, H. 2007. ProbLog: A probabilistic Prolog and its application in link discovery. In 20th International Joint Conference on Artificial Intelligence, Hyderabad, India (IJCAI-07), Veloso, M. M., Ed., vol. 7. AAAI Press, Palo Alto, California USA, 24622467.Google Scholar
Denecker, M. 2000. Extending classical logic with inductive definitions. In Computational logicCL 2000. Springer, Cham, 703717.CrossRefGoogle Scholar
Di Mauro, N., Bellodi, E. and Riguzzi, F. 2015. Bandit-based Monte-Carlo structure learning of probabilistic logic programs. Machine Learning 100, 1, 127156.CrossRefGoogle Scholar
Dries, A., Kimmig, A., Meert, W., Renkens, J., Van den Broeck, G., Vlasselaer, J. and De Raedt, L. 2015. Problog2: Probabilistic logic programming. In Machine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2015, Porto, Portugal, 7–11 Sept. 2015, Proceedings, Part III, Bifet, A., May, M., Zadrozny, B., Gavalda, R., Pedreschi, D., Bonchi, F., Cardoso, J. and Spiliopoulou, M., Eds. Springer International Publishing, Cham, 312315.CrossRefGoogle Scholar
Fierens, D., den Broeck, G. V., Renkens, J., Shterionov, D. S., Gutmann, B., Thon, I., Janssens, G. and De Raedt, L. 2015. Inference and learning in probabilistic logic programs using weighted Boolean formulas. Theory and Practice of Logic Programming 15, 3, 358401.CrossRefGoogle Scholar
Flach, P. 1994. Simply Logical: Intelligent Reasoning by Example. Wiley, Chichester, UK.Google Scholar
Gandrud, C. 2013. Reproducible Research with R and R Studio. CRC Press, Boca Raton, FL.Google Scholar
Knuth, D. E. 1984. Literate programming. The Computer Journal 27, 2, 97111.CrossRefGoogle Scholar
Kowalski, R. and Sadri, F. 2015. Reactive computing as model generation. New Generation Computing 33, 1, 3367.CrossRefGoogle Scholar
Kowalski, R. and Sadri, F. 2016. Programming in logic without logic programming. Theory and Practice of Logic Programming 16, 3, 269295.CrossRefGoogle Scholar
Kowalski, R. and Sergot, M. 1986. A logic-based calculus of events. New Generation Computing 4, 1, 6795.CrossRefGoogle Scholar
Lager, T. and Wielemaker, J. 2014. Pengines: Web logic programming made easy. TPLP 14, 4–5, 539552.Google Scholar
Nguembang Fadja, A. and Riguzzi, F. 2017. Probabilistic logic programming in action. In Towards Integrative Machine Learning and Knowledge Extraction, Holzinger, A., Goebel, R., Ferri, M. and Palade, V., Eds., vol. 10344. Springer, Heidelberg, Germany.Google Scholar
Riguzzi, F. 2013. MCINTYRE: A Monte Carlo system for probabilistic logic programming. Fundamenta Informaticae 124, 4, 521541.Google Scholar
Riguzzi, F., Bellodi, E., Lamma, E., Zese, R. and Cota, G. 2016. Probabilistic logic programming on the web. Software: Practice and Experience 46, 10, 13811396.Google Scholar
Riguzzi, F. and Swift, T. 2013. Well-definedness and efficient inference for probabilistic logic programming under the distribution semantics. Theory Pract. Log. Program. 13, Special Issue 02 - 25th Annual GULP Conference (March), Cambridge University Press, 279302.Google Scholar
Rossant, C. 2013. Learning IPython for Interactive Computing and Data Visualization. Packt Publishing Ltd., Birmingham, UK.Google Scholar
Sato, T. 1995. A statistical learning method for logic programs with distribution semantics. In 12th International Conference on Logic Programming, Sterling, L., Ed. MIT Press, Cambridge, MA, 715729.Google Scholar
Sergot, M. J., Sadri, F., Kowalski, R. A., Kriwaczek, F., Hammond, P. and Cory, H. T. 1986. The British Nationality Act as a logic program. Communications of the ACM 29, 5, 370386.CrossRefGoogle Scholar
Srinivasan, A., Muggleton, S., Sternberg, M. J. E. and King, R. D. 1996. Theories for mutagenicity: A study in first-order and feature-based induction. Artificial Intelligence 85, 1–2, 277299.Google Scholar
Vennekens, J., Verbaeten, S. and Bruynooghe, M. 2004. Logic programs with annotated disjunctions. In Logic Programming: 20th International Conference, ICLP 2004, Saint-Malo, France, 6–10 Sept. 2004. Proceedings, Demoen, B. and Lifschitz, V., Eds. LNCS, vol. 3132. Springer, Berlin, Heidelberg, Germany, 431445.Google Scholar
Wielemaker, J. and Anjewierden, A. 2007. PlDoc: Wiki style literate programming for Prolog. In Proceedings of the 17th Workshop on Logic-Based Methods in Programming Environments, Hill, P. and Vanhoof, W., Eds. Cornell University Library, Ithaca, NY, 1630.Google Scholar
Wielemaker, J., Huang, Z. and van der Meij, L. 2008. SWI-prolog and the web. TPLP 8, 3, 363392.Google Scholar