1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # Before the Errata was introduced, the SPARQL query could be run
|
---|
4 | # directly against the DBPedia endpoint:
|
---|
5 | #
|
---|
6 | ##echo "Downloading SPARQL query: countries-in-esc-by-year.sparql"
|
---|
7 | ##./DBPEDIA-LOD-SPARQL-QUERY.sh countries-in-esc-by-year.sparql
|
---|
8 |
|
---|
9 | # Now a more complicated federated search is used.
|
---|
10 | # Because the DBPedia endpoint doesn't allow for queries that
|
---|
11 | # use SERIVCE to combine results from other endpoints, the
|
---|
12 | # query we issue is done on the local Greenstone Apache Jena endpoint,
|
---|
13 | # (which does have this facility on), where the Errata information is
|
---|
14 | # stored, but as part of the query run reaches out to the DBPedia endpoint.
|
---|
15 |
|
---|
16 | logfile="01-DOWNLOAD--runtime-log-$$.txt"
|
---|
17 | echo "Running bash script: $0" > "$logfile"
|
---|
18 | echo "" >> "$logfile"
|
---|
19 |
|
---|
20 | if [ $# == 0 ] ; then
|
---|
21 | sparql_query_list="local--countries-in-esc-by-year-in-1956--with-errata.sparql local--countries-in-esc-by-year-after-1956--with-errata.sparql"
|
---|
22 |
|
---|
23 | echo ""
|
---|
24 | echo "Away to run the query:"
|
---|
25 | echo ""
|
---|
26 | echo " $sparql_query_list"
|
---|
27 | echo ""
|
---|
28 |
|
---|
29 | echo "This can take a while to run. Worth considering running with 'nohup':"
|
---|
30 | echo " nohup $0 &"
|
---|
31 | echo ""
|
---|
32 |
|
---|
33 | echo "Sleeping for 5 seconds as an opportunity to ^C the script and rerun it"
|
---|
34 | echo "..."
|
---|
35 | sleep 5
|
---|
36 | echo "... continuing"
|
---|
37 |
|
---|
38 | else
|
---|
39 | sparql_query_list="$*"
|
---|
40 | fi
|
---|
41 |
|
---|
42 | for f in $sparql_query_list ; do
|
---|
43 |
|
---|
44 | echo "Downloading JSON content via SPARQL query:" | tee -a "$logfile"
|
---|
45 | echo " errata-lod/$f" | tee -a "$logfile"
|
---|
46 |
|
---|
47 | cd errata-lod \
|
---|
48 | && date >> "../$logfile" \
|
---|
49 | && ./LOCAL-LOD-QUERY.sh "$f" \
|
---|
50 | && date >> "../$logfile" \
|
---|
51 | && cd ..
|
---|
52 |
|
---|
53 | echo "" >> "$logfile"
|
---|
54 |
|
---|
55 | done
|
---|
56 |
|
---|
57 | echo ""
|
---|
58 | echo "Timed logged output:"
|
---|
59 | echo " $logfile"
|
---|
60 | echo ""
|
---|
61 |
|
---|
62 | # cd errata-lod \
|
---|
63 | # && date > runtime-log-$$.txt && ./LOCAL-LOD-QUERY.sh ./local--countries-in-esc-by-year-after-1956--with-errata.sparql && date >> runtime-log-$$.txt
|
---|
64 |
|
---|