This shows you the differences between two versions of the page.
docs:plwiki1api [2017/09/19 14:31] |
docs:plwiki1api [2022/03/23 16:59] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ~~NOCACHE~~ | ||
+ | ====== PlWiki 1.0 - Plugin API ====== | ||
+ | |||
+ | [[.: | ||
+ | |||
+ | |||
+ | **IMPORTANT: | ||
+ | |||
+ | This code should be placed on every page using PlWiki plugin: | ||
+ | < | ||
+ | |||
+ | ===== Prolog Code in Loki ===== | ||
+ | |||
+ | The simplest use case. Without cache. Only process knowledge between " | ||
+ | |||
+ | <code loki> | ||
+ | <pl goal=" | ||
+ | woman(kate). | ||
+ | man(john). | ||
+ | </pl> | ||
+ | </ | ||
+ | |||
+ | __Result__: | ||
+ | <pl goal=" | ||
+ | woman(kate). | ||
+ | man(john). | ||
+ | </pl> | ||
+ | |||
+ | |||
+ | More interesting use case: adding knowledge to the page: | ||
+ | |||
+ | <code loki> | ||
+ | <pl cache=" | ||
+ | man(jack). | ||
+ | man(jim). | ||
+ | </pl> | ||
+ | </ | ||
+ | |||
+ | <pl cache=" | ||
+ | man(jack). | ||
+ | man(jim). | ||
+ | </pl> | ||
+ | |||
+ | |||
+ | Now when we have prolog code associated with DokuWiki page, we can " | ||
+ | |||
+ | <code loki> | ||
+ | <pl goal=" | ||
+ | % | ||
+ | % Prolog code may be placed here but it is not necessairly. | ||
+ | % | ||
+ | </pl> | ||
+ | </ | ||
+ | |||
+ | __Result__: | ||
+ | <pl goal=" | ||
+ | % | ||
+ | % Prolog code may be placed here but it is not necessarily. | ||
+ | % | ||
+ | </pl> | ||
+ | |||
+ | ===== Prolog interface ===== | ||
+ | |||
+ | Loki plugin also contains loki.pl prolog script, which allows to query knowledge gathered in Loki from Prolog. | ||
+ | |||
+ | We can list all predicates in selected scope: | ||
+ | <code loki> | ||
+ | <pl goal=" | ||
+ | </ | ||
+ | |||
+ | __Result__: | ||
+ | <pl goal=" | ||
+ | |||
+ | |||
+ | We can also list informations about selected predicate. | ||
+ | |||
+ | <code loki> | ||
+ | <pl goal=" | ||
+ | </ | ||
+ | |||
+ | __Result__: | ||
+ | <pl goal=" | ||
+ | |||
+ | |||
+ | ===== Categories, Relations, Attributes ===== | ||
+ | [[http:// | ||
+ | |||
+ | * categories - a simple form of annotation that allows users to classify pages. To state that article (Wiki page) belongs to the category " | ||
+ | |||
+ | * relations - there is a possibility to describe relationships between two Wiki pages. For example there is a relation " | ||
+ | |||
+ | * attributes - allows to specify relationships of Wiki pages to things that are not Wiki pages. For example, one can state that Wiki page " | ||
+ | |||
+ | * In addition to this users can search for articles using a simple query language that was developed based on the known syntax of the Wiki. For example: <code smw> | ||