Extension:SemanticHistory

What This Extension Does
SemanticHistory is an extension to be used with Semantic Mediawiki, that tracks revisions of a wiki and enables its translation into semantic forms so that it can be better queried and represented. The current version offers the follows functionalities:
 * Capturing edit revisions (editing, deletion, undeletion and moving) and representing them as SMW scripts (via additional templates)
 * Enabling parsing of editing summaries into SMW scripts.

How It Works



 * 1) A user (potentially a software agent) makes some edit actions to a wiki page. Typical edit actions include create new pages, modify a existing page, move a page and delete/undelete a page.
 * 2) The SH extension monitors user actions and captures various types of revision changes happened on the wiki. At this step, the SH extension will
 * 3) * Create a revision instance that contains basic context information of the revision, e.g., revision id, author, timestamp, page location and editing summary (in plain text). This revision instance will be stored as a hidden wiki page. For example, an editing revision with id 1234 may be stored as a page rev:1234, where rev: is a name space for all revision pages and can be protected according the wiki's access control policy.
 * 4) * Compare triple changes before and after the editing, identify all triple additions and deletions during the process. Each triple is identified by a unique id and stored as a hidden wiki page along with its addition and deletion history.
 * 5) The output of this step is a set of wiki pages (i.e., revision pages and triple pages), marked up using a set of templates (details given below).
 * 6) Generate triple representation for the revision history via a set of predefined templates. For example, the template SH_Triple will preform a reification of a triple into three triples, such as  on a page triple:123 will generate : triple:123 subject   s   triple:123 predicate p   triple:123 object    o Other type of information, such as timestamp of a revision or an deletion revision associated with a triple, will be triplified in the similar fashion.
 * 7) Add the triplified revision history back to the triple store of the SMW by SH templates.
 * 8) Enable applications to query the SMW triple store about the semantic representation of the revision history for various purposes, e.g., statistics, visualization, temporal inference and explanation (please see the Demo section).

Templates and Customization
The following constants in "SemanticHistory_Setting.php" can be customized

Namespaces:
 * NS_HISTORY: the numeric value of a namespace to store triple history (default 200)
 * PREFIX_HISTORY: the string prefix of the 'NS_HISTORY' namespace (default 'his')
 * NS_REVISION: the numeric value of a namespace to store revision actions (default 202)
 * PREFIX_REVISION: he string prefix of the 'NS_REVISION' namespace (default 'rev')

Template names
 * HISTORY_OBSOLETE: for "obsolete" flag of a triple (default 'SH_Obsolete'); Example
 * HISTORY_REV: for revision basic information (default 'SH_Rev'); Example
 * HISTORY_TRIPLE: for triple basic information (default 'SH_Triple'); Example
 * HISTORY_ADD: for adding action of a triple (default 'SH_Add'); Example
 * HISTORY_DELETE: for deletion action of a tripl (default 'SH_Delete'); Example
 * HISTORY_MINOR: for "minor" flag of a revision (default 'SH_Minor'); Example
 * HISTORY_SUMMARY: for "summary" raw text of a revision (default 'SH_Summary'); Example
 * HISTORY_TEMPLATE: for used templates information of a revision (default 'SH_UseTemplate'); Example
 * HISTORY_PROPERTIES: for property annotations that may be created on a revision (default 'SH_Properties'); Example
 * HISTORY_CATEGORIES: for category annotations that may be created on a revision(default 'SH_Categories'); Example

Configuration flags and default values:
 * $wgSemanticHistoryAllowEdit = false : if common users can edit history and revision data
 * $wgSemanticHistoryAllowRead = false : if common users can read history and revision data
 * $wgSemanticHistoryAnalyzeTemplate = true: if to analyze the triple-template dependency (exprimental)

Parsing "semantic" summary
The template HISTORY_SUMMARY (default 'SH_Summary') can be used to parse a raw text summary into semantic forms. One example is to enable SMW-style of editing summary (example parser). For example :

reason::data is outdated; source::CIA World Factbook; category:Fact Update; Update GDP numbers to the 2008 data

It contains three semantic annotations similar to the SMW syntax, and one non-semantic sentence explaining the change. This may be parsed into SMW scripts: reason::data is outdated source::CIA World Factbook

The non-semantic text will not be parsed and stored in the original form. By semanticizing the editing summary, we will be able to do more powerful query over the revision data. For example, to ask revisions about a country that uses some information from an almanac (CIA World Factbook is one instance of it), we use the SMW query (based an ontology used on our demo site)

Other forms of parsers may also be used, e.g., a Twitter-style syntax: one may use “#” to add tag to a summary. For instance, a sentence fact update for 2008 #gdp #infobox change maybe generate SMW annotations tag::gdptag::infobox

Demo and Examples
A demo site is at: http://tw.rpi.edu/semhis

The demo site uses a set of other MediaWiki or SMW extensions, see for details

Installation
Please use the following instructions to install this extension.

1. Install source code from the zip file, unzip and put them under "WIKI-PATH/extentions/SemanticHistory".

2. Append the following to LocalSettings.php (near the bottom) of your MediaWiki installation:

Change Log
the latest SemanticHistory has been tested on MediaWiki versions 1.15 and Semantic MediaWiki version 1.4.2. It may work with some earlier versions of MW.

History:
 * Sept 10, 2009 version 0.1 -first release