Reputation: 2492
For learning SPARQL it might be useful to have full control both over the query text and the data (RDF triples). While there are many public SPARQL endpoints available their data is typically read-only for obvious reasons. To actively apply SPARQL-queries to ones own data, a local triple store might be useful, e.g. for reproducing the examples from https://www.w3.org/TR/rdf-sparql-query/.
However, setting up such an infrastructure with all its dependencies might be complicated.
→ What is the simplest¹ way to setup a local triple store with SPARQL endpoint on a usual PC?
(¹: The meaning of "simplest" depends on ones system configuration and prior knowledge, which can be reflected by different answers.)
Upvotes: 2
Views: 1514
Reputation: 10843
oxigraph ( https://github.com/oxigraph/oxigraph ) ! (also you may find related project interesting https://crates.io/crates/reasonable )
And btw. it looks like rdflib-endpoint (mentioned earlier) can via rdflib-endpoint --store Oxigraph ...
be configured to use oxigraph!
cargo install oxigraph_server
mkdir -p oxigraph_data
oxigraph_server --location oxigraph_data load -f example.ttl
oxigraph_server --location oxigraph_data serve
And you can check it in browser (probably on http://localhost:7878/ ) or form command line:
curl -G 'http://localhost:7878/query' --data-urlencode "query=PREFIX rdf:
<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?sub ?pred ?obj WHERE {
?sub ?pred ?obj .
} LIMIT 10" -H "Accept: application/sparql-results+json"|jq
copy from https://crates.io/crates/oxigraph_server#usage
Run oxigraph_server --location my_data_storage_directory serve
to start the server where my_data_storage_directory
is the directory where you want Oxigraph data to be stored. It listens by default on localhost:7878
.
The server provides an HTML UI, based on YASGUI, with a form to execute SPARQL requests.
OR
Via Docker:
Copy from https://crates.io/crates/oxigraph_server#using-a-docker-image :
docker run --rm ghcr.io/oxigraph/oxigraph --help
Expose the server on port 7878
of the host machine, and save data on the local ./data
folder
docker run --rm -v $PWD/data:/data -p 7878:7878 ghcr.io/oxigraph/oxigraph --location /data serve --bind 0.0.0.0:7878
https://stackoverflow.com/a/77737438/544721
You can then access it from your machine on port 7878
:
# Open the GUI in a browser
firefox http://localhost:7878
# Post some data
curl http://localhost:7878/store?default -H 'Content-Type: text/turtle' -T ./data.ttl
# Make a query
curl -X POST -H 'Accept: application/sparql-results+json' -H 'Content-Type: application/sparql-query' --data 'SELECT * WHERE { ?s ?p ?o } LIMIT 10' http://localhost:7878/query
# Make an UPDATE
curl -X POST -H 'Content-Type: application/sparql-update' --data 'DELETE WHERE { <http://example.com/s> ?p ?o }' http://localhost:7878/update
Upvotes: 2
Reputation: 22042
Using Eclipse RDF4J via docker:
docker pull eclipse/rdf4j-workbench:latest
docker run -p 8080:8080 eclipse/rdf4j-workbench:latest
and then access at http://localhost:8080/rdf4j-workbench
Upvotes: 1
Reputation: 132
Maybe https://triplydb.com is interesting for you. You can create datasets like this. https://triplydb.com/Triply/linkedmdb/sparql/linkedmdb
Upvotes: 1
Reputation: 16630
A java based solution is:
https://jena.apache.org/download/index.cgi
Down the Apache Jena Fuseki zip.
Unpack the zip, run fuseki-server
.
Goto http://localhost:3030/
Upvotes: 3
Reputation: 2492
If one has already a Python environment then rdflib-endpoint provides a simple solution with only two commands
pip install rdflib-endpoint
(run once)rdflib-endpoint serve <path_to_your_triple-file(s)>
Upvotes: 2