YASGUI is a continuation of the original YASGUI library. It uses the JavaScript libraries YASQE (a SPARQL Query Editor) and YASR (a SPARQL Resultset Visualizer). Below we desribe the functionality that the YASGUI library offers in addition to these other libraries.

Getting Started

Initialize YASGUI via its constructor, which return an instance we refer to as yasgui (lowercase). The constructor take as argument a config object. See the configuration section for more information on this object.

YASGUI(parent: DOM-Element, settings: Object) → YASGUI instance: yasgui

Main YASGUI constructor. Pass a DOM element as argument to append the editor to, and (optionally) pass along config settings




API methods accessible via the yasgui instance

Store the current yasgui settings in local storage

yasgui.history: array (default: [])

The list of items in query history

yasgui.addTab(tabId:string (optional)) → addedTab: tab

Add a new tab

current() -> tab

Return the tab currently selected

yasgui.selectTab(tabId:string) → selectedTab: tab

Select tab with tabId

yasgui.closeTab(tabId:string) → currentSelected: tab

Close tab with tabId


The tab API exposes several values, the most important ones being the YASQE and YASR instances.

Access to the YASQE api. For more information, see the YASQE documentation


Access to the YASR api. For more information, see the YASR documentation

tab.setQuery: function(newQuery:string)

A utility function to set the query manually. This can be used as such: yasgui.current().setQuery('new query')


YASGUI emits several events. For information on the possibilities of our event handler, see the EventEmitter implementation documentation of NodeJS
query (instance: yasgui, tab: tab)

Fires when a query is executed

queryFinished (instance: yasgui, tab: tab)

Fires when a query is finished



This configuration object is accessible/changeable via YASGUI.defaults and yasgui.options, and you can pass these along when initializing YASGUI as well. To change settings to the YASQE and YASR components used by YASGUI, you are best off changing the YASGUI.YASQE.defaults and YASGUI.YASR.defaults objects before initializing YASGUI

persistencyPrefix: function → string

YASGUI stores several options in HTML5 local storage, for persistency between browser sessions. To keep the local storage keys unique, set this prefix. By default the prefix is defined using the ID of the nearest parent (containing an ID, that is). To disable persistency alltogether, set this value to false.

allowYasqeResize: boolean (default: true)

Allow resizing of the YASQE editor

endpoint: string (default: null)

If unset, a new tab will take the endpoint selected in the last tab. If set, a new tab will always use this specific endpoint

catalogueEndpoints: array|function(instance:yasgui, callback)

The endpoints used as suggestions in the endpoint autocompletion field. This value is either an array of objects (in the form {endpoint: 'http://endpoint', title: 'some short title. optional.'}), or a function that returns this array via a callback function. By default, it uses a static list crawled from the SPARQLES website (that at the time of writing did not publish their endpoints via API).

api: object

YASGUI works completely client-side. To increase the functionality you can choose to run the YASGUI server as well. These settings specify the URLs of the backend YASGUI API. Setting these values to null, will disable their functionality.

corsProxy: string (default: null)

The URL of the proxy, used to access CORS disabled endpoints

collections: string (default: null)

The URL of the collections API, used to manage query collections

urlShortener: string (default: null)

The URL via which to shorten URLs

tracker: object

Object to which enables logging functionality. It currently supports Google Analytics as logging API.

googleAnalyticsId: string (default: null)

The Google Analytics ID. Set to null to disable logging

askConsent: boolean (default: true)

If tracking is enabled, present the user with a popup asking for consent. Options are: enable tracking, enable only for visits and disable tracking of queries/endpoints, and disable tracking altogether.


To change the server configuration change the ./server/config.js file.
You'll also be able to change the client configuration via this file, by modifying values in the client object
port: int (default: 4545)

The port on which to run the API

db: object

Database connection information. Used at the moment for storing the shortened URLs

db.engine: string (default: tingodb)

The database to use. Either the file-based tingodb, or your own deployment of mongodb (our code uses a single interface, enabling you to simply switch between both). Possible values: tingodb or mongodb

db.mongo: object

The MongoDb configuration object string (default:

Host of mongodb

db.mongodb.port: int (default: 27017)

Mongodb port

db.mongodb.db: string (default: 'data')

Default mongo database

db.mongodb.opts: object

Additional MongoDb options

db.mongodb.opts.auto_reconnect: boolean (default: true)

Auto-reconnect when connection is lost boolean (default: true)

Enabling this flag means the mongo driver returns information of the success/error of an insert/update/remove

db.tingodb: object

The TingoDb configuration object

db.tingodb.path: string (default: './tingodb')

Path of TingoDB database