-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwidoco.sh
More file actions
executable file
·124 lines (95 loc) · 4.94 KB
/
widoco.sh
File metadata and controls
executable file
·124 lines (95 loc) · 4.94 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/bash
num_args=$#
array=("$@")
arr=()
contador=0
if [ $num_args -lt 1 ]; then
echo "Not enough arguments. Type sh widoco.sh -h || --help to get the usage of this application."
elif [ ${array[@]}="-h" ] || [ ${array[@]}="--help" ]; then
echo " "
echo "Usage: sh widoco.sh + arguments (arguments below)"
echo " "
echo "-ontoFile ontologyFile -includeImportedOntologies"
echo "-ontoUri ontologyUri -htaccess"
echo "-confFile configurationFile -webVowl"
echo "-oops -licensius"
echo "-rewriteAll -ignoreIndividuals"
echo "-crossRef -analytics analyticsFile"
echo "-saveConfig saveFile -doNotDisplaySerializations"
echo "-usecustomStyle -displaydirectImportsOnly"
echo "-lang lang1-lang2 -rewriteBase baseFile"
echo "-excludeIntroduction -uniteSections"
break
elif [ $num_args -lt 3 ]; then # mirar a ver si lo que recibe es una uri o un fichero
curl --location --request POST 'http://widoco.linkeddata.es/' --header 'Content-Type: multipart/form-data; boundary=--------------------------554657334890040702125867' --form 'data={"getOntologyMetadata":"","rewriteAll":"","lang":"en"}' --form 'ontoFile=@'$2 --output WidocoDocs.zip
else
for arg in ${array[@]};
do
contador=$contador+1
if [ "$arg" = "-ontoFile" ]; then
ontologyFile="${array[$arg+$contador]}" # Get the file of the ontology
# Add here the data of the ontology and de command
arr=("ontoFile=@$ontologyFile" "${arr[@]}")
elif [ "$arg" = "-ontoUri" ]; then
ontologyUri="${array[$arg+$contador]}" # Get the uri of the ontology
arr=('"ontoUri":"'$ontologyUri'"' "${arr[@]}")
elif [ "$arg" = "-confFile" ]; then
configurationFile="${array[$arg+$contador]}" # Get the configuration file that the client want
arr=("${arr[@]}" '"confFile":"'$configurationFile'"')
elif [ "$arg" = "-oops" ]; then
arr=("${arr[@]}" '"oops":""')
elif [ "$arg" = "-rewriteAll" ]; then
arr=("${arr[@]}" '"rewriteAll":""')
elif [ "$arg" = "-crossRef" ]; then
arr=("${arr[@]}" '"crossRef":""')
elif [ "$arg" = "-saveConfig" ]; then
saveFile="${array[$arg+$contador]}" # Save the configuration into one file
arr=("${arr[@]}" '"saveConfig":"'$saveFile'"')
elif [ "$arg" = "-usecustomStyle" ]; then
arr=("${arr[@]}" '"usecustomStyle":""')
elif [ "$arg" = "-lang" ]; then
languages="${array[$arg+$contador]}" # Get the languages that the client want
arr=("${arr[@]}" '"lang":"'$languages'"')
elif [ "$arg" = "-excludeIntroduction" ]; then
arr=("${arr[@]}" '"excludeIntroduction":""')
elif [ "$arg" = "-includeImportedOntologies" ]; then
arr=("${arr[@]}" '"includeImportedOntologies":""')
elif [ "$arg" = "-htaccess" ]; then
arr=("${arr[@]}" '"htaccess":""')
elif [ "$arg" = "-webVowl" ]; then
arr=("${arr[@]}" '"webVowl":""')
elif [ "$arg" = "-licensius" ]; then
arr=("${arr[@]}" '"licensius":""')
elif [ "$arg" = "-ignoreIndividuals" ]; then
arr=("${arr[@]}" '"ignoreIndividuals":""')
elif [ "$arg" = "-analytics" ]; then
analyticsFile="${array[$arg+$contador]}" # Get the analytics file that the client want
arr=("${arr[@]}" '"analytics":"'$analyticsFile'"')
elif [ "$arg" = "-doNotDisplaySerializations" ]; then
arr=("${arr[@]}" '"doNotDisplaySerializations":""')
elif [ "$arg" = "-displaydirectImportsOnly" ]; then
arr=("${arr[@]}" '"displaydirectImportsOnly":""')
elif [ "$arg" = "-rewriteBase" ]; then
baseFile="${array[$arg+$contador]}" # Get the base file that the client want
arr=("${arr[@]}" '"rewriteBase":"'$baseFile'"')
elif [ "$arg" = "-uniteSections" ]; then
arr=("${arr[@]}" '"uniteSections":""')
else
continue
fi
done
data=${arr[0]}
arrIN=(${data//=/ })
if [ $arrIN == "ontoFile" ]; then
unset 'arr[0]'
json=("${arr[@]}")
json=$(printf ",%s" "${json[@]}")
json=${json:1}
curl --location --request POST 'http://widoco.linkeddata.es/' --header 'Content-Type: multipart/form-data; boundary=--------------------------554657334890040702125867' --form 'data={'$json'}' --form $data --output WidocoDocs.zip
else
json=("${arr[@]}")
json=$(printf ",%s" "${json[@]}")
json=${json:1}
curl --location --request POST 'http://widoco.linkeddata.es/' --header 'Content-Type: multipart/form-data; boundary=--------------------------554657334890040702125867' --form 'data={'$json'}' --output WidocoDocs.zip
fi
fi