Extension:WikibaseInWikitext
![]() Release status: betaCategory:Beta status extensions |
|
---|---|
Implementation | ContentHandlerCategory:ContentHandler extensions, TagCategory: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 | GitHub: Note: README CHANGELOG |
$wgWikibaseInWikitextSparqlDefaultUi |
|
<sparql> |
|
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 yourextensions/
folder. - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'WikibaseInWikitext' );
- Configure as required.
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.
- Add
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: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