Github mirror of "wikidata/query/gui" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Clone or download
Pull request Compare This branch is 6 commits ahead, 238 commits behind wikimedia:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
examples
i18n
polestar
vendor
wikibase
.gitignore
.gitreview
.jscsrc
.jshintignore
.jshintrc
.stylelintrc
Gruntfile.js
LICENSE
README.md
copyright.html
embed.html
favicon.ico
github.svg
index.html
jsduck.json
land.html
logo-embed.svg
logo.svg
maint.html
package.json
robots.txt
style.less
templates.mustache
throbbler.gif

README.md

Wikibase Query Service GUI

This repository contains the GUI for the OSM Sophox Service.

Download & setup

Clone git repo, go into created folder and then pull all dependencies via npm package manager.

$ git clone https://gerrit.wikimedia.org/r/wikidata/query/gui
$ cd gui
$ npm install

Alternatively, use npm install.

npm install wikidata-query-gui

Run tests

Run JSHint, JSCS and QUnit tests.

$ npm test

Debug

Start a test server for local debugging. Do not use it in production.

$ npm start

Build

Create a build with bundled and minified files.

$ npm run build

Deploy

Create a build and push it to the deployment branch via git review.

$ npm run deploy

Please make sure you have defined a gitreview username:

git config --global --add gitreview.username "[username]"

Components

Editor

A CodeMirror based SPARQL editor with code completion (ctrl+space) and tooltips (hover).

var editor = new wikibase.queryService.ui.editor.Editor();
editor.fromTextArea( $( '.editor' )[0] );

See examples/editor.html.

Example dialog

A dialog that allows browsing of SPARQL examples.

new wikibase.queryService.ui.dialog.QueryExampleDialog(  $element, querySamplesApi, callback, previewUrl );

See examples/dialog.html.

SPARQL

var api = new wikibase.queryService.api.Sparql();
api.query( query ).done( function() {
	var json = JSON.parse( api.getResultAsJson() );

} );

See examples/sparql.html. JSFiddle.net

Result Views

Views that allow rendering SPARQL results (see documentation).

var api = new wikibase.queryService.api.Sparql();
api.query( query ).done(function() {
	var result = new wikibase.queryService.ui.resultBrowser.CoordinateResultBrowser();
	result.setResult( api.getResultRawData() );
	result.draw( element );
} );

See examples/result.html. JSFiddle.net

Release Notes and npm package

Unfortunately there are no releases and the provided code and interfaces are not considered to be stable. Also the dist/ folder contains a build that may not reflect the current code on master branch.