Extension:Semantic Text Annotator

From mediawiki.org
Jump to navigation Jump to search
MediaWiki extensions manual
OOjs UI icon advanced-invert.svg
Semantic Text Annotator
Release status: unmaintained
Annotate Mouseover.png
Implementation Page action , Ajax, Special page
Description Allows to add, edit and observe semantic annotations to texts
Author(s) Dominik Martin, Benjamin Hosenfeld, Tobias Weller (Tobias Wellertalk)
Maintainer(s) User:Tobias Wellertalk
Latest version 0.7.2 (2017-06-08)
MediaWiki 1.25+
Database changes No
License MIT License
Example Example

Check usage and version matrix.

Semantic Text Annotator is an extension for Semantic MediaWiki developed within the research project Abitur- Abiturprüfungspraxis und Abituraufsatz 1882-1972 that allows to add, edit and query text annotations in your wiki. It requires Semantic MediaWiki and Page Forms. The extension is based on the JavaScript library annotator.js.


The Semantic MediaWiki extension and Page Forms extension must be installed in order to use this extension.
  • Download, extract and place the file(s) in a directory called SemanticTextAnnotator in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'SemanticTextAnnotator' );
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension(). If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'SemanticTextAnnotator' );, you need to use:

require_once "$IP/extensions/SemanticTextAnnotator/SemanticTextAnnotator.php";


In the following is the usage and functionality of Semantic Text Annotator described. It starts with establishing annotation Categories, creating new annotations, edit and delete annotations and repair annotations via a repair mode.

Link PageForms to Annotations[edit]

Semantic Text Annotator has a special page which allows to Link existing Page Forms to Annotation Categories. Thus, users are very flexible in providing meta-information about an annotation, based on a Page Form. The Special Page is currently structured under the section Annotations

The Semantic Text Annotator is grouped under the section Annotations. This image shows a former version

On the Special Page, users can add and delete linked Forms to Annotation Categories, as well as colours. The currently supported colours are red, green, yellow, blue and grey. The linked Page Forms to the Annotation Category defines the called Page Form for entering meta-information about the text annotation.

Special Page of the Semantic Text Annotator that allows for linking Page Forms to Annotation Cateogries

After linking special Pages to the categories, one can use them to annotate texts.

Create Annotation[edit]

On a Main namespace wiki page (Namespace: 0) appears on the navigation bar an additional icon, called Annotate. By clicking on this button, the Annotation Mode starts.

Annotation Button on navigation bar (marked with red circle)

The Semantic Text Annotator Extension loads all dependencies and displays a sidebar, which lists all annotations for this wiki page which were entered before. Existing annotations are highlighted in the text.

Start of Annotation Mode. Currently, no text is annotated

To create an annotation, mark any text phrase with the mouse. Afterwards, a button is displayed that allows to create a new annotation for the marked area.

Create annotation by marking a text and click on the button

Afterwards, a small window appears that allows to add a comment (optional) for this marked area, as well as selecting an annotation category. The categories were created and linked to the corresponding Page Forms on the Special Page (see above).

Add an optional Comment and select a category for this annotation

After clicking on create, a Popup is shown that allows to enter more meta-information about the marked text via Page Forms. The Page Form that appears is the corresponding one that was selected on the small window or rather linked on the special page.

Page Form enables users to add additional meta-information in a very simple way

After saving the Page Form, a new wiki page with the corresponding content is stored, which can be queried. The phrase is marked as annotated.

Text was annotated. The entered comment can be shown via a mouseover

The Sidebar on the right can be displayed by clicking on it. The Sidebar contains all annotations on the wiki page.

Sidebar lists all annotations on the wiki page

A search function allows to filter for specific annotations. The search function filters on comments, marked text phrases and the user, which created/edited the annotation.

Search functions filters for annotations ("Koh" was entered. So the annotation "Angela Dorothea Merkel" is not listed, because it does not contain this sequence of letters

Edit and Delete Annotation[edit]

To edit or delete an annotation, simply move with the mouse over the annotation which should be edited or deleted and click on the corresponding button on the top right of the mouseover-window.

Mouseover-window displays edit and delete button

Query Annotations[edit]

For every wiki page that was annotated via the Semantic Text Annotator, an additional page within the Namespace Annotation is created (Namespace 248). This page lists all annotations for the corresponding wiki page. Users can jump on the specific annotation page, which contains all entered information by the user (Comment, Information from Page Forms), as well as some additional information (Modification Date, Modification Users, etc.)

Wiki Page on the Annotation Namespace lists all annotations for the corresponding wiki page.

The corresponding Query Syntax is depicted in the following.

Syntax for the overview page to query the annotations for a specific wiki Page

The wiki page for each annotation displays all information entered by the user via Page Forms, as well as information from the annotator.js.

Stored information by the Semantic Text Annotator on the corresponding annotation page for each annotation

Repair Mode[edit]

When a text was annotated and the content of the wiki page changed, then it might be the case that the annotation does not fit to the annotated part anymore. Therefore, while starting and loading existing annotations, the Semantic Text Annotator checks for changes made in the text. If it finds annotations that do not fit to the annotated part, then a suggestion is shown to the user that the Repair Mode should be used in order to fix the annotations. The Repair Mode allows to repair broken annotations. The Semantic Text Annotator suggests to start the Repair Mode once it detects failures.

Suggestion of the Semantic Text Annotator to use the Repair Mode to repair broken annotations due to changes. (Here we deleted the middle name of Angela Dorothea Merkel in the beginning and edited the Text before Helmut Kohl

The Repair Mode can be started by clicking on the Button Repair Annotations. This Button only appears when annotations are broken and detected by the Semantic Text Annotator.

Starting Repair Mode

The Repair Mode guides the user through every broken annotation and displays information about the annotations. Users can select the annotations in the text and therefore fix the broken annotations. After all annotations are done, the Repair Mode ends.

All annotations were fixed by using the Repair Mode

The Semantic Text Annotator returns to the usual Look and displays the fixed Annotations.

Fixed annotations are displayed as usual

Known issues[edit]

  • 'Annotations Button' does also appear on action pages (View History, Edit, etc.)
  • 'Semantic Text Annotator does also appear on special and action pages (which may create invalid context)
  • Sidebar does not scroll. Therefore not all Annotations are shown
  • Sidebar icons (Delete, Edit) does not work
  • Buttons My Annotations and Shared do not work.

Future Work[edit]

  • Include Reinstall Button
  • Improve Repair Mode by autosuggesting new annotation locations


Log History[edit]

  • Update on 01.06.2017: Bug fixes. Solved problems with integration of Semantic Image Annotator. We recommend to install it frees which means to delete the following Pages: Form:TextAnnotation, Template:TextAnnotation as well as edit forms that were connected to the older version. So you have a fresh version.
  • Update on 07.06.2017: Issue solved in which non-permissioned users were allowed to create annotations.
  • Update on 07.06.2017: Only Sysops users can now access the Special Page of the Semantic Text Annotator.
  • Update on 08.06.2017: Version 0.7.2 published with a reinstall button.

See also[edit]

Link to authors

Link to information pages


The idea of the Semantic Text Annotator is based on a previous extension Download" by Oliver Lutzi. For the Semantic Text Annotator is the JS Library annotator.js used. This Extension was created for the Semantic MediaWiki Seminar of the AIFB in WS17/18.