====== Prolog Plugin ====== ---- plugin ---- description: Prolog plugin allows to embed and interpret the Prolog code author : Paweł Kupka email : pawel.kupka@gmail.com type : syntax, action lastupdate : 2009-05-14 compatible : 2005-09-22+ depends : conflicts : similar : dokusioc tags : chart, diagram, meta, semantic downloadurl: http://sites.google.com/site/rulebasedsystemforgroupware/Home/prolog.zip?attredirects=0 ---- ===== Download and Installation ===== Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. * [[http://sites.google.com/site/rulebasedsystemforgroupware/Home/prolog.zip|prolog.zip]] ===== 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: %some Prolog code, i.e.: :-write('Hi, I'm Prolog Plugin'). ==== Attribute Options ==== The use of the Prolog Plugin with Attribute Options: %Some Prolog Code, i.e.: :-write('This is example with Attribute Options'). 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: %Some Prolog Code, i.e.: :-write('This is an example with Attribute Include'). ^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: %infinity loop: go :- go. :-go. ===== Examples ===== ==== Hello World ==== Input: :- write('Hello World!'). Output: {{http://sites.google.com/site/rulebasedsystemforgroupware/Home/przyklad_hello_world.png?attredirects=0|}} ==== Family Tree (integration with other plugins) ==== Input (with embed graphviz plugin): 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('digraph {'). :-childs(jan). :- write('} '). Output: {{http://sites.google.com/site/rulebasedsystemforgroupware/Home/przyklad_graphviz_graf.png|}}