Sign inSign up

alexishuf/comunica

By alexishuf

•Updated about 5 years ago

Image
0

92

alexishuf/comunica repository overview

⁠comunica

Docker image for a Comunica⁠ SPARQL endpoint over multiple sources.

Image tags correspond to @comunica/comunica/actor-init-sparql⁠ versions.

This container entrypoint is comunica-sparql-http. The official docs contain a guide⁠ for setting up a federation and exposing a SPARQL endpoint.

Although comunica should auto-detect protocol of sources, this detection does not work for all SPARQL endpoints (e.g., it fails for Fuseki). Thus, prepending sparql@ in front of endpoint URLs may avoid suffering.

⁠Example

Start a SPARQL endpoint at http://0.0.0.0:3031/a/sparql

cd "$(mktemp -d)"
cat >data.ttl<<EOF
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:Alice foaf:name "Alice"@en;
         foaf:knows ex:Bob.
EOF
fuseki-server --port 3031 --file data.ttl /a

Start a second SPARQL endpoint at http://0.0.0.0:3032/b/sparql

cd "$(mktemp -d)"
cat >data.ttl<<EOF
@prefix ex: <http://example.org/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
ex:Bob foaf:name "Bob"@en;
       foaf:age 22.
EOF
fuseki-server --port 3032 --file data.ttl /b 

Start comunica as a SPARQL endpoint (replace 172.17.0.1 with the one shown in ip addr show docker0):

docker run -it --rm -p 8080:8080 alexishuf/comunica:1.23.1 \
  -l debug -p 8080 -t 600 \
  sparql@http://172.17.0.1:3031/a/sparql \
  sparql@http://172.17.0.1:3032/b/sparql

At least in versions 1.19.2 to 1.23.1 --lenient causes only the first source to be queried.

Send a query:

curl -H "Accept: text/tsv" -H "Content-Type: application/sparql-query" \
  -X POST --data @- http://localhost:8080/sparql <<EOF
PREFIX ex: <http://example.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT * WHERE {
  ?s foaf:name ?o .
}
EOF

Tag summary

Content type

Image

Digest

Size

356.9 MB

Last updated

about 5 years ago

docker pull alexishuf/comunica:1.21.3