Closed sroertgen closed 11 months ago
@nichtich somehow I can't assign you as a reviewer. Maybe I have to add you to the organization?
Yes, I suppose only members can review. Your changes look good but docker handling is instable (does not run on my machine) because:
fuseki
was already be used: better name it validate-skos-fuseki
Here is a fix:
diff --git a/scripts/validate-skos b/scripts/validate-skos
index f2bd1a9..0a1f9ef 100755
--- a/scripts/validate-skos
+++ b/scripts/validate-skos
@@ -27,7 +27,7 @@ die() {
cleanup() {
rm -f -- $testfile
rm -f -- $result
- docker container stop fuseki > /dev/null
+ docker container stop validate-skos-fuseki > /dev/null
}
trap cleanup 0 2 3 15
@@ -82,8 +82,8 @@ else
fi
# Check if the container is running
-if docker ps | grep -q "fuseki"; then
- docker stop fuseki
+if docker ps | grep -q "validate-skos-fuseki"; then
+ docker stop validate-skos-fuseki
sleep 1
fi
@@ -94,10 +94,12 @@ attempt=1
while [ $attempt -le $max_attempts ]; do
# start fuseki
- docker run -d --rm --name fuseki -p 3030:3030 -v $(pwd)/fuseki/config_inference.ttl:/fuseki/config_inference.ttl skohub/jena-fuseki:latest /jena-fuseki/fuseki-server --config /fuseki/config_inference.ttl > /dev/null
+ docker run -d --rm --name validate-skos-fuseki -p 0:3030 -v $(pwd)/fuseki/config_inference.ttl:/fuseki/config_inference.ttl skohub/jena-fuseki:latest /jena-fuseki/fuseki-server --config /fuseki/config_inference.ttl > /dev/null
# echo "Attempt $attempt/$max_attempts"
+ port=$(docker port validate-skos-fuseki 3030/tcp | head -1 | awk -F: '{print $2}')
+
sleep $delay
- curl 'http://localhost:3030/$/ping' > /dev/null && break
+ curl "http://localhost:$port/$/ping" > /dev/null && break
# echo "Failed. Fuseki not yet there. Retrying in $delay seconds..."
attempt=$((attempt + 1))
done
@@ -109,13 +111,13 @@ fi
# upload file
curl --request POST \
- --url 'http://localhost:3030/dataset/data?graph=default' \
+ --url "http://localhost:$port/dataset/data?graph=default" \
--header 'Content-Type: text/turtle' \
--data-binary @$testfile > /dev/null
# validate w/ shacl
curl --request POST \
- --url 'http://localhost:3030/dataset/shacl?graph=default' \
+ --url "http://localhost:$port/dataset/shacl?graph=default" \
--header 'Content-Type: text/turtle' \
--data-binary @$shape > "$result"
Apart from that, starting and stopping a docker container for each run is rather slow but not slow enough to change the code :-)
Thanks!
Apart from that, starting and stopping a docker container for each run is rather slow but not slow enough to change the code :-)
Yes, that is also bit bothering me. It might be ok, when only checking one file. It's quite excessive for checking the test cases, though. If a faster and more elegant solution comes to your mind, I'll be happy to hear!
I added all consistency examples from the SKOS reference as test cases and cleaned up the shape.
To make this work I had to introduce two major changes:
Because of the brevity of the examples reasoning based on the class and property definitions was needed to correctly validate them. E.g. https://www.w3.org/TR/skos-reference/#example-27 only validates correctly with reasoning applied. So I ended up adding these definitions to the test file during validation. All test cases are now correctly validated.
@nichtich would you mind reviewing?
If this ok, I will start working on #6 and add best practice and SkoHub specific shapes.