links icon indicating copy to clipboard operation
links copied to clipboard

Minimal support for SPARQL

Open jamescheney opened this issue 5 years ago • 4 comments

Provide basic/minimal support for querying SPARQL endpoints in a stringly-typed way, c.f. [1]

var query = "SELECT * WHERE {?s ?p ?o} LIMIT 10";
var url = "http://statistics.gov.scot/sparql";
var jsonResult = post(url, query);
...

This would allow initial experimentation with Links programs using SPARQL/RDF data (encoded as JSON) while also forcing implementation of basic HTTP interaction SPARQL endpoint (which is the standard way to go). A next step could be to extend language integrated query to generate SPARQL queries from (perhaps restricted) comprehensions; cf. #655 since some SPARQL features have similar issues regarding nulls.

[1] https://statistics.gov.scot/sparql

jamescheney avatar Apr 13 '20 11:04 jamescheney

We ought to be able to implement this basic support as a library in Links, possibly taking advantage of the FFI.

dhil avatar Apr 13 '20 11:04 dhil

That would be great. Another strategy could be to have a slightly more general library for making whatever HTTP POST (or other) requests from within Links and serializing the results to JSON, and define the above in terms of that. It would be good to be able to submit such requests either from JavaScript or OCaml land. (Note that there are likely security implications either way.)

jamescheney avatar Apr 13 '20 12:04 jamescheney

cf https://www.good-eris.net/ocaml-rdf/

jamescheney avatar Jun 25 '23 23:06 jamescheney

Mental note: installing ocaml-rdf using opam results in a stack overflow error, and a suggestion to retry after doing ulimit -s unlimited - this works, but in the build system/CI we will have to add this as a setup incantation.

jamescheney avatar Jul 03 '23 11:07 jamescheney