This repository has been archived by the owner on May 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map
executable file
·50 lines (47 loc) · 2.34 KB
/
map
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
#!/bin/bash
set -e
SUBS="bb"
for s in $SUBS
do
if [ ! -d "${s}" ]
then
echo "********* ERROR: DIRECTORY ${s} DOES NOT EXIST, SKIPPING SUBONTOLOGY ${s} ********************************"
else
if [ -e "${s}/main.csv" ]
then
echo "********* Converting ${s} ******************************************************************************"
mkdir -p ${s}/tmp
mkdir -p ${s}/out
echo "** Generating main triples ******************************"
sed "s|{SUB}|${s}|g" main.tarql.template > ${s}/tmp/main.tarql
tarql ${s}/tmp/main.tarql | rapper -i turtle - http://www.snik.eu/ontology/${s}/ > ${s}/tmp/main.nt
echo "** Generating axioms *************************************"
sed "s|{SUB}|${s}|g" axiom.tarql.template > ${s}/tmp/axiom.tarql
tarql ${s}/tmp/axiom.tarql | rapper -i turtle - http://www.snik.eu/ontology/${s}/ > ${s}/tmp/axiom.nt
else
echo "** WARNING: ${s}/main.csv DOES NOT EXIST, SKIPPING CLASSES AND AXIOMS *******************************"
fi
if [ -e "${s}/instance.csv" ]
then
echo "** Generating instances *************************************"
sed "s|{SUB}|${s}|g" instance.tarql.template > ${s}/tmp/instance.tarql
tarql ${s}/tmp/instance.tarql | rapper -i turtle - http://www.snik.eu/ontology/${s}/ > ${s}/tmp/instance.nt
else
echo "** WARNING: ${s}/instance.csv DOES NOT EXIST. SKIPPING INSTANCES. ************************************"
fi
if [ -e "${s}/property.csv" ]
then
echo "** Generating properties ***********************************"
sed "s|{SUB}|${s}|g" property.tarql.template > ${s}/tmp/property.tarql
tarql ${s}/tmp/property.tarql | rapper -i turtle - http://www.snik.eu/ontology/${s}/ > ${s}/tmp/property.nt
else
echo "** WARNING: ${s}/property.csv DOES NOT EXIST. SKIPPING PROPERTIES ************************************"
fi
echo "** Merging ***********************************x************"
rapper -i turtle ${s}/ontology.ttl > ${s}/tmp/ontology.nt
cat prefix.ttl ${s}/tmp/*.nt | rapper -i turtle -o turtle - http://www.snik.eu/ontology/${s}/ > ${s}/out/all.ttl
echo "** Testing ************************************************"
rapper -i turtle -c ${s}/out/all.ttl
echo "********************************************************************************************************"
fi
done