composition_full.sh 5.28 KB
Newer Older
Anthony LICK's avatar
Anthony LICK committed
1 2
#!/bin/bash

Anthony LICK's avatar
Anthony LICK committed
3
fragment='xpath-2.0-core-join.rnc'
4
std='xpath-3.0-std.rnc'
Anthony LICK's avatar
Anthony LICK committed
5

Anthony LICK's avatar
Anthony LICK committed
6 7 8
xslt=`grep 'xslt' benchmarks-all-full.xml | sed -e 's/.*href="\([^"]*\).*/\1/'`
xquery=`grep 'xquery' benchmarks-all-full.xml | sed -e 's/.*href="\([^"]*\).*/\1/'`

9
printf '\\begin{tabular}{lrrrrrr}\n'
Anthony LICK's avatar
Anthony LICK committed
10
printf '\\toprule\n'
11 12
printf 'Source & queries & XPath\\,1.0 & XPath\\,2.0 & XPath\,3.0 & XPath\,3.0\,std & \\textsf{Core~2.0}\\\\\n'
printf ' & & & & & & extended\\\\\n'
Anthony LICK's avatar
Anthony LICK committed
13 14 15 16 17 18 19
printf '\\midrule\n'

# XSLT files
for file in $xslt
do
  name=`grep $file benchmarks-all-full.xml | sed -e 's/.*name="\([^"]*\).*/\1/'`
  url=`grep $file benchmarks-all-full.xml | sed -e 's/.*url="\([^"]*\).*/\1/'`
Anthony LICK's avatar
Anthony LICK committed
20
  printf '\\vspace{-0.5em} '
Anthony LICK's avatar
Anthony LICK committed
21 22 23 24 25 26 27 28 29 30
  printf "$name"
  n=`grep '<ast' $file | wc -l`
  printf "& %'.0f " $n
  #coverage of standard XPath languages
  for ((i=1; i < 4; ++i))
  do
    count=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"xpath-$i.0.rnc\" and @valid=\"yes\"]])" $file`
    percent=`echo "scale=1; 100*$count/$n" | bc`
    printf "& $percent\\\\%% "
  done
31 32 33
  count=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$std\" and @valid=\"yes\"]])" $file`
  percent=`echo "scale=1; 100*$count/$n" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
34 35 36
  count=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$fragment\" and @valid=\"yes\"]])" $file`
  percent=`echo "scale=1; 100*$count/$n" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
37
  printf '\\\\\n'
Anthony LICK's avatar
Anthony LICK committed
38
  printf "{\\\\tiny \\\\url{$url}} & & & & \\\\\\\\\n"
Anthony LICK's avatar
Anthony LICK committed
39 40 41 42 43 44 45 46 47 48
done

# total number of XSLT queries
printf '\\midrule\n'
printf 'Total (XSLT) '
n=`grep '<ast' $xslt | wc -l`
printf "& %'.0f " $n
#coverage of standard XPath languages
for ((i=1; i < 4; ++i))
do
49 50 51 52 53 54 55 56 57
  count=0
  for file in $xslt
  do
    c=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"xpath-$i.0.rnc\" and @valid=\"yes\"]])" $file`
    count=$((count+c))
  done
  counts[$i]=$count
  percent=`echo "scale=1; 100*$count/$n" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
58
done
59
# std
Anthony LICK's avatar
Anthony LICK committed
60 61 62
count=0
for file in $xslt
do
63
  c=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$std\" and @valid=\"yes\"]])" $file`
Anthony LICK's avatar
Anthony LICK committed
64 65 66 67 68
  count=$((count+c))
done
counts[4]=$count
percent=`echo "scale=1; 100*$count/$n" | bc`
printf "& $percent\\\\%% "
69 70 71 72 73 74 75 76 77 78
# Core 2.0
count=0
for file in $xslt
do
  c=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$fragment\" and @valid=\"yes\"]])" $file`
  count=$((count+c))
done
counts[5]=$count
percent=`echo "scale=1; 100*$count/$n" | bc`
printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
79
printf '\\\\\n'
Anthony LICK's avatar
Anthony LICK committed
80 81 82 83 84 85 86 87 88
printf '\\midrule\n'

N=$n

# XQuery files
for file in $xquery
do
  name=`grep $file benchmarks-all-full.xml | sed -e 's/.*name="\([^"]*\).*/\1/'`
  url=`grep $file benchmarks-all-full.xml | sed -e 's/.*url="\([^"]*\).*/\1/'`
Anthony LICK's avatar
Anthony LICK committed
89
  printf '\\vspace{-0.5em} '
Anthony LICK's avatar
Anthony LICK committed
90 91 92 93 94 95 96 97 98 99
  printf "$name"
  n=`grep '<ast' $file | wc -l`
  printf "& %'.0f " $n
  #coverage of standard XPath languages
  for ((i=1; i < 4; ++i))
  do
    count=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"xpath-$i.0.rnc\" and @valid=\"yes\"]])" $file`
    percent=`echo "scale=1; 100*$count/$n" | bc`
    printf "& $percent\\\\%% "
  done
100 101 102
  count=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$std\" and @valid=\"yes\"]])" $file`
  percent=`echo "scale=1; 100*$count/$n" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
103 104 105
  count=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$fragment\" and @valid=\"yes\"]])" $file`
  percent=`echo "scale=1; 100*$count/$n" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
106
  printf '\\\\\n'
Anthony LICK's avatar
Anthony LICK committed
107
  printf "{\\\\tiny \\\\url{$url}} & & & & \\\\\\\\\n"
Anthony LICK's avatar
Anthony LICK committed
108 109 110 111 112 113 114 115 116 117
done

# total number of XQuery queries
printf '\\midrule\n'
printf 'Total (XQuery) '
n=`grep '<ast' $xquery | wc -l`
printf "& %'.0f " $n
# coverage of standard XPath languages
for ((i=1; i < 4; ++i))
do
118 119 120 121 122 123 124 125 126
  count=0
  for file in $xquery
  do
    c=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"xpath-$i.0.rnc\" and @valid=\"yes\"]])" $file`
    count=$((count+c))
  done
  counts[$i]=$((count + counts[i]))
  percent=`echo "scale=1; 100*$count/$n" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
127
done
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
count=0
# std
for file in $xquery
do
  c=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$std\" and @valid=\"yes\"]])" $file`
  count=$((count+c))
done
counts[4]=$((count + counts[4]))
percent=`echo "scale=1; 100*$count/$n" | bc`
printf "& $percent\\\\%% "
# Core 2.0
count=0
for file in $xquery
do
  c=`xmlstarlet sel -N xqx="http://www.w3.org/2005/XQueryX" -t -c "count(//xpath[schemas/validation[@schema=\"$fragment\" and @valid=\"yes\"]])" $file`
  count=$((count+c))
done
counts[5]=$((count + counts[5]))
percent=`echo "scale=1; 100*$count/$n" | bc`
printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
148
printf '\\\\\n'
Anthony LICK's avatar
Anthony LICK committed
149 150 151 152 153

N=$((N + n))
printf '\\midrule\n'
printf 'Total '
printf "& %'.0f " $N
154
for ((i=1; i < 6; ++i))
Anthony LICK's avatar
Anthony LICK committed
155
do
156 157 158
  count=${counts[i]}
  percent=`echo "scale=1; 100*$count/$N" | bc`
  printf "& $percent\\\\%% "
Anthony LICK's avatar
Anthony LICK committed
159
done
Anthony LICK's avatar
Anthony LICK committed
160
printf '\\\\\n'
Anthony LICK's avatar
Anthony LICK committed
161 162 163

printf '\\bottomrule\n'
printf '\\end{tabular}\n'