Inserting Prolog Statements

Inserting Prolog Statements

This file explains how to insert arbitrary Prolog-statements into HTML-code. To understand this explication, you have to have some knowledge on programming Prolog.


The entire SiteC-system is based on its ability to execute Prolog-statements, emedded into HTML-code. For this purpose, a new HTML-tag "PRO" was introduced:
<PRO ACTION="some arbitrary Prolog statement">

Alternatively, if you have enabled the preprocessor feature, you can insert the following _text_ into your HTML-source:

[$ some arbitrary Prolog statement]

This text is converted by the preprocessor into the <PRO> notation.


During the execution of the Prolog-statements, a number of attributes (variables) are available that correspond to the content of the <HEAD> section of the corresponding HTML-file and to other properties derived from the environment of the HTML-file.

These variables can be referenced by expression of the form:

A typical example is to insert the creation date at the end of a HTML-file. The following code is extracted from the SiteC design template:
<PRO action="insert_var($month)">/
<PRO action="insert_var($day)">/
<PRO action="insert_var($year)">
by SiteC V0.2.2.
The output will look like this:
Genenerated 5/3/1998 by SiteC V0.2.2.

Properties of Other HTML-Files

While the attributes in the section above correspond to the state of the HTML-file that is processed, it is also possible to refer to state and properties of other HTML-files by means of the built in database that is based on the Description Logic formalism. This formalism is particularly suitable to select objects (HTML-files) by means of properties.

Prolog Dialect

The statements within the <PRO> tags are parsed using a standard Prolog-parser and passed to the underlying Prolog-system for execution.

This mechanism may cause incompatibilities when switching to another host-system in furture. For this reason, we strongly suggest to use only the commands defined in the "Edinburgh standard".


This one is just necessary! Please note the usage of single quotes with the double quotes.
<PRO ACTION="write('Hello World')">

As an alternative, it is possible to include double quotes into single quotes. However, it is not possible to include double quotes within doubles nor single within singles. Future versions will include a quoting mechanism.
<PRO ACTION='write("Hello World")'>

You can write compund Prolog statements the usual way:
<PRO ACTION="member(X,[1,2,3,4]), write(X), nl">

If you want to add more complicated functionality, it is advisable to create and include this code in the Prolog-source of the file "". In this file you can find examples on how to use the Description Logic database.

Predefined Commands

However, as programming Prolog and understanding Description Logics is not a widespread capability, the most frequently used commands are predefined and can be used without knowledge about these fields.

It is likely that the set of predefined commands will expand to cover more and more functions.