Skip to content

Make committed TriG base-relative (base applied at load time) #23

Make committed TriG base-relative (base applied at load time)

Make committed TriG base-relative (base applied at load time) #23

name: SHACL validation
on:
push:
paths:
- 'datasets/current/**'
- 'etl/shapes/**'
- 'etl/lib/validate.sh'
- 'etl/lib/shacl.sh'
- '.github/workflows/shacl-validation.yml'
pull_request:
paths:
- 'datasets/current/**'
- 'etl/shapes/**'
- 'etl/lib/validate.sh'
- 'etl/lib/shacl.sh'
- '.github/workflows/shacl-validation.yml'
env:
JENA_VERSION: 6.1.0
# committed TriG is base-relative; resolve against the prod base for validation
BASE: https://linkeddata.lt/
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Cache Apache Jena
id: jena-cache
uses: actions/cache@v4
with:
path: ~/jena
key: apache-jena-${{ env.JENA_VERSION }}
- name: Download Apache Jena
if: steps.jena-cache.outputs.cache-hit != 'true'
run: |
curl -fsSL "https://archive.apache.org/dist/jena/binaries/apache-jena-${JENA_VERSION}.tar.gz" -o /tmp/jena.tar.gz
echo "$(curl -fsSL "https://archive.apache.org/dist/jena/binaries/apache-jena-${JENA_VERSION}.tar.gz.sha512" | awk '{print $1}') /tmp/jena.tar.gz" | sha512sum -c -
mkdir -p ~/jena
tar -xzf /tmp/jena.tar.gz -C ~/jena --strip-components=1
- name: Validate datasets
run: |
export JENA_HOME="$HOME/jena"
rc=0
# settlements.trig/streets.trig are gitignored (bulk) — absent here,
# validated during local `make` runs instead
for f in datasets/current/*/*.trig; do
domain=$(basename "$(dirname "$f")")
echo "::group::$f"
case "$(basename "$f")" in
# overlay files (owl:sameAs/foaf:depiction onto other files' graphs):
# graph invariants intentionally absent, so skip validate.sh
alignments.trig|photos.trig)
etl/lib/shacl.sh "etl/shapes/$domain.ttl" "$f" "$BASE" \
|| { rc=1; echo "::error file=$f::SHACL validation failed"; echo "- FAIL: $f" >> "$GITHUB_STEP_SUMMARY"; } ;;
*)
etl/lib/validate.sh "$f" "$BASE" \
|| { rc=1; echo "::error file=$f::validation failed"; echo "- FAIL: $f" >> "$GITHUB_STEP_SUMMARY"; } ;;
esac
echo "::endgroup::"
done
exit $rc