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.

Version 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

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 :

Download instructions
Download the last version on GitHub at https://github.com/BorderCloud/LinkedWiki.

Installation VERSION 2
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.

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.

=Version 1.0.1.2 =

Use LinkedWiki if you want to use data from external endpoints and expose such data to the rest of the world (linked data).

The LinkedWiki extension will allow integrating Semantic Mediawiki with a SPARQL 1.1 endpoint via a RESTful API (ie, HTTP GET).

Quick video : First video of tutorials

Tutorials (subtitles in english and VO in french) : 12 videos

Training : 2 days in french, [mailto:karima.rafes@bordercloud.com send a email if you want a training in english].

What can this extension do?
The LinkedWiki extension can:
 * read a local or remote endpoint with SPARQL 1.0 (lib ARC2, tested with DBpedia and 4store)
 * write a local or remote endpoint with the functions Insert DATA and Delete DATA of SPARQL 1.1 (lib 4store-php, tested only with 4store)
 * help you to build and test a SPARQL query with a special page
 * from the special page, share your SPARQL query, thanks to the tutorial generation feature.
 * 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 :

Comparison of Semantic MediaWiki triplestore connectors
There are important differences among Extension:Halo Extension, Extension:SparqlExtension and Extension:RDFIO :
 * LinkedWiki doesn't change the real ontology of your semantic mediawiki. Interoperability!
 * LinkedWiki uses 4Store because 4Store is an efficient, scalable and stable RDF database, more than jena or ARC2 (LinkedWiki does not use the ARC endpoint, only the SPARQL 1.0 parser API).
 * LinkedWiki uses SPARQL 1.1 in order to write in a local or remote endpoint (Insert DATA and Delete DATA).
 * LinkedWiki can use Extension:Widgets in order to print a result because anybody can customize a widget without changing the PHP code.
 * LinkedWiki is an Open Source project. The project has an active maintenance.

Tutorials

 * 1) Demonstration of the extension (quick video)
 * 2) First step in Semantic Mediawiki
 * 3) How to print an image with a SPARQL query ?
 * 4) Defining an infobox and association of a list of values to a property
 * 5) Creating an ID for sharing data with a machine
 * 6) Creating a property with a limited set of allowed values
 * 7) Display the result of a SPARQL query with a MediaWiki template
 * 8) Formatting an infobox
 * 9) How to build the template of the infobox
 * 10) How to use the template of the infobox
 * 11) How to share SPARQL queries
 * 12) How to realign the dynamic internal ontology of a wiki with a stable ontology

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: endpoint

 * Querying of another endpoint.

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 :

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.

Bug in this version with #wsparql
In the file LinkedWiki.php, you need to change the line : if(preg_match_all('#^([^= ]+)=(.*)$#i', $args[$i],$match)){ with this line : if(preg_match_all('#^([^= ]+)=((.|\n)*)$#i', $args[$i],$match)){

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 contact page, if you face a problem.

#properties
Add values of one property in one time like a list of one parameter of an infobox.

Download instructions
Download the version 1.0.1.2 on GitHub at http://github.com/BorderCloud/LinkedWiki/downloads.

Installation VERSION 1 (NOT FOR VERSION 2)
The extension works with or without a triplestore. You can have a graph for your wiki without triplestore. You can host your graph with the service BorderCloud.

So, there are 3 configurations :
 * 1) with the remote triplestore of BorderCloud
 * 2) with a local triplestore 4Store
 * 3) without triplestore

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

with the remote triplestore of BorderCloud
Go on the website BorderCloud and to rent a graph.

Install Extension:Semantic MediaWiki.

If you want to use a widget with SPARQL, install Extension:Widgets.

Extract the downloaded archive into your extension/directory. The folder name of the destination is LinkedWiki.

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

With a local triplestore : 4Store
Install Extension:Semantic MediaWiki.

If you want to use a widget with SPARQL, install Extension:Widgets.

Extract the downloaded archive into your extension/directory. The folder name of the destination is LinkedWiki.

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

Installation of 4Store
Read this little tutorial.

See also the site of 4store

Without triplestore for your Wiki
Install Extension:Semantic MediaWiki.

If you want to use a widget with SPARQL, install Extension:Widgets.

Extract the downloaded archive into your extension/directory. The folder name of the destination is LinkedWiki.

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

= 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