DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:prolog

Prolog Plugin

Compatible with DokuWiki

2005-09-22+

plugin Prolog plugin allows to embed and interpret the Prolog code

Last updated on
2009-05-14
Provides
Syntax, Action

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Similar to dokusioc

Tagged with chart, diagram, meta, semantic

Download and Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

Description

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.

Requirements

  • server with PHP 5.2.2
  • OS UNIX/Linux
  • SWI-Prolog
  • DokuWiki

Features

  • interpreting the Prolog code,
  • including the Prolog code from other pages in DokuWiki,
  • displaying the information about: the list of included text files, the input pipe and errors pipe from the Prolog interpreter,
  • setting the maximum execution time for the interpretation process.

Syntax

Prolog Tag

Basic usage:

<prolog>
%some Prolog code, i.e.:

:-write('Hi, I'm Prolog Plugin').
</prolog>

Attribute Options

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

Attribute Include

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

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>

Examples

Hello World

Input:

<prolog options(debug,files,source)>
:- write('Hello World!').
</prolog>

Output:

Family Tree (integration with other plugins)

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:

plugin/prolog.txt · Last modified: 2023-10-30 22:55 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki