Docker image for Ontario. https://github.com/SDM-TIB/Ontario/
398
Docker image for Ontario. This image differs from kemele/ontario:0.5 in two points:
datasources.json (DATASOURCES_FILE) and config.json
(CONFIG_FILE) files are configurable via environment variablesCMD will generate CONFIG_FILE from the
DATASOURCES_FILE if the former does not existImage tags correspond to commits in Ontario github repos
This image has no ENTRYPOINT, just a no-args CMDwhose arguments will be
forwarded to the flask command that runs the SPARQL endpoint app.
Environment variables:
DATASOURCES_FILE (/config/datasources.json): File with a JSON array
containing the sources to be indexed/queried by Ontario.CONFIG_FILE (/config/config.json): File with RDF-MTs and data sources
to be queried by Ontario when mediating queriesPORT (5000): port where to listen for HTTP connections to the SPARQL
endpointLISTEN_ADDRESS (0.0.0.0): Address where to bind the HTTP server. By
default, listen on all addressesStart 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 rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
foaf:name a rdf:Property;
rdfs:domain foaf:Person;
rdfs:range xsd:string.
foaf:knows a rdf:Property;
rdfs:domain foaf:Person;
rdfs:range foaf:Person.
ex:Alice a foaf:Person;
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 rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
foaf:name a rdf:Property;
rdfs:domain foaf:Person;
rdfs:range xsd:string.
foaf:knows a rdf:Property;
rdfs:domain foaf:Person;
rdfs:range foaf:Person.
ex:Bob a foaf:Person;
foaf:name "Bob"@en;
foaf:age 22.
EOF
fuseki-server --port 3032 --file data.ttl /b
Generate a datasources.json from URLs to both SPARQL endpoints:
docker run -it --rm -v /tmp/ontario-config:/config alexishuf/ontario:b9ea028 \
generate-sparql-datasources.sh -o /config/datasources.json \
http://172.17.0.1:3031/a/sparql http://172.17.0.1:3032/b/sparql
172.17.0.1 may need to be changed to match
ip addr show docker0
The resulting /tmp/ontario-config/datasources.json file should look like this:
[
{
"name": "Fuseki A",
"ID": "fus_a",
"url": "http://172.17.0.1:3031/a/sparql",
"type": "SPARQL_Endpoint",
"mappings": {},
"params": []
},
{
"name": "Fuseki B",
"ID": "fus_b",
"url": "http://172.17.0.1:3032/b/sparql",
"type": "SPARQL_Endpoint",
"mappings": {},
"params": []
}
]
The
mappingsandparamsproperties MUST always be present indatasources.json, else Ontario will fail withKeyError
Run the container to find the RDF-MTs, generate
/tmp/ontario-config/config.json and run the SPARQL endpoint for the mediator
(all environment variables are explicitly set to their defaults):
docker run -it --rm -v /tmp/ontario-config:/config -p 5000:5000 \
--env PORT=5000 \
--env DATASOURCES_FILE=/config/datasources.json \
--env CONFIG_FILE=/config/config.json \
alexishuf/ontario:b9ea028
Send a query:
curl -v "http://localhost:5000/sparql?query=SELECT%20*%20WHERE%20%7B?s%20%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fname%3E%20?o%7D%20LIMIT%2010"
Ontario only allows SPARQL queries on the GET method and will reply with
cannot read queryif POSTing queries. Ontario also does not honor content-type negotiation and will always reply with JSON results
The following arguments can be set at build-time:
ONTARIO_REPO=https://github.com/SDM-TIB/Ontario.git git clone URL
(HTTP) of the Ontario repositoryONTARIO_REF=b9ea028 revision of Ontario to use. The default is the master
branch when this Dockerfile was written.Images should be tagged with the value of $ONTARIO_REF
Content type
Image
Digest
Size
1.1 GB
Last updated
about 5 years ago
docker pull alexishuf/ontario