1 | #!/bin/bash
|
---|
2 |
|
---|
3 | . ./_local_prepare_config.sh
|
---|
4 |
|
---|
5 | if [ $# = 2 ] ; then
|
---|
6 | startyear=$1
|
---|
7 | endyear=$2
|
---|
8 | else
|
---|
9 | startyear=1956
|
---|
10 | endyear=$esc_cutoff_endyear
|
---|
11 | fi
|
---|
12 |
|
---|
13 | prep_dir=errata-categories
|
---|
14 |
|
---|
15 | if [ ! -d ./$my_python ] ; then
|
---|
16 | echo "" 1>&2
|
---|
17 | echo "Failed to find: ./$my_python" 1>&2
|
---|
18 | echo "Have you run:" 1>&2
|
---|
19 | echo " ./CREATE-VENV-PYTHON3.sh $my_python" 1>&2
|
---|
20 | echo "" 1>&2
|
---|
21 |
|
---|
22 | exit 1
|
---|
23 | fi
|
---|
24 |
|
---|
25 | if [ ! -d "$prep_dir/metadata-esc-year" ] ; then
|
---|
26 | echo "Creating directory:"
|
---|
27 | echo " $prep_dir/metadata-esc-year"
|
---|
28 |
|
---|
29 | mkdir "$prep_dir/metadata-esc-year"
|
---|
30 | fi
|
---|
31 |
|
---|
32 | exit_status=0
|
---|
33 |
|
---|
34 | source ./$my_python/bin/activate
|
---|
35 |
|
---|
36 | $prep_dir/esc-wikipedia-download-and-process-votes.py \
|
---|
37 | --startyear $startyear \
|
---|
38 | --endyear $endyear \
|
---|
39 | --cachedir $prep_dir/cache-wikipedia \
|
---|
40 | $prep_dir/metadata-esc-year/metadata_esc.json
|
---|
41 |
|
---|
42 | if [ $? = 0 ] ; then
|
---|
43 |
|
---|
44 | if [ ! -d "$prep_dir/missing-cat-countries" ] ; then
|
---|
45 | echo "Creating directory:"
|
---|
46 | echo " $prep_dir/missing-cat-countries"
|
---|
47 |
|
---|
48 | mkdir "$prep_dir/missing-cat-countries"
|
---|
49 | fi
|
---|
50 |
|
---|
51 | $prep_dir//esc-wikipedia-download-and-detect-missing-cat-entries.py \
|
---|
52 | --startyear $startyear \
|
---|
53 | --endyear $endyear \
|
---|
54 | --cachedir $prep_dir/cache-wikipedia \
|
---|
55 | --queryfile.sparql "$prep_dir/dbpedia--countries-missing-from-esc-category-in-the-year.sparql" \
|
---|
56 | $prep_dir/missing-cat-countries/metadata.json
|
---|
57 |
|
---|
58 | if [ $? != 0 ] ; then
|
---|
59 | echo "!!!!" 1>&2
|
---|
60 | echo "! Error enountered determining which countries are missing on Wikipedia ESC Category-Year pages" 1>&2
|
---|
61 | echo "!!!!" 1>&2
|
---|
62 | exit_status=1
|
---|
63 | fi
|
---|
64 |
|
---|
65 | /bin/cp $prep_dir/dbpedia--countries-missing-from-esc-category-in-the-year.sparql problem-lod-lists/dbpedia-problem-category-in-year.sparql
|
---|
66 |
|
---|
67 | else
|
---|
68 | echo "!!!!" 1>&2
|
---|
69 | echo "! Error enountered parsing out enriched metadata from Wikipedia ESC pages" 1>&2
|
---|
70 | echo "!!!!" 1>&2
|
---|
71 | exit_status=1
|
---|
72 | fi
|
---|
73 |
|
---|
74 |
|
---|
75 | deactivate
|
---|
76 |
|
---|
77 | if [ $exit_status != 0 ] ; then
|
---|
78 | exit $exit_status
|
---|
79 | fi
|
---|