Skip to content

Commit

Permalink
Merge branch 'skosmos-3' into sidebar-tabs-configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
UnniKohonen committed Aug 31, 2023
2 parents 391fa21 + 76def2f commit edb2e8e
Show file tree
Hide file tree
Showing 60 changed files with 687 additions and 284 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php_version }}
php_extensions: gettext intl xsl pcov
php_extensions: intl xsl pcov

- name: Install Node
uses: actions/setup-node@v3
Expand All @@ -71,7 +71,7 @@ jobs:
with:
version: 9.5
php_version: ${{ matrix.php_version }}
php_extensions: gettext intl xsl pcov
php_extensions: intl xsl pcov
memory_limit: 512M
configuration: phpunit.xml

Expand Down
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
"willdurand/negotiation": "3.1.*",
"punic/punic": "3.5.1",
"ml/json-ld": "1.*",
"ext-gettext": "*",
"ext-intl": "*",
"ext-mbstring": "*",
"ext-xsl": "*",
"monolog/monolog": "1.27.*"
"monolog/monolog": "1.27.*",
"symfony/translation": "6.0.*",
"symfony/translation-contracts": "3.0.*",
"symfony/twig-bundle": "6.0.*",
"symfony/config": "6.0.*"
},
"require-dev": {
"phpunit/phpunit": "9.5.*",
Expand Down
11 changes: 9 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { defineConfig } = require("cypress")

module.exports = defineConfig({
projectRoot: "tests",
e2e: {
// You also can run like this: npx cypress run --config "baseUrl=http://localhost/skosmos"
// You also can run like this: npx cypress run --config "baseUrl=http://localhost/Skosmos"
baseUrl: 'http://localhost/Skosmos',
setupNodeEvents(on, config) {
on('task', {
Expand All @@ -16,5 +17,11 @@ module.exports = defineConfig({
}
})
},
},
supportFile: false,
specPattern: [
'tests/cypress/accessibility/**/*.cy.js',
'tests/cypress/template/**/*.cy.js',
'tests/cypress/e2e/**/*.cy.js'
]
}
})
57 changes: 39 additions & 18 deletions dockerfiles/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
Dockerfiles for Skosmos.

## Prerequisites

The following software versions were tested successfully with
the docker configuration files used in this document.

- Ubuntu Linux jammy 22.04.3 LTS
- Docker version 24.0.5, build ced0996
- Docker Compose version v2.20.2
- Internet connection to download base images and other dependencies
- At least 1G of storage space for the images (~530M for Skosmos,
~140M for Jena Fuseki, and ~260M for Varnish cache), or more
depending on your use of vocabularies and data

## Running with Docker

The following commands will build and tag the image it with `skosmos:test`,
Expand All @@ -25,7 +38,7 @@ with the vocabulary data, and to be available at `http://localhost:3030`.
For this last requisite you must create a
[Docker network](https://docs.docker.com/network/network-tutorial-standalone/),
use [`--net=host`](https://docs.docker.com/network/host/) or other mechanisms for
that. See the section [Running with docker-compose](#running-with-docker-compose)
that. See the section [Running with docker compose](#running-with-docker-compose)
if you would like to use Docker Compose.

To stop the container:
Expand All @@ -43,22 +56,30 @@ two files as necessary.

**NOTE**: If you would like to start a Fuseki container to test with Docker only,
without Docker Compose, you can try the following command before loading your
vocabulary data. It starts a container in the same way our other example with
the `docker-compose` command.
vocabulary data. It starts a container in the same way as our other example with
the `docker compose` command.

export JENA_4_VERSION=4.8.0

docker build -t jena-fuseki:$JENA_4_VERSION \
--build-arg JENA_VERSION=$JENA_4_VERSION \
--no-cache dockerfiles/jena-fuseki2-docker

docker run --name fuseki --rm -ti \
-v $(pwd)/dockerfiles/config/skosmos.ttl:/fuseki/skosmos.ttl \
-e "JAVA_OPTIONS=-Xmx2g -Xms1g" \
-p 3030:3030 \
jena-fuseki:$JENA_4_VERSION \
--config=/fuseki/skosmos.ttl

docker run --name fuseki -ti --rm \
--env "ADMIN_PASSWORD=admin" --env "JVM_ARGS=-Xmx2g" \
-p 3030:3030 \
--mount type=bind,src=$(pwd)/config/skosmos.ttl,dst=/fuseki/configuration/skosmos.ttl \
stain/jena-fuseki
curl -XPOST http://localhost:3030/skosmos/query -d "query=SELECT ?a WHERE { ?a ?b ?c }"

## Running with docker-compose
## Running with docker compose

The `docker-compose` provided configuration will prepare three containers.
The first one called `skosmos-fuseki`, which uses the `stain/jena-fuseki`
image for Jena, and starts a container with 2 GB of memory and `admin` as
the user and password. The `docker-compose` service name of this container
is `fuseki`.
The `docker compose` provided configuration will prepare three containers.
The first one called `skosmos-fuseki`, which uses the Apache Jena
image for Fuseki, and starts a container with 2 GB of memory. The
`docker compose` service name of this container is `fuseki`.

The second container is the `fuseki-cache`, a Varnish Cache container. It sits
between the `skosmos-fuseki` and the `skosmos-web` (more on this below). The
Expand All @@ -83,22 +104,22 @@ and `localhost:9031` respectively.
To create the containers in this example setup, you can use this command
from the `./dockerfiles/` directory:

docker-compose up -d
docker compose up -d

Now Skosmos should be available at `http://localhost:9090/` from your
host. See the [section below](#loading-vocabulary-data) to load vocabulary data.

To stop:

docker-compose down
docker compose down

## Loading vocabulary data

After you have your container running, with either Docker or `docker-compose`,
After you have your container running, with either Docker or `docker compose`,
you will need to load your vocabulary data.

**NOTE**: In the example below, we use the Fuseki URL `localhost:3030`, which
should work for the Docker setup. If you used `docker-compose`, you will have
should work for the Docker setup. If you used `docker compose`, you will have
to use `localhost:9030` instead.

# load STW vocabulary data
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 ]
]
) .
)
.
31 changes: 18 additions & 13 deletions dockerfiles/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@ services:
fuseki:
container_name: skosmos-fuseki
hostname: fuseki
image: stain/jena-fuseki
build:
context: ../dockerfiles/jena-fuseki2-docker
dockerfile: Dockerfile
args:
JENA_VERSION: 4.8.0
command: --config=/fuseki/skosmos.ttl
environment:
- ADMIN_PASSWORD=admin
- JVM_ARGS=-Xmx2g
- JAVA_OPTIONS=-Xmx2g -Xms1g
ports:
- 9030:3030
# You can uncomment the line below to have a local volume bound onto the container, or
# visit https://hub.docker.com/r/stain/jena-fuseki/ for other alternatives
# volumes:
# - ${PWD}/fuseki:/fuseki
- '9030:3030'
volumes:
- type: bind
source: ./config/skosmos.ttl
target: /fuseki/configuration/skosmos.ttl
# You can uncomment the lines below to persist data used in the
# container. For more complete documentation about it, please
# consult the official Apache Jena docs at
# https://github.com/apache/jena/tree/main/jena-fuseki2/jena-fuseki-docker
# - ./databases:/fuseki/databases
# - ./logs:/fuseki/logs
- ./config/skosmos.ttl:/fuseki/skosmos.ttl
user: 'fuseki:fuseki'
fuseki-cache:
container_name: skosmos-fuseki-cache
hostname: fuseki-cache
image: varnish
ports:
- 9031:80
- '9031:80'
volumes:
- type: bind
source: ./config/varnish-default.vcl
Expand All @@ -35,7 +40,7 @@ services:
context: ..
dockerfile: dockerfiles/Dockerfile.ubuntu
ports:
- 9090:80
- '9090:80'
depends_on:
- fuseki
- fuseki-cache
Expand Down
Loading

0 comments on commit edb2e8e

Please sign in to comment.