-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart
executable file
·112 lines (112 loc) · 3.77 KB
/
start
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
#!/bin/bash
#
# OWL Reasoner Evaluation Workshop (ORE) 2013
# Reasoner Competition Benchmark Script v1.6
# Last updated: 22-Jul-13
#
# The framework relies on the folder structure described below, for ease of use regarding triggering operations
#
# The "base" folder should contain the folders (1) /reasoners, (2) /runner and (3) /csv.
# (1) contains reasoner folders, each of which with an execReasoner script to trigger that reasoner
# (2) contains the framework's necessary scripts and jars
# (3) where the output csv files with reasoner results (timings, errors & timeouts) are serialised to
#
base="/Users/rafa/Documents/PhD/workspace/ore-framework/test/base"
rbase="$base/reasoners"
runbase="$base/runner"
lib="-Djava.library.path=$runbase/lib"
#
# Using the script:
#
# sh start <Operation> <Ontology> <Output> <Reasoner> <CSVOutput> (<ConceptURI>)
#
# <Operation> One of: sat | classification | consistency
# <Ontology> Absolute ontology file path
# <Output> Output folder name (within reasoner folder)
# <Reasoner> Reasoner folder name (rooted at rbase above) which should contain an 'execReasoner' script
# <CSVOutput> Folder where the csv result file should be serialised to (absolute path)
# <ConceptURI> Full concept URI, as declared in the ontology
#
# To start with, print the given parameters back
#
if [ $# -gt 1 ]; then
echo "Starting benchmark"
echo " $# parameters given"
echo " Operation: $1"
echo " Ontology Filepath: $2"
echo " Output folder name: $3 (full path: $rbase/$4/$3)"
echo " Reasoner: $4"
if [ $# -gt 5 ]; then
if [ "$1" = "sat" ]; then
echo " Concept URI: $6"
fi
fi
ontname=`basename $2`
out="$rbase/$4/$3/$ontname/$1"
if [ "$1" = "sat" -o "$1" = "consistency" ]; then
out="$out.csv"
elif [ "$1" = "classification" ]; then
out="$out.owl"
fi
echo " Output file: $out"
#
# Validate the parameters, i.e., whether:
# 1) Given (ontology and/or query) files exist
# 2) Operation is one of the specified ones
# 3) Concept exists in the ontology signature
# 4) Output folder is writable
#
echo " Verifying parameters"
chk=$(java $lib -jar $runbase/InputVerifier.jar $1 $2 $out $6)
if [ "$chk" = "Valid parameters" ]; then
echo " Parameters are valid"
#
# Restrict system resources
# Max memory: 10GB
# Max time: 5 minutes cpu time
#
ulimit -v 10485760
ulimit -t 350
#
# Execute reasoner with given parameters. Once the operation
# is completed, the wall clock time difference is printed
#
echo " Executing reasoner..."
cd "$rbase/$4"
start_time=$(date +%s)
rout=$(./execReasoner $1 $2 $out $6)
end_time=$(date +%s)
duration=$(( $end_time - $start_time ))
output="$rout"$'\n\t'"Duration: $duration"
echo "$rout"
log=$out"_log"
if [ "$1" = "sat" ]; then
log=$log"_`date +%s`.txt"
else
log=$log".txt"
fi
echo "$output" > "$log"
echo " Finished. Total wall clock duration: $duration second(s)"
#
# Handle output: Parse the reasoner log and extract operation times, timeout, and
# retrieve a portion of the error message if there is one in the error file.
#
echo " Verifying output..."
cd "$runbase" && java $lib -jar OutputHandler.jar $log $1 $2 $out $5/$4 $6
echo " Finished"
else
echo "$chk"
fi
echo "Done"
else
echo "! Insufficient or no parameters given"
echo ""
echo "Usage: sh start <Operation> <OntPath> <Output> <Reasoner> (<ConceptURI>)"
echo " <Operation> One of: sat | classification | consistency"
echo " <Ontology> Absolute ontology file path"
echo " <Output> Output folder name (within reasoner folder)"
echo " <Reasoner> Reasoner folder name (rooted at rbase) which should contain an 'execReasoner' script"
echo " <CSVOutput> Folder where the csv result file should be serialised to"
echo " <ConceptURI> Concept URI, as declared in the ontology"
echo ""
fi