User Tools

Site Tools



Start here!


Loki Semantic Wiki

BiFröST Framework

Semantic Business Platform



Other Projects


PROV plugin for DokuWiki

PROV (abbreviation from Provenance) is a W3C Standard to describe entities, activities, and people involved in producing a piece of data. Provenance description is saved in a form of an graph. Presented plugin uses PROV to describe provenance of DokuWiki pages. PROV graph is serialized into the form of OWL2 Ontology using Turtle syntax.

If you only want to know how to start with PROV plugin, read the How to use PROV plugin section. Other sections will give you a brief overview of PROV Standard and mechanics behind the PROV plugin.

PROV W3C Standard

PROV Model is based on three main concepts:

  • Entities: physical, digital, conceptual, or other kinds of thing. In DokuWiki entities are: wiki pages and resources used during page creation and edition.
  • Activities: dynamic aspects of the world, such as actions, processes, etc. In DokuWiki there are three main activities: page creation, edition and deletion.
  • Agents: a person, a piece of software, an inanimate object, an organization, or other entities that may be responsible for activities. In DokuWiki agents are wiki users.

They are connected with proper relations defined in standard, such as these on the figure.

Comprehensive description of PROV Standard is placed on W3C web page: PROV Model Primer.

Due to standard notation, there is also possibility to provide standard ways to access and query PROV files (e.g. using SPARQL Query Language for PROV files serialized to OWL2). W3C prepared a note with such recommendations: PROV-AQ: Provenance Access and Query.


Plugin was developed as a part of the PhD dissertation: Collaborative Knowledge Engineering (CKE). Methods and Tools for System Design. Primary goal of the plugin was to provide the graph-based changelog that describes how members of the group involved in the knowledge engineering process are interacting with each other and how the process of developing knowledge in Semantic Wiki (Loki) looks like. Thanks to be grounded in RDF model, it can be further queried to select interesting information. This changelog is one of the proposed methods for CKE support – for comprehensive description see Krzysztof Kutt's PhD.

As a result, the plugin uses only selected constructs from PROV - not the whole power of this standard. If you have an idea that more PROV constructs will be useful in the plugin contact us! Together we can do more!

How to use PROV plugin

To use PROV plugin simply download it and install.

PROV fields will be available in every page edition form:

It consists of four main components:

  • Change description (blue frame): one can select the values that describe the actual change (what was done) and its goal (why it was done) in the best way or write down own description using “Other…” option.
  • URIs/URLs for used resources (put one URI in one line) field (red frame on figure) – here all URIs goes; one URI in one line; you can simple write down URIs for resources you have used (e.g. books URIs or URLs for web pages) or…
  • if your edition is based on other pages from wiki you can simply select them (and double-click on them) from the second field (yellow frame); this page will appear in the left field with the lokipage: prefix
  • if there are a lot of pages in your wiki, you can use a filter field.
  • PROV plugin uses also standard DokuWiki 'Edit summary' field (black frame) for comments in the PROV file.

Final list of URIs can look like this (two external URIs and two internal URIs with lokipage: prefix):

PROV files are saved in $DOKUWIKI_HOME/data/prov directory. There is a separate PROV file for each DokuWiki page.

How the PROV plugin works

PROV plugin works during page saving. There are three cases: page creation, edition and deletion. PROV plugin simply takes values from user (via fields in page edition form) and use them in specific places to generate PROV file according to the prepared schema:

@prefix rdf: <> .
@prefix rdfs: <> .
@prefix prov: <> .
@prefix dc: <> .
@prefix change: <> .
@prefix loki: <> .
@prefix lokipage: <{$wiki_address}> .
@prefix lokievent: <{$wiki_address}special:lokievent#> .
@prefix lokiuser: <{$wiki_address}user:> .

### Page creation:

lokipage:{$page} a prov:Entity .
lokipage:{$page}_{$newRev} a prov:Entity ;
    prov:specializationOf lokipage:{$page} ;
    prov:wasGeneratedBy lokievent:created_{$page}_{$newRev} .
lokievent:created_{$page}_{$newRev} a prov:Activity .

### Page edition:

lokipage:{$page}_{$newRev} a prov:Entity ;
    prov:specializationOf lokipage:{$page} ;
    prov:wasRevisionOf lokipage:{$page}_{$oldRev} ;
    prov:wasGeneratedBy lokievent:edited_{$page}_{$newRev} .
lokievent:edited_{$page}_{$newRev} a prov:Activity .

### Page deletion:

lokievent:deleted_{$page}_{$newRev} a prov:Activity .

### Common to all events:

    prov:wasAssociatedWith lokiuser:{$author} ;
    dc:description "{$comment}"^^xsd:string ;
    loki:whatWasDone change:{$change} ;      ## if option from ontology is selected
    loki:whyWasDone [ a change:OtherGoal ;   ## if own description is provided
                      change:goalDescription "{$goalDescription}"^^xsd:string ] ;
    prov:used {$link1} , {$link2} ;
    loki:classesChange "{$val}"^^xsd:integer ;
    loki:relationsChange "{$val}"^^xsd:integer ;
    loki:attributesChange "{$val}"^^xsd:integer ;
    loki:statementsChange "{$val}"^^xsd:integer ;
    loki:testsPassed [ loki:valueBefore "{$metric_val}"^^xsd:integer ;
                       loki:valueAfter "{$metric_val}"^^xsd:integer ] ;
    loki:attributeRichness [ loki:valueBefore "{$metric_val}"^^xsd:decimal ;
                             loki:valueAfter "{$metric_val}"^^xsd:decimal ] ;
    loki:averagePopulation [ loki:valueBefore "{$metric_val}"^^xsd:decimal ;
                             loki:valueAfter "{$metric_val}"^^xsd:decimal ] ;
    loki:sizeOfVocabulary [ loki:valueBefore "{$metric_val}"^^xsd:decimal ;
                            loki:valueAfter "{$metric_val}"^^xsd:decimal ] ;
    loki:edgeNodeRatio [ loki:valueBefore "{$metric_val}"^^xsd:decimal ;
                         loki:valueAfter "{$metric_val}"^^xsd:decimal ] ;
    loki:weightedAverage "{$weightedAverage_val}"^^xsd:decimal ;
    loki:evaluatedByUser [ loki:note "{$note}"^^xsd:integer ;
                           loki:evaluator lokiuser:{$evaluator} ] .

  * for guests loki:special:guest is used instead of lokiuser:{$autor}
  * page revisions ($oldRev and $newRev) are timestamps of specified pages

Note that in PROV there are only connections between different revisions, users and used resources. If you want to compare actual text of different versions of the page, you need standard DokuWiki diff.

docs/prov.txt · Last modified: 2022/03/23 16:59 (external edit)