Skip to content

Commit

Permalink
WIP simplifying the docker configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kinow committed Jul 3, 2023
1 parent 50f74b0 commit 65b9ecd
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 62 deletions.
16 changes: 8 additions & 8 deletions dockerfiles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,11 @@ extension.
To the host machine Docker Compose is exposing these values as `localhost:3030`
and `localhost:9031` respectively.

Before creating the containers, you will have to initialize an Apache Fuseki
dataset to be used by the `skosmos-fuseki` container.
Before starting the Docker Compose containers, you need to create the directories
for the volumes used in the Apache Jena Fuseki, so that they are writable by
your user.

cd dockerfiles/

mkdir -p databases/skosmos
# You need to install an Apache Jena Binary Distribution version
# from https://jena.apache.org/download/index.cgi
tdb2.tdbloader --loc databases/skosmos ./config/config-docker-compose.ttl
mkdir ./databases

To create the containers in this example setup, you can use this command
from the `./dockerfiles/` directory:
Expand All @@ -110,6 +106,10 @@ from the `./dockerfiles/` directory:
Now Skosmos should be available at `http://localhost:9090/` from your
host. See the [section below](#loading-vocabulary-data) to load vocabulary data.

Use `curl` to create the Apache Jena TDB2 dataset used by Skosmos.

curl -X POST

To stop:

docker-compose down
Expand Down
92 changes: 40 additions & 52 deletions dockerfiles/config/skosmos.ttl
Original file line number Diff line number Diff line change
@@ -1,85 +1,73 @@
@prefix : <http://base/#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix tdb2: <http://jena.apache.org/2016/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix tdb2: <http://jena.apache.org/2016/tdb#> .
@prefix text: <http://jena.apache.org/text#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .

ja:DatasetTxnMem rdfs:subClassOf ja:RDFDataset .
ja:MemoryDataset rdfs:subClassOf ja:RDFDataset .
ja:RDFDatasetOne rdfs:subClassOf ja:RDFDataset .
ja:RDFDatasetSink rdfs:subClassOf ja:RDFDataset .
ja:RDFDatasetZero rdfs:subClassOf ja:RDFDataset .

tdb2:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb2:DatasetTDB2 rdfs:subClassOf ja:RDFDataset .

tdb2:GraphTDB rdfs:subClassOf ja:Model .
tdb2:GraphTDB2 rdfs:subClassOf ja:Model .

<http://jena.hpl.hp.com/2008/tdb#DatasetTDB>
rdfs:subClassOf ja:RDFDataset .

<http://jena.hpl.hp.com/2008/tdb#GraphTDB>
rdfs:subClassOf ja:Model .

text:TextDataset
rdfs:subClassOf ja:RDFDataset .
[] rdf:type fuseki:Server ;
fuseki:services (
:skosmos_service
)
.

:service_tdb_all a fuseki:Service ;
rdfs:label "TDB2+text skosmos" ;
fuseki:dataset :text_dataset ;
fuseki:name "skosmos" ;
fuseki:serviceQuery "query" , "" , "sparql" ;
fuseki:serviceReadGraphStore "get" ;
fuseki:serviceReadQuads "" ;
:skosmos_service rdf:type fuseki:Service ;
rdfs:label "TDB2+text skosmos" ;
fuseki:name "skosmos" ;
fuseki:serviceQuery "query" , "" , "sparql" ;
fuseki:serviceReadGraphStore "get" ;
fuseki:serviceReadQuads "" ;
fuseki:serviceReadWriteGraphStore "data" ;
fuseki:serviceReadWriteQuads "" ;
fuseki:serviceUpdate "" , "update" ;
fuseki:serviceUpload "upload" .
fuseki:serviceReadWriteQuads "" ;
fuseki:serviceUpdate "" , "update" ;
fuseki:serviceUpload "upload" ;
fuseki:dataset :text_dataset
.

:text_dataset a text:TextDataset ;
text:dataset :tdb_dataset_readwrite ;
text:index :index_lucene .
:text_dataset rdf:type text:TextDataset ;
text:dataset :tdb_dataset_readwrite ;
text:index <#indexLucene>
.

:tdb_dataset_readwrite
a tdb2:DatasetTDB2 ;
# tdb2:unionDefaultGraph true ;
tdb2:location "/fuseki/databases/skosmos" .
:tdb_dataset_readwrite rdf:type tdb2:DatasetTDB2 ;
tdb2:location "/fuseki/databases/skosmos" ;
# tdb2:unionDefaultGraph true ;
.

:index_lucene a text:TextIndexLucene ;
text:directory <file:/fuseki/databases/skosmos/text> ;
text:entityMap :entity_map ;
text:storeValues true .
<#indexLucene> rdf:type text:TextIndexLucene ;
text:directory <file:/fuseki/databases/skosmos/text> ;
text:entityMap <#entMap> ;
text:storeValues true
.

# Text index configuration for Skosmos
:entity_map a text:EntityMap ;
text:entityField "uri" ;
text:graphField "graph" ;
<#entMap> rdf:type text:EntityMap ;
text:defaultField "pref" ;
text:entityField "uri" ;
text:uidField "uid" ;
text:langField "lang" ;
text:graphField "graph" ;
text:map (
# skos:prefLabel
[ text:field "pref" ;
text:predicate skos:prefLabel ;
text:analyzer [ a text:LowerCaseKeywordAnalyzer ]
text:analyzer [ rdf:type text:LowerCaseKeywordAnalyzer ]
]
# skos:altLabel
[ text:field "alt" ;
text:predicate skos:altLabel ;
text:analyzer [ a text:LowerCaseKeywordAnalyzer ]
text:analyzer [ rdf:type text:LowerCaseKeywordAnalyzer ]
]
# skos:hiddenLabel
[ text:field "hidden" ;
text:predicate skos:hiddenLabel ;
text:analyzer [ a text:LowerCaseKeywordAnalyzer ]
text:analyzer [ rdf:type text:LowerCaseKeywordAnalyzer ]
]
# skos:notation
[ text:field "notation" ;
text:predicate skos:notation ;
text:analyzer [ a text:LowerCaseKeywordAnalyzer ]
text:analyzer [ rdf:type text:LowerCaseKeywordAnalyzer ]
]
) .
)
.
6 changes: 4 additions & 2 deletions dockerfiles/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
dockerfile: Dockerfile
args:
JENA_VERSION: 4.8.0
command: --tdb2 --update --loc /fuseki/databases/ /skosmos
command: --update --desc=/fuseki/skosmos.ttl /skosmos
environment:
- JAVA_OPTIONS=-Xmx2g -Xms1048m
ports:
Expand All @@ -18,8 +18,10 @@ services:
# visit https://github.com/apache/jena/tree/main/jena-fuseki2/jena-fuseki-docker
# for other alternatives.
volumes:
- ./databases:/fuseki/databases
# - ./databases:/fuseki/databases
- ./config/skosmos.ttl:/fuseki/skosmos.ttl
- ./logs:/fuseki/logs
user: 'fuseki:fuseki'
fuseki-cache:
container_name: skosmos-fuseki-cache
hostname: fuseki-cache
Expand Down

0 comments on commit 65b9ecd

Please sign in to comment.