Extension:LinkedWiki/Sparql parser

The SPARQL parser is able to build a visualization in your Wiki with results of a SPARQL query.

You can select two types of visualization: with Sgvizler2 (a JavaScript lib) with a lot of charts/tables or via a HTML table where you can customize each columns with templates.

If your data is only accessible with credentials, you must use the HTML table generated by PHP to preserve your credentials. Moreover, by default, the HTML table of SPARQL results is saved in the wiki cache. In this manner, your SPARQL service is also less solicited (Details).

If your data is public, you can use the two methods.

With the default endpoint

 * Querying without the parameter "endpoint" is possible but the variable $wgLinkedWikiConfigDefaultEndpoint has to be in the localsettings (see installation). By default the extension uses the endpoint of Wikidata.


 * Querying the properties of the current page :

With a specific endpoint
Print a simple Array with the following results:


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

Parameters of Sgvizler2 charts and tables
Sgvizler2 is a javascript wrapper for easy visualisation of SPARQL result sets (and a jQuery plugin).

You can find the list of available visualizations in the "special:SPARQL editor" page and in the doc of Sgvizler.

Parameter: chart

 * Select the visualization :

Parameter: options

 * Each visualization has its own options, the options parameter contains the visualization's options and  is their separator:

Parameter: preview

 * The "preview" option allows you to limit the number of lines displayed in the wiki page without limiting the number of lines in the CSV export.

Parameter: class

 * "class" option allows to specify the css class to be used on the generated tables (by default is 'wikitable sortable').

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

 * you can remove the footer of array:

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

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

Parameter: default

 * The "default" option is displayed instead of an empty table.

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: log
You can control the log levels about possible SPARQL errors. If there is an SPARQL error :
 * level 0 : any messages
 * level 1 : a short message
 * level 2 : a short message and details, if available.