The wide diffusion of the Internet and the popularity of WWW (``World Wide Web'' [1]) protocols are effectively providing a novel platform that facilitates a new class of highly sophisticated distributed applications. Good support for network connectivity and the protocols and communication architectures of this novel platform are obviously requirements for any programming tool to be useful in this arena. However, this alone may not be enough. It seems natural that significant parts of network applications will require symbolic and numeric capabilities which are not necessarily related with distribution. Important such capabilities are, for example, high-level symbolic information processing, dealing with combinatorial problems, and natural language processing in general. Logic Programming (LP) [22, 10] and Constraint Logic Programming (CLP) systems [20, 13, 11, 24, 12] have been shown particularly successful at tackling these issues (see, for example, the proceedings of recent conferences on the ``Practical Applications of Prolog'' and ``Practical Applications of Constraint Technology''). It seems natural to study how LP/CLP technology fares in developing applications which have to operate over the Internet.
In fact, Prolog, its concurrent and constraint based extensions, and logic programming languages in general have many characteristics which appear to set them particularly well placed for making an impact on the development of practical networked applications, ranging from the simple to the quite sophisticated. Notably, LP/CLP systems share many characteristics with other recently proposed network programming tools, such as Java, including dynamic memory management, well-behaved structure and pointer manipulation, robustness, and compilation to architecture-independent bytecode. Furthermore, and unlike the scripting or application languages currently being proposed (e.g., shell scripts, Perl, Java, etc.), LP/CLP systems offer a quite unique set of additional features including dynamic databases, search facilities, grammars, sophisticated meta-programming, and well understood semantics.
In addition, most LP/CLP systems also already offer some kind of low level support for remote communication using Internet protocols. This generally involves providing a sockets (or ports) interface whereby it is possible to make remote data connections via the Internet's native protocol, TCP/IP. A few systems support higher level functionality layers on top of this interface including linda-style blackboards (e.g., SICStus Prolog [8] and &-Prolog/CIAO[17, 18, 15], BinProlog/-Prolog [29, 2], etc.) or shared variable based communication (e.g., KL1 [9], AKL [21], Oz [26], &-Prolog/CIAO [16, 4], etc.). In some cases, this functionality is provided via libraries, building on top of the basic TCP/IP primitives. This is the case, for example, of the SICStus (and CIAO) linda interface. In fact, as we have shown, shared variable based communication can also be implemented in conventional systems via library predicates, by using attributed variables [16, 4].
WWW applications generally use higher level protocols (such as HTTP or FTP) and application architectures (e.g., the cgi-bin interface) which are different from the shared variable or linda-based protocols. In this paper we study how good support for such protocols and architectures can be provided for LP/CLP systems, building on the basic, widely available TCP/IP protocols. Our aim is to discuss from a practical point of view a number of the new issues involved in writing Internet and WWW applications using LP/CLP systems, as well as the architecture of some typical applications. In the process, we will describe PiLLoW (``Programming in Logic Languages on the Web''), a public domain Internet/WWW programming library for LP/CLP systems which, we argue, significantly simplifies the process of writing such applications. PiLLoW provides facilities for generating HTML structured documents by handling them as Herbrand terms, producing HTML forms, writing form handlers, accessing and parsing WWW documents, and accessing code posted at HTTP addresses. We also describe the architecture of some relatively sophisticated application classes, using a high-level model of client-server interaction, active modules [4]. Finally we describe an architecture for automatic LP/CLP code downloading for local execution, using just the library and generic browsers.
The argument throughout the paper is that, with only very small limitations in functionality (which disappear when concurrency is added to the system, as in systems such as BinProlog/-Prolog, AKL, Oz, KL1, and &-Prolog/CIAO), it is possible to add an extremely useful Internet/WWW programming layer to any LP/CLP system without making any significant changes in the implementation. We argue that this layer can simplify the generation of applications in LP/CLP systems including active WWW pages, search tools, content analyzers, indexers, software demonstrators, collaborative work systems, MUDs and MOOs, code distributors, etc.
The PiLLoW library has been developed in the context of the &-Prolog and CIAO systems, but it has been adapted to a number of popular LP/CLP systems, supporting most of its functionality. This document can serve also as a WWW/HTML primer, containing sufficient information for developing relatively high-complexity WWW applications in Prolog and other LP and CLP languages.