Closed ptgolden closed 2 years ago
Hello and thanks for your ticket.
We noticed as well that yasqe's interface suited for local graph instances. One way to do it would be to override yasqe.query
with something like
const yasqe = new Yasqe(...)
yasqe.query = (yasqeInstance) => {
const queryString = yasqeInstance.getValue()
...
// When using Yasgui
yasqeInstance.emit("queryResponse", jsonResponse);
// When using Yasr
yasr.setResults(jsonResults)
}
@GerwinBosch @ptgolden thanks for the quick response! This is a much cleaner solution than I had hacked together originally
@ptgolden I'm closing this issue as the problem seems to be resolved, please reopen if that is not the case.
What would be the best way to integrate YASGUI with a graph database that works locally? That is, to respond to SPARQL queries from within JavaScript without sending an HTTP request? Oxigraph is an example of a graph database and SPARQL query engine that can be included in the browser via WebAssembly.
One way to accomplish this currently is to listen to the
query
event fromyasqe
, rebuild the query from the request data, and abort the default HTTP request. But this seems like something that could break in the future. For example, iffetch
were used as the HTTP request library (#150). (Cancellingfetch
requests is a bit more involved than calling.abort()
).