-
Notifications
You must be signed in to change notification settings - Fork 2
Adding qonsole to your page
Clone the git repository (epimorphics/qonsole), or
download the files individually from GitHub. The demo-
pages show a few variants on laying
out the elements of the page body that Qonsole needs, and the JavaScript and CSS files you'll
need to include.
Qonsole is configured by passing a JSON data structure to the qonsole.init()
call. Currently,
this config object allows you to specify:
The value of this config element is a JSON object, whose keys are short
references to available endpoints and whose values are URLs. One default
end-point
should always be provided. The goal here is to allow different example queries potentially
to be run against different specific SPARQL endpoints. Example:
endpoints: {
"default": "http://environment.data.gov.uk/sparql/bwq/query",
}
The prefixes listed in this element will be added to each query, and may be selected on or off by a single click. The value is a JSON object, whose keys are the prefix short-name, and whose values are URIs. Example:
prefixes: {
"bw": "http://environment.data.gov.uk/def/bathing-water/",
"bwq": "http://environment.data.gov.uk/def/bathing-water-quality/",
"ef-sp": "http://location.data.gov.uk/def/ef/SamplingPoint/",
"interval": "http://reference.data.gov.uk/def/intervals/",
"stats": "http://statistics.data.gov.uk/def/administrative-geography/",
"sr": "http://data.ordnancesurvey.co.uk/ontology/spatialrelations/",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"owl": "http://www.w3.org/2002/07/owl#",
"xsd": "http://www.w3.org/2001/XMLSchema#"
},
This element defines the example queries that users can select run, or
to base their own queries on. The value is a JSON array, each element of
which is one example query. Note that prefixes do not need to be
declared in the example queries. The query text can be declared in the config
structure itself, with the query
key, or accessed remotely from a different URL
using the queryURL
key:
queries: [
{ "name": "Properties of a named bathing water",
"query": "select ?predicate ?object\nwhere {\n" +
" ?bw rdfs:label \"Spittal\"@en ;\n" +
" ?predicate ?object\n}"
},
{ "name": "all OWL classes",
"query": "select ?class ?label ?description\nwhere {\n" +
" ?class a owl:Class.\n" +
" optional { ?class rdfs:label ?label}\n" +
" optional { ?class rdfs:comment ?description}\n}"
},
{ "name": "Properties of a named bathing water",
"queryURL": "list-properties.rq"
}
]
By default, each query gets all of the shared prefixes declared in the configuration
object (see above). However this isn't always necessary. Simpler example queries may be easier
to read if the prefixes shown are only those actually in use. There are two mechanisms
you can use to control the prefixes used when displaying a query. Firstly, if the query
itself includes prefix
declarations, then only those prefixes will be shown. Alternatively,
you can list the prefix keys that should be used with the query with a prefixes
key
in the configuration object:
queries: [
{ "name": "Properties of a named bathing water",
"query": "select ?predicate ?object\nwhere {\n" +
" ?bw rdfs:label \"Spittal\"@en ;\n" +
" ?predicate ?object\n}",
"prefixes": [rdfs", "bw"]
}]