This shows you the differences between two versions of the page.
docs:loki-about [2017/09/19 14:31] |
docs:loki-about [2022/03/23 16:59] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Loki - Logic in wiki ====== | ||
+ | The main apparent limitation of existing semantic wikis is the lack of expressive knowledge representation mechanism. Building a knowledge base with a semantic wiki becomes complicated because of its collective nature, where number of users collaborate in the knowledge engineering process. A need for knowledge evaluation and analysis facilities become clear. | ||
+ | |||
+ | ===== Loki Proposal ===== | ||
+ | |||
+ | Logic-based Wiki, or Loki for short, uses the logic programming paradigm to represent knowledge in the wiki, including semantic annotations and rules. The main design principles are as follows: | ||
+ | * provide an expressive underlying logical representation for semantic annotations and rules, | ||
+ | * allow for strong reasoning support in the wiki, | ||
+ | * preserve backward compatibility with existing wikis, namely SMW. | ||
+ | The design has been based on the use of the Prolog *) programming language. | ||
+ | |||
+ | |||
+ | *) //Prolog is an expressive logic programming language. The Prolog system uses a knowledge base to answer queries. From a logical point of view, the knowledge base is composed of Horn clauses and a goal. In Prolog two basic forms of statements are possible: facts and rules. While the default inference strategy is backward-chaining it is trivial to built custom meta-interpreters implementing any inference strategy. Although Prolog has been traditionally related to Artificial Intelligence, | ||
+ | |||
+ | ===== SMW Support in Loki ===== | ||
+ | |||
+ | {{ .: | ||
+ | |||
+ | There are three main methods of semantic annotations used in [[http:// | ||
+ | |||
+ | * **categories** - a simple form of annotation that allows users to classify pages. To state that article (Wiki page) belongs to the Category book one has to write ''< | ||
+ | * **relations** - there is a possibility to describe relationships between two Wiki pages by assigning annotations to existing links. For example there is a relation author between the "Call of Cthulhu" | ||
+ | * **attributes** - allow to specify relationships of Wiki pages to things that are not Wiki pages. For example, one can state that a book has been published in year 2009 by writing ''< | ||
+ | |||
+ | Thanks to semantic annotations, | ||
+ | <code loki> | ||
+ | The query functionality can be used to embed dynamic content into pages, which is a major advantage over traditional wikis. | ||
+ | |||
+ | Loki allows to describe categories, relations and attributes the same way as in SMW. They are represented by appropriate Prolog terms. Technically, | ||
+ | |||
+ | <code loki> | ||
+ | wiki_category(' | ||
+ | |||
+ | **Author**: [[author:: | ||
+ | wiki_relation(' | ||
+ | |||
+ | **Date**: | ||
+ | wiki_attribute(' | ||
+ | |||
+ | ===== Semantic Web standards support ===== | ||
+ | |||
+ | ==== RDF/S, OWL and SPARQL support ==== | ||
+ | |||
+ | RDF annotations can be embedded directly in the XML serialization. They are parsed by the SWI-Prolog '' | ||
+ | |||
+ | <code prolog> | ||
+ | |||
+ | RDFS is also supported by the '' | ||
+ | |||
+ | {{ .: | ||
+ | |||
+ | Within the wikitext a SPARQL query (SELECT, ASK or DESCRIBE) may be posed. The query scope is the whole wiki system. SPARQL queries are handled by the '' | ||
+ | |||
+ | ==== RDF/XML export ==== | ||
+ | |||
+ | {{.: | ||
+ | |||
+ | Semantic information gathered on the Loki pages may be exported to the RDF/XML format. Metadate from " | ||
+ | |||
+ | On each wiki page there is a button " | ||
+ | |||
+ | Categories are exported as '' | ||
+ | |||
+ | ===== Prolog Knowledge Representation and Reasoning ===== | ||
+ | |||
+ | Loki can directly interpret the SMW syntax. Moreover, it allows for embedding any Prolog code, providing more expressive and flexible knowledge. To do so, a special markup is used, as shown below: | ||
+ | |||
+ | <code prolog>< | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | This simple statement adds two facts to the knowledge base. The plugin invocation is performed using the predefined syntax. | ||
+ | To specify the goal (query) for the interpreter the following syntax is used: | ||
+ | |||
+ | <code prolog>< | ||
+ | |||
+ | It is possible to combine these two, as follows: | ||
+ | |||
+ | <code prolog>< | ||
+ | country(france). | ||
+ | country(spain). | ||
+ | </ | ||
+ | |||
+ | It is possible to specify a given scope of the query (in terms of wiki namespaces): | ||
+ | |||
+ | <code prolog>< | ||
+ | scope=" | ||
+ | </ | ||
+ | |||
+ | Thanks to the Prolog engine available in the wiki, the knowledge representation is flexible and the inference options are very rich. Prolog uses backwards chaining with program clauses. However, it is very easy to implement meta-interpreters for forward chaining. | ||
+ | |||
+ | A simple clause finding recently created pages might be as follows: | ||
+ | |||
+ | <code prolog> | ||
+ | wiki_attribute(Page,' | ||
+ | I is Today - D, | ||
+ | I < 7.</ | ||
+ | |||
+ | Compound queries can also be created easily and executed as Prolog predicates. | ||
+ | |||
+ | ===== Rule-based Reasoning ===== | ||
+ | |||
+ | An optional decision rule layer is also considered with the use of the [[http:// | ||
+ | |||
+ | HeKatE RunTime (HeaRT) is a dedicated inference engine for the XTT2 rule bases. The engine is highly modularized. It supports four types of inference process, Data and Goal Driven, Fixed Order, and Token Driven. The engine is implemented in Prolog, using the SWI-Prolog stack. | ||
+ | |||
+ | Embedding HeaRT in Loki is currently in an experimental phase and is not provided with the current release. | ||
+ | |||
+ | ===== Architecture ===== | ||
+ | |||
+ | {{ .: | ||
+ | |||
+ | The wikitext from the regular wiki contains basic semantic annotations as in SMW. Additionally it contains Prolog code and HMR rules. These are combined into a Loki knowledge base. | ||
+ | |||
+ | The knowledge base may be queried using both generic Prolog queries, as well as SPARQL. Reasoning is done either by a regular Prolog engine or by the dedicated HeaRT engine. | ||
+ | |||
+ | ===== Implementation ===== | ||
+ | |||
+ | An implementation of the Loki architecture has been developed. The main goal of the system design is to deliver a generic and flexible solution. | ||
+ | |||
+ | There are tens of wiki engines available. Most of them are similar w.r.t to main concepts and features. However, there are number of differences when it comes to the wikitext syntax, implementation and runtime environment, | ||
+ | |||
+ | DokuWiki is designed to be portable, easy to use and set up. Like number of other solutions DokuWiki is based on PHP. However, it does not require any relational database back-end. It allows for image embedding, and file upload and download. Pages can be arranged into namespaces which act as a tree-like hierarchy similar to directory structure. The templates mechanism provides an easy way to change the presentation layer of the wiki. Modularized architecture of DokuWiki allows the user to extend it with plugins which provide additional syntax and functionality. A large number of plugins for DokuWiki is available. | ||
+ | |||
+ | DokuWiki provides a flexible plugin system, providing several kinds of plugins. These include: | ||
+ | |||
+ | * //Syntax Plugins//, extending the wikitext syntax, | ||
+ | * //Action Plugins//, redefining selected core wiki operations, (e.g. saving wikipages), and | ||
+ | * //Renderer Plugins//, allowing to create new export modes (possibly replacing the standard XHTML renderer) | ||
+ | |||
+ | {{ .: | ||
+ | |||
+ | The current version of Loki implements both the Syntax and Renderer functionality. Text-based wikipages are fed to a lexical analyzer (Lexer) which identifies the special wiki markup. The standard DokuWiki markup is extended by a special markup that contains Prolog clauses. The stream of tokens is then passed to the Helper that transforms it to special renderer instructions that are parsed by the Parser. The final stage is the Renderer, responsible for creating a client-visible output (e.g. XHTML). | ||
+ | |||
+ | The detailed functionality of the Loki Syntax Plugin includes parsing the Prolog code embedded in the wikitext, and generating the knowledge base composed of files containing the Prolog code, where each wikipage has a corresponding file in the knowledge base. The PlWiki Renderer plugin is responsible for executing the Prolog interpreter with a given goal, and rendering the results via the standard DokuWiki mechanism. | ||
+ | |||
+ | ===== What's next? ===== | ||
+ | |||
+ | If you are interested in Loki, you can [[downloads: | ||
+ | |||
+ | If you do not want to install it, you can see [[cases: |