-
Notifications
You must be signed in to change notification settings - Fork 1
/
validate_all_rdf.sh
executable file
·96 lines (62 loc) · 1.65 KB
/
validate_all_rdf.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
#!/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=
CHK_SUM_DIR=chk_sum_valid_rdf
DELETE=false
ARGV=`getopt --long -o "d:r" "$@"`
eval set -- "$ARGV"
while true ; do
case "$1" in
-d)
RDF_DIR=$2
shift
;;
-r)
DELETE=true
;;
*)
break
;;
esac
shift
done
if [ -d $RDF_DIR ] ; then
find $RDF_DIR -maxdepth 1 -name '*.rdf' -size 0 -exec rm {} +
total=`find $RDF_DIR -maxdepth 1 -name '*.rdf' | wc -l 2> /dev/null`
if [ $total != 0 ] ; then
mkdir -p $CHK_SUM_DIR
echo RDF syntax validation: *.rdf documents in $RDF_DIR...
rdf_file_list=`echo check_${RDF_DIR,,}_rdf_file_list | tr '-' _`
find $RDF_DIR -name "*.err" -exec rm {} +
find $RDF_DIR -maxdepth 1 -name '*.rdf' > $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_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_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