Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 1.27 KB

File metadata and controls

42 lines (28 loc) · 1.27 KB

mediawiki-extensions-WikibaseInWikitext

Adds the "sparql" tag for rendering SPARQL with some helpful things around it such as list of entities referenced and a link to try it in a sparql UI.

Also hooks in with syntaxhighlight if provided to make it look pretty.

This is currently intended for use on https://wbstack.com and might change without release notes etc.

Settings:

Installation

Download the extension into your MediaWiki extensions directory.

In your LocalSettings.php

wfLoadExtension('WikibaseInWikitext');
$wgWikibaseInWikitextSparqlDefaultUi = 'URL TO YOUR QUERY UI HERE';

Usage

This extensions functionality can be used in wikitext

<sparql list="1" tryit="1">
#Cats
SELECT ?item ?itemLabel 
WHERE 
{
  ?item wdt:P31 wd:Q146.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
</sparql>

The option list="1" prepends a list of used Property (P-numbers) and Items (Q-numbers) to the presentation of the query.

The option tryit="1" appends a link to execute the query on the local Wikibase based on the global $wgWikibaseInWikitextSparqlDefaultUi