-
Notifications
You must be signed in to change notification settings - Fork 1
/
validate_all_rdf_gz.sh
executable file
·101 lines (67 loc) · 1.7 KB
/
validate_all_rdf_gz.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
source ./scripts/env.sh
if [ $has_rapper_command = "false" ] ; then
echo "rapper: command not found..."
echo "Please install Raptor RDF Syntax Library (https://librdf.org/raptor/)."
exit 1
fi
RDF_DIR=
MIN_DEPTH=2
CHK_SUM_DIR=chk_sum_valid_rdf
DELETE=false
ARGV=`getopt --long -o "d:m:r" "$@"`
eval set -- "$ARGV"
while true ; do
case "$1" in
-d)
RDF_DIR=$2
shift
;;
-m)
MIN_DEPTH=$2
shift
;;
-r)
DELETE=true
;;
*)
break
;;
esac
shift
done
if [ -d $RDF_DIR ] ; then
total=`find $RDF_DIR -mindepth $MIN_DEPTH -name '*.rdf.gz' | wc -l 2> /dev/null`
if [ $total != 0 ] ; then
mkdir -p $CHK_SUM_DIR
echo RDF syntax validation: *.rdf.gz documents in $RDF_DIR...
data_set=`basename $RDF_DIR`
rdf_file_list=`echo check_${data_set,,}_rdf_gz_file_list | tr '-' _`
find $RDF_DIR -name "*.err" -exec rm {} +
find $RDF_DIR -mindepth $MIN_DEPTH -name '*.rdf.gz' > $rdf_file_list
rm -f $RDF_DIR/*.lock
cat $rdf_file_list | sort -R > $rdf_file_list~
for proc_id in `seq 1 $MAXPROCS` ; do
if [ $DELETE = "true" ] ; then
./scripts/validate_all_rdf_gz_worker.sh -c $CHK_SUM_DIR -d $RDF_DIR -l $rdf_file_list -n $proc_id"of"$MAXPROCS -t $total -r &
else
./scripts/validate_all_rdf_gz_worker.sh -c $CHK_SUM_DIR -d $RDF_DIR -l $rdf_file_list -n $proc_id"of"$MAXPROCS -t $total &
fi
done
if [ $? != 0 ] ; then
echo $0 aborted.
exit 1
fi
wait
echo
rm -f $rdf_file_list $rdf_file_list~
red='\e[0;31m'
normal='\e[0m'
errs=`find $RDF_DIR -name "*.log" | wc -l 2> /dev/null`
if [ $errs != 0 ] ; then
echo -e "${red}$errs errors were detected. Please check the log files for more details.${normal}"
exit 1
fi
echo Done.
fi
fi