shacl-vue/tools/fetch_schemas.sh
Stephan Heunis ca7af32894 Helpers for getting default schemas and data
This is an interim solution in the form of shell scripts to fetch
datalad-concepts exports (shacl, owl) and to convert example data
to rdf, to allow using all of those as the default files for a
shacl-vue deployment. The ideal is to rather create a single base
schema in yaml, similar to the standard that we have followed in
other use cases e.g. trr379, inm7, etc, and to update the make files
that generate the schemas and data from there.
2025-04-22 18:35:36 +02:00

30 lines
764 B
Bash
Executable file

#!/bin/zsh
# File containing the list of class names
NAMES_FILE="schema_names.txt"
# Output directory
OUTPUT_DIR="./schemas"
# Base URL
BASE_URL="https://concepts.datalad.org/s"
# File types to fetch
EXTENSIONS=("shacl.ttl" "owl.ttl")
# Create the output directory if it doesn't exist
mkdir -p "$OUTPUT_DIR"
# Read each class name and fetch corresponding content for shacl and owl
while IFS= read -r name || [[ -n "$name" ]]; do
if [[ -n "$name" ]]; then
for ext in "${EXTENSIONS[@]}"; do
url="${BASE_URL}/${name}/unreleased.${ext}"
output_file="${OUTPUT_DIR}/${name}.${ext}"
echo "Fetching: $url -> $output_file"
curl -s "$url" -o "$output_file"
done
fi
done < "$NAMES_FILE"
echo "All files downloaded to '$OUTPUT_DIR'"