Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Combining #YASQE and #YASR

A simple example on how to combine YASQE and YASR. Any SPARQL result received via YASQE are passed on to YASR. YASR, uses any prefixes defined in YASQE to prettify the SPARQL results.

var yasqe = YASQE(document.getElementById("yasqe"), {
sparql: {
showQueryButton: true
}
});
var yasr = YASR(document.getElementById("yasr"), {
//this way, the URLs in the results are prettified using the defined prefixes in the query
getUsedPrefixes: yasqe.getPrefixesFromQuery
});
//link both together
yasqe.options.sparql.callbacks.complete = yasr.setResponse;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Glueing YASQE and YASR</title>
<link href='http://cdn.jsdelivr.net/g/yasqe@2.2(yasqe.min.css),yasr@2.4(yasr.min.css)' rel='stylesheet' type='text/css'/>
</head>
<body>
<div id="yasqe"></div>
<div id="yasr"></div>
<script src='http://cdn.jsdelivr.net/yasr/2.4/yasr.bundled.min.js'></script>
<script src='http://cdn.jsdelivr.net/yasqe/2.2/yasqe.bundled.min.js'></script>
<script src="glue.js"></script>
</body>

When I copy this example I have to reload the page to get my query results to show
I use the YASQE-1.4 and YASR-1.2

In the debugger I see that the query gets performed on the backend

Owner

LaurensRietveld commented Oct 13, 2014

Ah, I missed this comment, sorry about that. Could you try the latest version of YASR (1.2.1)? There was an issue related to the new DataTables programming interface, which made the results table unable to update on new query results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment