Skip to main content Accesibility Help

SWI-Prolog and the web


Prolog is an excellent tool for representing and manipulating data written in formal languages as well as natural language. Its safe semantics and automatic memory management make it a prime candidate for programming robust Web services. Although Prolog is commonly seen as a component in a Web application that is either embedded or communicates using a proprietary protocol, we propose an architecture where Prolog communicates to other components in a Web application using the standard HTTP protocol. By avoiding embedding in external Web servers, development and deployment become much easier. To support this architecture, in addition to the transfer protocol, we must also support parsing, representing and generating the key Web document types such as HTML, XML and RDF. This article motivates the design decisions in the libraries and extensions to Prolog for handling Web documents and protocols. The design has been guided by the requirement to handle large documents efficiently. The described libraries support a wide range of Web applications ranging from HTML and XML documents to Semantic Web RDF processing. The benefits of using Prolog for Web-related tasks are illustrated using three case studies.

Hide All
Bechhofer, S., Möller, R. and Crowther, P. 2003. The DIG description logic interface. In International Workshop on Description Logics (DL2003), Rome, vol. 81 (electronic).
Broekstra, J., Kampman, A. and van Harmelen, F. 2002. Sesame: An architecture for storing and querying RDF and RDF schema. In Proc. First International Semantic Web Conference ISWC 2002, Sardinia, Italy. Lecture notes on computer science, vol. 2342. Springer-Verlag, Berlin, 54–68.
Cabeza, D. and Hermenegildo, M. V. 2003. Distributed WWW programming using (ciao-) prolog and the piLLoW library. CoRR cs.DC/0312031.
Demoen, B. 2002. Dynamic Attributes, Their hProlog Implementation, and a First Evaluation. Report CW 350. Department of Computer Science, K.U. Leuven, Leuven, Belgium. URL:
Deransart, P., Ed-Dbali, A. and Cervoni, L. 1996. Prolog: The Standard. Springer-Verlag, New York.
Gras, D. C. and Hermenegildo, M. V. 2001. Distributed WWW programming using (ciao-) prolog and the piLLoW library. Theory and Practice of Logic Programming 1, 3, 251282.
Haarslev, V. and Möller, R. 2001. Description of the racer system and its applications. In Proceedings of the International Workshop on Description Logics (DL-2001), Stanford University, CA, 132–141.
Hearst, M., English, J., Sinha, R., Swearingen, K. and Yee, K. 2002. Finding the flow in Web site search. Communications of the ACM 45, 9 (September), 4249.
Horrocks, I. 1999. Fact and ifact. In Proceedings of the International Workshop on Description Logics (DL'99), Sweden, 133–135.
Huang, Z. and Stuckenschmidt, H. 2005. Reasoning with multiversion ontologies: A temporal logic approach. In International Semantic Web Conference, Gil, Y., Motta, E., Benjamins, V. R., and Musen, M. A., Eds. Lecture Notes in Computer Science, vol. 3729. Springer, 398–412.
Huang, Z., van Harmelen, F. and ten Teije, A. 2005. Reasoning with inconsistent ontologies. In Proceedings of the International Joint Conference on Artificial Intelligence – IJCAI'05. Kaelbling, L. P. and Saffiotti, A., Eds. Professional Book Center, Edinburgh, Scotland, 454459.
Huang, Z. and Visser, C. 2004. Extended DIG Description Logic Interface Support for PROLOG. Deliverable D3.4.1.2. SEKT.
Leth, L., Bonnet, P., Bressan, S. and Thomsen, B. 1996. Towards ECLiPSe agents on the internet. In Proceedings of the 1st Workshop on Logic Programming Tools for INTERNET Applications, Bonn, Germany.
Mäkelä, E., Hyvönen, E., Saarela, S. and Viljanen, K. 2004. Ontoviews – a tool for creating Semantic Web portals. In International Semantic Web Conference, McIlraith, S. A., Plexousakis, D. and van Harmelen, F., Eds. Lecture Notes in Computer Science, vol. 3298. Springer, New York, 797811.
Miller, G. 1995. WordNet: A lexical database for english. Communication of the ACM 38, 11 (November), 3941.
Philips, L. 2000. The double metaphone search algorithm. C/C++ Users Journal 18, 6 (June), 38–43.
Ramakrishnan, I. V., Rao, P., Sagonas, K., Swift, T. and Warren, D. S. 1995. Efficient tabling mechanisms for logic programs. In Proceedings of the 12th International Conference on Logic Programming, Sterling, L., Ed. MIT Press, Cambridge, MA. 697714.
Schlobach, S. and Huang, Z. 2005. Inconsistent Ontology Diagnosis: Framework and Prototype. Deliverable D3.6.1. SEKT. URL:
Szeredi, P., Molnár, K. and Scott, R. 1996. Serving multiple HTML clients from a Prolog application. In Proceedings of the 1st Workshop on Logic Programming Tools for INTERNET Applications, JICSLP'96, Bonn. URL:
van Gendt, M., Isaac, A., van der Meij, L. and Schlobach, S. 2006. Semantic web techniques for multiple views on heterogeneous collections: A case study. In Research and Advanced Technology for Digital Libraries. Lecture Notes in Computer Science, vol. 4172. Springer, Berlin, 426–437.
Wielemaker, J. 2003. Native preemptive threads in SWI-Prolog. In Practical Aspects of Declarative Languages, Palamidessi, C., Ed. Lecture Notes in Computer Science, vol. 2916. Springer-Verlag, Berlin, 331345.
Wielemaker, J. 2005. An optimised Semantic Web query language implementation in prolog. In ICLP 2005, Baggrielli, M. and Gupta, G., Eds. Lecture Notes in Computer Science, vol. 3668. Springer-Verlag, Berlin, 128142.
Wielemaker, J., Schreiber, G. and Wielinga, B. 2003. Prolog-based infrastructure for RDF: Performance and scalability. In The Semantic Web – Proceedings ISWC'03, Sanibel Island, Florida, Fensel, D., Sycara, K. and Mylopoulos, J., Eds. Lecture Notes in Computer Science, vol. 2870. Springer-Verlag, Berlin, 644658.
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