Prolog Server Pages Extensible Architecture: Providing web interface for Prolog applications

Abstract. The expressive power of Prolog enables its use as a general programming language. However, in the case of applications with web interfaces, the console-oriented, question–answer nature of the language is a considerable drawback. Even though the series of questions and answers may be embedded in a series of HTTP requests and responses, this approach, while acceptable for simpler cases, does not integrate into the web user interface model. First, the paper provides an overview of Prolog language extensions facilitating web programming available at the user's disposal, in particular, the PiLLoW library and foreign language interfaces. Based on these, it sketches a two-layered system architecture that allows constructing complex applications. On one hand, the architecture gives support to access HTTP in a transparent manner integrated into the language, to preserve state between requests, to serve concurrent requests efficiently. On the other hand, the architecture means an extensible template technology with an expression language and structured JSP-like formalism, which encourages the separation of view and business logic. It aims to make it possible to implement applications with web interfaces purely in Prolog, thereby making it unnecessary to embed the application into a system architecture with support for the web. The HTTP protocol and low-level communication is hidden from the programmer by Prolog Web Container, which connects to the web server. It provides an environment for executing user programs, marshals request handling, preserving state between requests and load balancing, thereby giving background support for the Prolog Server Pages technology. Prolog Server Pages, a simple yet extensible structural mechanism, makes it possible to unambiguously separate view and logic. The paper, utilizing its multi-threading capabilities and its built-in low-level external data access support, concludes with a reference implementation in SWI-Prolog, which realizes the presented system architecture. A sample application is provided for demonstration.

Published in

  • Hungarian Student Conference, Budapest University of Technology and Economics, Faculty of Electrical Engineering and Information Technology, October 19, 2007, Category Software, Awarded 1st prize PDF
  • 23rd International Conference on Logic Programming, Porto (Portugal)
    Poster PDF Application paper PDF


Availability. The project is developed in accordance with the General Public License (GPL) and is available at SourceForge.