Extension:LinkedWiki

The LinkedWiki extension allows to print arrays or widgets with a SPARQL query on your Semantic MediaWiki, and optionally includes a SPARQL Endpoint.

Mediawiki 1.22 : Master
Add :
 * Graph flow
 * Special page with Flint Editor

Mediawiki 1.20 & 1.21 (tag : 2.0.0 Alpha 1)
New version of LinkedWiki is available :
 * without ARC2 lib
 * without dependencies with the extension Semantic MediaWiki
 * You can use the extension without local endpoint
 * very simple installation

Mediawiki 1.16 (tag : 1.0.1.2)
See the page : LinkedWiki Version_1.0.1.2

What can this extension do?
So for the moment in this version ALPHA you can :
 * read remote endpoint with SPARQL 1.1 or 1.0
 * help you to build and test a SPARQL query with a special page
 * print the result of your query in a page with a parser function. Example:
 * print the result of your query in a mediawiki widget. Thus, you can build by yourself new widgets for your linked data in your Linked Wiki. Example with the Google maps widget with Worldwide Earthquakes :

Installation
To install this extension, add the following to LocalSettings.php:

If, after the installation, you have errors about CURL in the log, probably you need to install the lib php5-curl in your server.

Graph visualization
With the tag name lwgraph, you can build quickly a graph.

Options :
 * type : select your graph
 * height : the height of graph in the page (px or percent).
 * width : the width of graph in the page (px or percent). By default : 100%
 * debug : with debug="true" (for developers)

Type : flow
Example of graph :

With this code :  Ecole Maternelle==>Primaire==>Collège=Brevet=>Lycèe=Bac=>Université Collège=Brevet=>Lycèe Pro=Bac PRO=>IUT Lycèe Pro=Bac PRO=>Université

You can click on the page's name in the graph. If the page doesn't exist, the link is red.

Special page: SPARQL editor for Wiki
This editor can help you to write the wikitext with the magic word #sparql.



Special page: SPARQL Flint Editor
This editor can help you to write quickly your first query on DBpedia.



Basic Use: #sparql
Print a simple Array with the following results:


 * Querying of the default endpoint and all the graphs of this endpoint.


 * Querying of the default endpoint with one graph.


 * Querying of the default endpoint with the graph of this wiki (define with the variable $wgLinkedWikiGraphWiki).


 * Querying the properties of the current page (3 equivalent queries) :


 * Querying with any language.

Parameter: headers

 * Change the headers.

Parameter: classHeaders

 * You can hide or change the style of your headers. Here, the first column has no header and is unsortable.

Example:



Parameter: templates
With an example of template like Template:Test1: , and


 * You can use this template in the following way:


 * And you can use a different template for each column:

Parameter: cache

 * Your data may be very volatile and you need accordingly to refresh the result of this query each time. To do so, you can disable the cache with the cache parameter, as follows:

Parameter: debug

 * Well, you can add several parameters at the same time but doing so, the wiki text can be very hard to debug. This parameter gives you the result of this parser before the last parsing of mediawiki :

Parameter: footer

 * you can remove the footer of array :

Parameter: templateBare

 * you can remove the footer and the header. With the value "tableCell", you can catch only the cells.

Usage
You want to use your SPARQL results with Google Maps, Youtube, Flickr, etc. It's very hard if not impossible to develop all the possibilities in a mediawiki extension. So, the wsparql function can pre-format the parameters for a widget.


 * The parameters of the query, endpoint, cache and debug are the same as for #sparql, with a slightly different syntax:


 * Example with the Google Static Maps widget:


 * Result of wsparql before the parsing of mediawiki:

And after parsing:



As you can see, the wsparql aggregates the sparql results in one list, with this pattern : rows.NUMBER_LINE.VARIABLE_NAME = VARIABLE_VALUE rows.0.point=43.30, 5.38 | rows.1.point=48.83, 2.3 | rows.2.point=49.93, 2.3
 * Like that:

You have to find a widget compatible with this syntax or you can create/change a widget of mediawikiwidgets.

Build your widget
This widget allows you to embed Google Static Maps on your wiki page.
 * 1) Install the  extension Widgets
 * 2) Create the page Widget:NAME_OF_YOUR_WIDGET
 * 3) Insert your code, example with google static maps :

Sample result


And to share your widget in mediawikiwidgets.org.

Now, let's summarize!
 * To read one list like rows.NUMBER_LINE.VARIABLE_NAME = VARIABLE_VALUE, you have to perform a foreach of rows and read keys and items, like that:

It's a bit hard the first time. Use the group google, if you face a problem.

= Mailing list / Google Group =
 * FAQ and problems : http://groups.google.com/group/linkedwiki

=See also=
 * Tutorial SPARQL in french (Wikiversity)
 * Project Semantic MediaWiki
 * Endpoint 4store
 * W3C Recommendation Sparql 1.0
 * W3C Working Draft Sparql 1.1
 * Stats and tree Git of LinkedWiki