Extension:SparqlExtension

This extension allows to integrate Semantic Mediawiki with a SPARQL endpoint via a web-service.

While this has been set up and tested to work with Joseki and Jena TDB, with some modifications, this should be configurable to work with other triplestores as well.

This extension is an open-source alternative to the triplestore connector in the Extension:Halo Extension.

Features

 * Synchronizes semantic data with the triple store and exposes it via Joseki endpoint.


 * Embed Sparql query output into a wiki page using a parser extension #sparql.


 * Use foreign endpoints (DBpedia or anything else that has a public SPARQL endpoint)


 * Multiple output formats: table, maps, graph, template

Template

Table with formating

Maps querying DBpedia (requires Extension:Maps)

Graph (requires Extension:GraphViz)

Prerequisites

 * Requires Extension:Semantic_MediaWiki
 * Requires Joseki

Installation

 * Install SMW and Joseki first.
 * Configure Joseki to accept named graphs and "SELECT FROM" statements (see example joseki config here)
 * Download zip and extract it into your_mediawiki_path/extensions/
 * Add the following to the end of your LocalSettings.php

$smwgNamespace = 'http://YOURHOST/wiki/'; $sparqlJosekiUpdateUrl = "http://YOURHOST:8080/joseki/update/service"; // wherever the joseki servlet is running $sparqlRdfExportUrl = "http://YOURHOST/wiki/Special:ExportRDF/"; $sparqlJosekiSparqlUrl = "http://YOURHOST:8080/joseki/sparql?query="; // again adjust this to match joseki configuation require_once("$IP/extensions/SparqlExtension/SparqlExtension.php");


 * You can import all your current SMW data using a utility script: your_mediawiki_path/extensions/SparqlExtension/importPagesIntoEndpoint.php

Known issues
$wgJobRunRate = 1; Alternatively you can run runJobs.php as an admin. Even though TDB allows multiple read single write (MRSW) policy only, Joseki allows simultaneous writes to TDB. Consider this a Joseki bug that hoepfully will be fixed in the nearest future.
 * The extension synchronizes the wiki content with the store via mediawiki's job queue. On every article save event a job is created to update the store contents. You have to set an appropriate job rate given the usage of your wiki. By default SparqlExtension sets it to 1. You can adjust the job rate by setting:
 * N.B. If you run multiple instances of runJobs.php simultaneously there is a good chance of corrupting the triple store when using TDB.
 * The Graphviz output format needs to be further standardized.