Skip to content

Commit

Permalink
Add Docker Compose template for SPARQL endpoint and RDF browser. Resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
KonradHoeffner committed Sep 23, 2022
1 parent 3488335 commit 47e9bc6
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 0 deletions.
1 change: 1 addition & 0 deletions docker/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DBA_PASSWORD=changeme
13 changes: 13 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Simple template for a Docker Compose setup with a SPARQL Endpoint and RDF browser for a small knowledge base.

# Run

1. `docker compose up --build`
2. test the SPARQL endpoint http://localhost:8890/sparql and the RDF browser at http://localhost:8080/

# Adapt

1. replace rdf/example.ttl with your knowledge base
2. add your namespaces to initdb.d/setup.sql
3. adapt docker-compose.yml
4. copy .env.dist to .env and change DBA\_PASSWORD
35 changes: 35 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
services:

virtuoso:
image: openlink/virtuoso-opensource-7
environment:
- DBA_PASSWORD=${DBA_PASSWORD}
- VIRT_DATABASE_ERRORLOGLEVEL=3
- VIRT_SPARQL_DEFAULTGRAPH=http://example.org
- VIRT_SPARQL_DEFAULTQUERY=select distinct * {?s ?p ?o.} LIMIT 100
- VIRT_PARAMETERS_DIRSALLOWED=., /usr/local/virtuoso-opensource/share/virtuoso/vad, /rdf
- VIRT_PLUGINS_-=-
volumes:
- ./rdf:/rdf:ro
- ./initdb.d:/opt/virtuoso-opensource/initdb.d:ro
ports:
- "127.0.0.1:8890:8890"
restart: unless-stopped

rickview:
image: ghcr.io/konradhoeffner/rickview:master
environment:
- RICKVIEW_KB_FILE=/rdf/example.ttl
- RICKVIEW_TITLE=Example Title
- RICKVIEW_SUBTITLE=Example Subtitle
- RICKVIEW_PREFIX=ex
- RICKVIEW_NAMESPACE=http://example.org/
- RICKVIEW_EXAMPLES=ExClass ExProperty ExInstance
volumes:
- ./rdf:/rdf:ro
ports:
- "127.0.0.1:8080:8080"
restart: unless-stopped

volumes:
rdf:
9 changes: 9 additions & 0 deletions docker/initdb.d/setup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
log_message('Setup: Activate CORS');
update DB.DBA.HTTP_PATH set HP_OPTIONS = serialize(vector('browse_sheet', '', 'noinherit', 'yes', 'cors', '*', 'cors_restricted', 0)) where HP_LPATH = '/sparql';
log_message('Setup: Declare namespaces');
DB.DBA.XML_SET_NS_DECL ('ex', 'http://example.org/', 2);
log_message('Setup: Load data');
ld_dir_all ('/rdf/', '*.ttl', 'http://example.org');
rdf_loader_run();
log_message('Setup: Finished');

19 changes: 19 additions & 0 deletions docker/rdf/example.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix ex: <http://example.org/>.

ex:ExClass
a owl:Class;
rdfs:comment "an example class"@en;
rdfs:label "example class"@en.

ex:ExInstance
ex:exProperty 5;
a ex:ExClass;
rdfs:comment "an example instance."@en;
rdfs:label "example instance"@en.

ex:exProperty
a owl:DatatypeProperty;
rdfs:domain ex:ExClass;
rdfs:label "Beispielproperty"@de, "example property"@en.

0 comments on commit 47e9bc6

Please sign in to comment.