forked from open223/explore.open223.info
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-site.sh
executable file
·68 lines (53 loc) · 2.77 KB
/
build-site.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -ex
# make an array of Brick versions
BRICK_VERSIONS="1.3 1.4 1.4.1 1.4.2"
# Create a temporary directory
#TEMP_DIR=$(mktemp -d)
rm -rf /tmp/rdf-toolkit
TEMP_DIR=/tmp/rdf-toolkit
CURRENT_DIR=$(pwd)
DEST=$CURRENT_DIR/site
mkdir -p $DEST
# Clone the repository and navigate into it
git clone https://github.com/KrishnanN27/rdf-toolkit "$TEMP_DIR"
cd "$TEMP_DIR"
cp $CURRENT_DIR/rdfconfig.json "$TEMP_DIR/explorer/"
# Install dependencies
npm ci
# Build NPM package
npm run build
npm install @rdf-toolkit/cli
# Copy ontologies to the appropriate directory
#mkdir -p "$TEMP_DIR/rdf-toolkit/explorer/vocab"
#cp -R $CURRENT_DIR/ontologies/ "$TEMP_DIR/rdf-toolkit/explorer/vocab"
#tree $TEMP_DIR/rdf-toolkit/explorer/vocab
# Copy config file
#cp $CURRENT_DIR/rdfconfig.json "$TEMP_DIR/rdf-toolkit/explorer/"
# download the latest version of Brick from github
wget -O $CURRENT_DIR/ontologies/brick/latest/Brick.ttl https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
# do the generic version-agnostic stuff first
cd "$TEMP_DIR/explorer"
npx rdf add file "https://brickschema.org/schema/Brick" $CURRENT_DIR/ontologies/brick/latest/Brick.ttl
npx rdf add file "http://qudt.org/2.1/schema/shacl/qudt" $CURRENT_DIR/ontologies/SCHEMA_QUDT_NoOWL-v2.1.ttl
npx rdf add file "http://qudt.org/2.1/vocab/unit" $CURRENT_DIR/ontologies/VOCAB_QUDT-UNITS-ALL-v2.1.ttl
npx rdf add file "http://qudt.org/2.1/vocab/quantitykind" $CURRENT_DIR/ontologies/VOCAB_QUDT-QUANTITY-KINDS-ALL-v2.1.ttl
npx rdf add file "http://www.w3.org/ns/shacl" $CURRENT_DIR/ontologies/shacl.ttl
npx rdf add file "https://brickschema.org/schema/Brick/ref" $CURRENT_DIR/ontologies/ref-schema.ttl
npx rdf add file "https://w3id.org/rec" $CURRENT_DIR/ontologies/rec.ttl
npx rdf make site --output "$DEST/$version" --project "$TEMP_DIR/explorer" --base ''
# loop through and build the site for each version by calling './b2.sh <version>'
for version in $BRICK_VERSIONS; do
git checkout package.json
# download the Brick version from https://brickschema.org/schema/$version/Brick.ttl
# if the version is 'latest', then pull from https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
# put the result in vocab/brick/$version/Brick.ttl
mkdir -p $CURRENT_DIR/ontologies/brick/$version
wget -O $CURRENT_DIR/ontologies/brick/$version/Brick.ttl https://brickschema.org/schema/$version/Brick.ttl
#./b2.sh $version
cd "$TEMP_DIR/explorer"
npx rdf add file "https://brickschema.org/schema/$version/Brick" $CURRENT_DIR/ontologies/brick/$version/Brick.ttl
npx rdf make site --output "$DEST/$version" --project "$TEMP_DIR/explorer" --base $version
done
# Run add_versions.py on all .html files in the site directory
find "$DEST" -name "*.html" | xargs -n 1 -P 8 uv run "$CURRENT_DIR/add_versions.py" "$DEST"