-
-
Save seralf/f7dc9abe213b804a0dfd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); | |
/** | |
* Set some of the hooks to link YASR and YASQE | |
*/ | |
yasqe.options.sparql.handlers.success = function(data, textStatus, xhr) { | |
yasr.setResponse({response: data, contentType: xhr.getResponseHeader("Content-Type")}); | |
}; | |
yasqe.options.sparql.handlers.error = function(xhr, textStatus, errorThrown) { | |
var exceptionMsg = textStatus + " (response status code " + xhr.status + ")"; | |
if (errorThrown && errorThrown.length) exceptionMsg += ": " + errorThrown; | |
yasr.setResponse({exception: exceptionMsg}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<!--Make sure to store YASR and YASQE css/js files in the current working dir! (these are not included in this gist)--> | |
<head> | |
<meta charset="utf-8"> | |
<title>Glueing YASQE and YASR</title> | |
<link href="yasqe.min.css" rel="stylesheet" type="text/css" /> | |
<link href="yasr.min.css" rel="stylesheet" type="text/css" /> | |
</head> | |
<body> | |
<div id="yasqe"></div> | |
<div id="yasr"></div> | |
<script src="yasqe.min.js"></script> | |
<script src="yasr.min.js"></script> | |
<script src="glue.js"></script> | |
</body> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment