-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·95 lines (82 loc) · 1.52 KB
/
run.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
set -e
PROGNAME=$(basename $0)
CWD=$(pwd)
die() {
echo "$PROGNAME: $*" >&2
exit 1
}
mapping() {
echo "generating default-mapping.ttl"
/work/d2rq/generate-mapping -u ${U} -p ${P} ${JDBC} > default-mapping.ttl
}
transform() {
echo "transform sql to transformation.ttl"
/work/d2rq/dump-rdf -f TURTLE ${MF} > transformation.ttl
}
enrich() {
echo "enrich rdf data saving to transformation.enriched.ttl"
java -jar /work/enrichment/enrichment.jar --enrichment.inputFile=${RF} --enrichment.outputFile=/data/transformation.enriched.ttl
}
usage() {
if [ "$*" != "" ] ; then
echo "Error: $*"
fi
cat << EOF
Usage: $PROGNAME
Options:
--mapping --user <user> --pass <pass> --jdbc <jdbcString>
--transform --mapping-file <mapp.ttl>
--enrich --rdf-file <rdf.ttl>
EOF
exit 1
}
while [ $# -gt 0 ] ; do
case "$1" in
-h|--help)
usage
;;
--mapping)
MAPPING="true"
;;
--transform)
TRANSFORM="true"
;;
--enrich)
ENRICH="true"
;;
--pass)
P="$2"
shift
;;
--user)
U="$2"
shift
;;
--jdbc)
JDBC="$2"
shift
;;
--mapping-file)
MF="$2"
shift
;;
--rdf-file)
RF="$2"
shift
;;
-*)
usage "Unknown option '$1'"
;;
esac
shift
done
if [ ! -z "$MAPPING" ] ; then
mapping
fi
if [ ! -z "$TRANSFORM" ] ; then
transform
fi
if [ ! -z "$ENRICH" ] ; then
enrich
fi