From 47e9bc6387c098ab25a083b17e33f10fdabab096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20H=C3=B6ffner?= Date: Fri, 23 Sep 2022 13:54:12 +0200 Subject: [PATCH 1/5] Add Docker Compose template for SPARQL endpoint and RDF browser. Resolve #96. --- docker/.env.dist | 1 + docker/README.md | 13 +++++++++++++ docker/docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ docker/initdb.d/setup.sql | 9 +++++++++ docker/rdf/example.ttl | 19 +++++++++++++++++++ 5 files changed, 77 insertions(+) create mode 100644 docker/.env.dist create mode 100644 docker/README.md create mode 100644 docker/docker-compose.yml create mode 100644 docker/initdb.d/setup.sql create mode 100644 docker/rdf/example.ttl diff --git a/docker/.env.dist b/docker/.env.dist new file mode 100644 index 0000000..612efe5 --- /dev/null +++ b/docker/.env.dist @@ -0,0 +1 @@ +DBA_PASSWORD=changeme diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..90411a5 --- /dev/null +++ b/docker/README.md @@ -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 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..f25b791 --- /dev/null +++ b/docker/docker-compose.yml @@ -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: diff --git a/docker/initdb.d/setup.sql b/docker/initdb.d/setup.sql new file mode 100644 index 0000000..0409ae8 --- /dev/null +++ b/docker/initdb.d/setup.sql @@ -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'); + diff --git a/docker/rdf/example.ttl b/docker/rdf/example.ttl new file mode 100644 index 0000000..5c6f79d --- /dev/null +++ b/docker/rdf/example.ttl @@ -0,0 +1,19 @@ +@prefix rdfs: . +@prefix owl: . +@prefix ex: . + +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. From 063cc4ecdd291d57bbbc212b52f84abc072fb914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20H=C3=B6ffner?= Date: Fri, 23 Sep 2022 19:36:42 +0200 Subject: [PATCH 2/5] Update docker/README.md Co-authored-by: Ted Thibodeau Jr --- docker/README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docker/README.md b/docker/README.md index 90411a5..804936e 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,13 +1,14 @@ Simple template for a Docker Compose setup with a SPARQL Endpoint and RDF browser for a small knowledge base. -# Run +# Localize -1. `docker compose up --build` -2. test the SPARQL endpoint http://localhost:8890/sparql and the RDF browser at http://localhost:8080/ +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` -# Adapt +# Start to use -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 +1. Run `docker compose up --build` +2. Test the SPARQL endpoint at [`http://localhost:8890/sparql`](http://localhost:8890/sparql) +2. Test the RDF browser at [`http://localhost:8080/`](http://localhost:8080/) From 11ef8a774bd36b2b687a4d8ff3c53727acdcc7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20H=C3=B6ffner?= Date: Fri, 23 Sep 2022 19:39:36 +0200 Subject: [PATCH 3/5] Improve formatting of docker/rdf/example.ttl Co-authored-by: Ted Thibodeau Jr --- docker/rdf/example.ttl | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docker/rdf/example.ttl b/docker/rdf/example.ttl index 5c6f79d..44627e7 100644 --- a/docker/rdf/example.ttl +++ b/docker/rdf/example.ttl @@ -1,19 +1,20 @@ -@prefix rdfs: . -@prefix owl: . -@prefix ex: . +PREFIX rdfs: +PREFIX owl: +PREFIX ex: ex:ExClass - a owl:Class; - rdfs:comment "an example class"@en; - rdfs:label "example class"@en. + 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. + a ex:ExClass ; + ex:exProperty 5 ; + 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. + a owl:DatatypeProperty ; + rdfs:domain ex:ExClass ; + rdfs:label "Beispielproperty"@de , + "example property"@en . From 2315368ca83b06939f242bcef39665f1ecdae368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20H=C3=B6ffner?= Date: Fri, 23 Sep 2022 19:44:54 +0200 Subject: [PATCH 4/5] Update docker/README.md Co-authored-by: Ted Thibodeau Jr --- docker/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/README.md b/docker/README.md index 804936e..f166522 100644 --- a/docker/README.md +++ b/docker/README.md @@ -1,4 +1,4 @@ -Simple template for a Docker Compose setup with a SPARQL Endpoint and RDF browser for a small knowledge base. +Simple template for a Docker Compose setup based on [Virtuoso](https://github.com/openlink/virtuoso-opensource/), providing an RDF store, SPARQL Endpoint, and RDF browser (among other available features) for a quick knowledge base deployment. # Localize From bee0b51cf79c8d23996a15bd9e570ca03eb60a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20H=C3=B6ffner?= Date: Sun, 25 Sep 2022 10:51:58 +0200 Subject: [PATCH 5/5] Use LodView instead of RickView. --- docker/README.md | 2 +- docker/docker-compose.yml | 20 +++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/docker/README.md b/docker/README.md index f166522..3b050f3 100644 --- a/docker/README.md +++ b/docker/README.md @@ -11,4 +11,4 @@ Simple template for a Docker Compose setup based on [Virtuoso](https://github.co 1. Run `docker compose up --build` 2. Test the SPARQL endpoint at [`http://localhost:8890/sparql`](http://localhost:8890/sparql) -2. Test the RDF browser at [`http://localhost:8080/`](http://localhost:8080/) +2. Test the RDF browser at [`http://localhost:8080/ExInstance`](http://localhost:8080/ExInstance) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index f25b791..e2da7b3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -16,20 +16,14 @@ services: - "127.0.0.1:8890:8890" restart: unless-stopped - rickview: - image: ghcr.io/konradhoeffner/rickview:master + lodview: + image: ghcr.io/konradhoeffner/lodview:22.05 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 + - LodViewendpoint=http://virtuoso:8890/sparql + - LodViewIRInamespace=http://example.org/ + - LodViewhomeUrl=/ExInstance ports: - "127.0.0.1:8080:8080" + depends_on: + - virtuoso restart: unless-stopped - -volumes: - rdf: