-
Notifications
You must be signed in to change notification settings - Fork 1
/
get_source_data
executable file
·67 lines (55 loc) · 1.86 KB
/
get_source_data
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
#!/usr/bin/env bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $DIR/config
if [[ "$QUERY" != "queries/.sparql" ]];
then
# If QUERY does not equal nothing, then it is something.
DATASET=$1
if [[ "$DATASET" == "subjects" || "$DATASET" == "childrensSubjects" || "$DATASET" == "names" ]];
then
SAVEFILE="data/$DATASET.rdf"
DBDIR="/authorities/$DATASET/"
echo $QUERY
echo "Fetching $DATASET"
echo $SAVEFILE
echo $DBDIR
curl -s $AUTHMETHOD --user "$MLUSER:$MLPASS" -X POST \
--data-binary @queries/get_all_triples.sparql \
-H "Content-type: application/sparql-query" \
-H "Accept: application/rdf+xml" \
-o $SAVEFILE \
"http://$SOURCEDATA_HOST:$MLPORT/v1/graphs/sparql?database=$SOURCEDATA_DB&directory=$DBDIR"
fi
else
cd $DIR/data
FILE="subjects.rdf"
if ! [ -f "$FILE" ];
then
echo "Fetching and unpacking Subjects."
curl -OL https://lds-downloads.s3.amazonaws.com/tmp/202306_subjects_raw.tar.gz
tar -xzf 202306_subjects_raw.tar.gz
fi
FILE="childrensSubjects.rdf"
if ! [ -f "$FILE" ];
then
echo "Fetching and unpacking Children's Subjects."
curl -OL https://lds-downloads.s3.amazonaws.com/tmp/202306_childrensSubjects_raw.tar.gz
tar -xzf 202306_childrensSubjects_raw.tar.gz
fi
#FILE="names.rdf"
#if ! [ -f "$FILE" ];
#then
# echo "Fetching and unpacking Names."
# curl -OL https://lds-downloads.s3.amazonaws.com/tmp/202306_names_raw.tar.gz
# tar -xzf 202306_names_raw.tar.gz
#fi
FILE="external_links.nt"
if ! [ -f "$FILE" ];
then
echo "Fetching external relationships."
curl -OL https://lds-downloads.s3.amazonaws.com/externallinks.nt.zip
unzip externallinks.nt.zip
fi
cd $DIR
fi
exit 1