Extension:WikibaseInWikitext

Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:GPL licensed extensions
MediaWiki extensions manual
WikibaseInWikitext
Release status: betaCategory:Beta status extensions
Implementation ContentHandler Category:ContentHandler extensions, Tag Category:Tag extensions
Description 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.
Author(s) Adam Shorland (Addshoretalk)
MediaWiki 1.32+Category:Extensions with manual MediaWiki version
License GNU General Public License 2.0 or later
Download Category:Extensions in GitHub version control
README
CHANGELOG
$wgWikibaseInWikitextSparqlDefaultUi
<sparql>
Category:All extensionsCategory:Extensions not in ExtensionJson

The WikibaseInWikitext extension adds the "sparql" tag for rendering SPARQL with some helpful things around it, such as a list of entities referenced and a link to try it in a SPARQL UI. If provided, it also hooks in with the extension Syntaxhighlight to make it look pretty.

Installation

  • Download and place the file(s) in a directory called WikibaseInWikitext in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'WikibaseInWikitext' );
    
  • Configure as required.
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration

$wgWikibaseInWikitextSparqlDefaultUi
Location of the SPARQL UI to link to. Example: https://addshore-alpha.wiki.opencura.com/query

Usage

  • Add your SPARQL query to the sparql tag. If the SyntaxHighlight extension is installed, it should show your lines of code with the appropriate syntax highlighting.
  • You can set the following attributes to show additional information and links:
    • Add list="1" to retrieve a list of entities used in your query.
    • Add tryit="1" to let readers try your code in the SPARQL query interface.

Example

<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>
Category:Wikibase extensions
Category:All extensions Category:Beta status extensions Category:ContentHandler extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:GPL licensed extensions Category:ParserFirstCallInit extensions Category:Tag extensions Category:Wikibase extensions