Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
The Prolog plugin is a syntax plugin. It allows to embed a Prolog code inside the page. After saving the page, the Prolog code is interpreted by a Prolog interpreter and the output is displayed in the rendered page.
The destiny of the prolog plugin is to create a Rule-based System for Groupware. With this system DokuWiki can be used as Semantic Wiki. By using Prolog facts and rules, the user can easily annotate and process the information on DokuWiki pages.
Basic usage:
<prolog> %some Prolog code, i.e.: :-write('Hi, I'm Prolog Plugin'). </prolog>
The use of the Prolog Plugin with Attribute Options:
<prolog options(debug,files,source)> %Some Prolog Code, i.e.: :-write('This is example with Attribute Options'). </prolog>
The options are displayed in the same order as they are put in the attribute.
Meaning of the values | |
---|---|
debug | displays the error pipe from the Prolog interpreter |
files | displays the list of files from which the Prolog code is included |
source | displays the input pipe from the Prolog interpreter |
The Attribute Include is used to include the Prolog code from other pages in DokuWiki. The included code is added at the beginning, before the Prolog Plugin code. The attribute accepts many values presented in following table.
The use of the Prolog Plugin with Attribute Include:
<prolog include(namespace:page,namespace:*,namespace:**)> %Some Prolog Code, i.e.: :-write('This is an example with Attribute Include'). </prolog>
Meaning of the values | |
---|---|
namespace:page | includes all Prolog codes from Prolog plugins from the page namespace:page |
namespace:× | includes all Prolog codes from Prolog plugins from all pages in namespace |
namespace:×× | includes all Prolog codes from Prolog plugins from all pages in namespace and its subnamespaces (recursively) |
Attribute MaxRunTime allows to set the maximum execution time for the Prolog interpretation process in seconds (value integer). The maximum allowed value is 5 sec. The minimum value is 1 sec. The default value is 5 sec.
The use of the Prolog Plugin with Attribute MaxRunTime:
<prolog maxruntime(3)> %infinity loop: go :- go. :-go. </prolog>
Input (with embed graphviz plugin):
<prolog> parent(jan,marek). parent(jan,piotr). parent(jan,maria). parent(jan,monika). parent(marek,joanna). parent(marek,beata). parent(marek,anna). parent(piotr,grzegorz). parent(piotr,marta). parent(piotr,magdalena). parent(maria,konrad). parent(maria,katarzyna). parent(grzegorz,sabina). parent(marta,malgorzata). parent(marta,marzena). parent(marta,wojciech). parent(magdalena,krzysztof). childs(X) :- parent(X,Y), write(X), write('->'), write(Y), write(';'), childs(Y), fail. :- write('<graphviz>digraph {'). :-childs(jan). :- write('} </graphviz>'). </prolog>
Output: