Github mirror of "wikidata/query/gui" - our actual code is hosted with Gerrit (please see https://www.mediawiki.org/wiki/Developer_access for contributing)
Switch branches/tags
Clone or download
lucaswerkmeister Indicate that ResultView’s editor is optional
ResultView can accept an editor argument, but also functions without it
(e. g. on embed.html, where there is no editor).

Change-Id: I171c51cd864af44f02ccafdf0758c5f470d8f195
Latest commit 1c8506c Dec 11, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist Update dist js file and provide JSFiddles Dec 22, 2016
examples Merge "Improve JS code examples" Dec 10, 2018
i18n Localisation updates from https://translatewiki.net. Dec 10, 2018
polestar Replace problematic atob/btoa with encode/decodeURIComponent Nov 8, 2016
vendor Replace Explorer with embedded GraphView Oct 20, 2016
wikibase Indicate that ResultView’s editor is optional Dec 11, 2018
.gitignore update ignore to include logs Jan 26, 2018
.gitreview Add .gitreview Feb 18, 2016
.jscsrc Enable JSCS rule to enforce newlines in var blocks Jan 23, 2017
.jshintignore Polestar support Oct 21, 2016
.jshintrc Allow specifying options for non-default views Nov 13, 2017
.stylelintrc Disable no-descending-specificity stylelint rule Jan 16, 2018
Gruntfile.js When set, use CHROME_BIN as Puppeteer ExecutablePath Nov 22, 2018
LICENSE Polestar support Oct 21, 2016
README.md test commit to see if build job works Apr 25, 2018
copyright.html Update endpoints Nov 30, 2018
embed.html Fix instantiation of ResultView in embed.html Dec 11, 2018
favicon.ico Change favicon to "magnifying glass" image Sep 25, 2017
index.html CLDRPluralRuleParser is not in wikimedia jquery i18n lib Nov 12, 2018
jsduck.json Merge duplicate keys in jsduck.json Aug 10, 2016
logo-embed.svg Use local embed logo Aug 31, 2017
logo.svg Apply Wikimedia Design Style Guide colors, other minor fixes Jul 18, 2018
maint.html T105080: maintenance mode page Jul 30, 2015
package.json Merge ""grunt-contrib-qunit": "^3.0.0"" Nov 12, 2018
pom.xml Set proper node/npm versions Mar 8, 2018
robots.txt Whitespace fix-ups Aug 10, 2016
style.less Remove wrong z-index from CSS class Nov 28, 2018

README.md

Wikibase Query Service GUI

This repository contains the GUI for the Wikidata Query Service.

Please see more details about the service in the User Manual.

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.