Extension:SemanticDummyEditor

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced.svg
SemanticDummyEditor
Release status: stable
Implementation User interface, Page action
Description Monitors changes in semantic dependencies and propagates them through null edits on the dependent pages
Author(s) Remco C. de Boer (Rcdeboertalk)
Latest version 1.0.0 (2014-06-15)
MediaWiki 1.19+
Database changes No
License MIT License
Download
Parameters
  • $wgSDERelations[]
  • $wgSDEUseJobQueue
Hooks used
ArticleSaveComplete
ArticleUndelete
Translate the SemanticDummyEditor extension if it is available at translatewiki.net
Check usage and version matrix.

The SemanticDummyEditor extension updates semantic property values that are dependent on another page's property values. With Semantic MediaWiki, changes in semantic property values are usually immediately visible in query results on other pages. However, when such query results are reused again in (the inference of) other semantic property values, the user is required to manually edit and save each dependent page to set the newly computed result. SemanticDummyEditor monitors dependency relations and automatically performs such null edits, so that changes to semantic property values are propagated to dependent properties.

Example[edit]

Suppose we are using the following properties in a Semantic MediaWiki:

  • has child
  • has grandchild

and that we use them through the following Template:Parent (for the sake of simplicity, we limit this example to one child and one grandchild only):

Child: [[has child::{{{Child|}}}]], grandchild: [[has grandchild::{{#show: {{{Child|}}}|?has child}}]].

We add the following pages:

Jane
{{Parent|Child=Mary}}
Mary
{{Parent|Child=Mel}}

so that Jane is the grandparent of Mel. The properties Jane has child Mary and Mary has child Mel have all correctly been set. However, Jane has grandchild Mel is not registered until a (null) edit is performed on Jane's page. The SemanticDummyEditor can take care of this.

Installation[edit]

Note Note: This extension requires Semantic MediaWiki to be installed first.

  • Download and place the file(s) in a directory called SemanticDummyEditor in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/SemanticDummyEditor/SemanticDummyEditor.php";
    
  • Configure as required
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration[edit]

The SemanticDummyEditor extension takes two parameters that can be configured as follows:

$wgSDERelations[edit]

This is an array that contains the relations (page dependencies) that SemanticDummyEditor should monitor. To configure SemanticDummyEditor for the parent/child-example above, the following line should be added to LocalSettings.php:

$wgSDERelations[] = 'Has child';

This tells SemanticDummyEditor to monitor the Has child relation. When a page has been edited, any page that has a Has child relation to that page receives a null edit (in the example above: when Mary's page has been edited, Jane's page receives a null edit). Null edits follow the whole dependency chain (in the example above: when Mel's page has been edited, Mary's page receives a null edit and consequently Jane's page receives a null edit). Circular dependencies are detected so that loops are prevented.

$wgSDEUseJobQueue[edit]

In some cases, the number of dependencies or the length of dependency chains could lead to timeouts. To prevent this, it is possible to push the execution of null edits to the job queue instead of executing them in a single transaction with the user's save action. To do so, add the following line to LocalSettings.php:

$wgSDEUseJobQueue = true;