This project provides a Docker-based setup for running Apache Jena Fuseki, initializing a TDB2 dataset, loading your ontology, and running SPARQL queries efficiently.
Everything is automated with scripts for smooth operation.
Spin up the Fuseki server using Docker Compose:
docker compose -f ./BIO-STREAMS-KG-Docker/docker-compose.yml up -d
To stop the server:
docker compose -f ./BIO-STREAMS-KG-Docker/docker-compose.yml down
We avoid the complexity of custom Docker images by using a script to create the dataset dynamically.
Make the setup script executable and run it:
chmod +x ./scripts/setup-fuseki.sh
./scripts/setup-fuseki.sh
You can load your ontology using either the provided script or a direct curl
command.
chmod +x ./scripts/load-ontology.sh
./scripts/load-ontology.sh
curl -u admin:admin -X POST \
-H "Content-Type: application/rdf+xml" \
--data-binary "@BIO-STREAMS-Ontology.rdf" \
"http://localhost:3030/biostreams/data"
To verify that the dataset is up and running, run a simple test query:
curl -G http://localhost:3030/biostreams/query \
--data-urlencode "query=SELECT * WHERE { ?s ?p ?o } LIMIT 10"
You should see results in JSON format, confirming your dataset is active!
Use the script to run any SPARQL query file against your knowledge graph.
Run a query (provide the path to your SPARQL query file):
chmod +x ./scripts/run-sparql-query.sh
./scripts/run-sparql-query.sh ./data/SPARQL-Query1.txt
- The Fuseki configuration (
BIO-STREAMS-Fuseki-Config.ttl
) is simple and effective. - Whether you load the config at startup (
--config=fuseki-config.ttl
), create the dataset via the UI, or use the HTTP API, the result is the same. - Using the provided setup script avoids the need for custom Docker images like the one in
BIO-STREAMS-KG-Docker-Custom
.
BIO-STREAMS-KG-Docker/ # Docker Compose setup
BIO-STREAMS-KG-Docker-Custom/ # (Optional) Custom Docker image setup
scripts/ # Automation scripts
data/ # Ontology and SPARQL query files
BIO-STREAMS-Fuseki-Config.ttl # Fuseki assembler config (optional)
BIO-STREAMS-Ontology.rdf # Ontology RDF/XML file
- Username:
admin
- Password:
admin
Make sure to change these credentials in production environments!
Enjoy working with the BIO-STREAMS Knowledge Graph! 🎉