Table of Contents

PlWiki 1.0 - Plugin API

Examples available here

IMPORTANT:

This code should be placed on every page using PlWiki plugin:

 ~~NOCACHE~~ 

Prolog Code in Loki

The simplest use case. Without cache. Only process knowledge between “pl” tags.

<pl goal="woman(X),write(X),nl,fail">
woman(kate).
man(john).
</pl>

Result:
kate

More interesting use case: adding knowledge to the page:

<pl cache="true">
man(jack).
man(jim).
</pl>

Now when we have prolog code associated with DokuWiki page, we can “query” selected scope or Wiki page. Scope accepts POSIX Regular Expressions.

<pl goal="man(X),write(X),nl,fail"  scope="docs:plwiki1ex" >
%
% Prolog code may be placed here but it is not necessairly.
%
</pl>

Result:
jack
jim

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:

<pl goal="consult('lib/plugins/loki/loki.pl'),wikiconsult('docs/plwiki1api'),list."></pl>

Result:
man
wiki_header
wiki_internallink
woman

We can also list informations about selected predicate.

<pl goal="consult('lib/plugins/loki/loki.pl'),wikiconsult('docs/plwiki1api'),list(man)."></pl>

Result:
man(john).
man(jack).
man(jim).

Categories, Relations, Attributes

Semantic MediaWiki syntax is also supported, there are some methods of semantic annotation: