-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdump_all_categories.sh
More file actions
57 lines (49 loc) · 1.43 KB
/
dump_all_categories.sh
File metadata and controls
57 lines (49 loc) · 1.43 KB
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
#!/usr/bin/env bash
set -euo pipefail
REPO="/Volumes/Extreme Pro/FKG/SHACL-API-Docker"
DUMP_DIR="/Volumes/Extreme Pro/FKG/tsv_dumps"
SCRIPT="$REPO/dump_ttl_to_tsv.py"
mkdir -p "$DUMP_DIR"
cd "$REPO"
CATEGORIES=(
Creative_Work
Quantity_Dimension
Location
Food
Language
Organism
Equity
Index
Corporate_Bond
Government_Bond
)
for cat in "${CATEGORIES[@]}"; do
lower=$(echo "$cat" | tr '[:upper:]' '[:lower:]')
entry="${lower}_entry.ttl"
entity="${lower}_entity.ttl"
output="$DUMP_DIR/${lower}_dump.tsv"
if [ -f "$output" ]; then
lines=$(wc -l < "$output")
echo "⏭ $cat: already dumped ($lines lines), skipping"
continue
fi
if [ ! -f "$entry" ] || [ ! -f "$entity" ]; then
echo "⚠️ $cat: missing TTL files, skipping"
continue
fi
python3 "$SCRIPT" "$cat" "$entry" "$entity" "$output"
echo ""
done
echo "═══════════════════════════════════════════"
echo "All dumps complete. Summary:"
echo "═══════════════════════════════════════════"
for cat in "${CATEGORIES[@]}"; do
lower=$(echo "$cat" | tr '[:upper:]' '[:lower:]')
output="$DUMP_DIR/${lower}_dump.tsv"
if [ -f "$output" ]; then
lines=$(wc -l < "$output")
printf " %-25s %s lines\n" "$cat" "$lines"
else
printf " %-25s MISSING\n" "$cat"
fi
done