Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[YASQE] Querying an in-browser SPARQL engine #197

Closed
ptgolden opened this issue Mar 31, 2022 · 3 comments
Closed

[YASQE] Querying an in-browser SPARQL engine #197

ptgolden opened this issue Mar 31, 2022 · 3 comments

Comments

@ptgolden
Copy link

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 from yasqe, 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, if fetch were used as the HTTP request library (#150). (Cancelling fetch requests is a bit more involved than calling .abort()).

@GerwinBosch
Copy link
Member

GerwinBosch commented Apr 1, 2022

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)
}

@gtfierro
Copy link

gtfierro commented Apr 1, 2022

@GerwinBosch @ptgolden thanks for the quick response! This is a much cleaner solution than I had hacked together originally

@GerwinBosch
Copy link
Member

@ptgolden I'm closing this issue as the problem seems to be resolved, please reopen if that is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants