#!/bin/sh # This takes a collection of stick-e notes in SouthWest Tourism form, # and tests them against some current contexts; the results are # placed in an html file, and automatically displayed in a netscape # window. # The document collection is pro-active; i.e. the query is derived from the # active fields of each document. # # To call this give one argument: the document collection to be used. # # sample call: s t_attraction.notes # USES NON-RELEASE VERSION # # -v switch produces verbose output OPTIONS= if test "x$1" = "x-v"; then OPTIONS=-v shift fi if test $# -ne 1; then echo "--- you must supply exactly one argument (in addition to a possible -v); you have supplied $# ----" exit 1 fi # # THE SIMULATED PRESENT CONTEXTS # # Special extra feature implemented by this scipt: # comments beginning "PC" after each note are designed to be # .. output and recognised by the sed script as the start of a stage COORDS='3060000..3180000, 0820000..0940000' COORDS1='3160000..3280000, 0830000..1040000' CONTEXT=' '"$COORDS" CONTEXT1=' '"$COORDS1" CONTEXT2="$CONTEXT1" # unchanged position # Define how the query is to be derived from each document in # the collection, by declaring the active fields: RECIPE=' ANY ' # The last stage of the pipeline selects the fields to be used for output OUTPUTSTAGE=' ANY ANY ANY ' #OUTPUTSTAGE= # END OF SETTING OF CURRENT CONTEXT # # Define the version of the Context Matcher to use MATCHER=/home/pjbrown/java/semapper/matcher JAVA_FLAGS="-ms24m -mx32m -Xrunhprof:cpu=times" JAVA_FLAGS="-ms24m -mx32m -Xrunhprof:cpu=samples" export JAVA_FLAGS # # # To post-process the output from the Context Matcher # convert the tags to an SGML representation using a sed script. # This is the sed script that will be used: SEDSCRIPT='# 1i\ \ Retrieval Output

RETRIEVAL RESULTS FOR '"$COORDS"'

s/SPECIAL((/

[[/ s/))/=====]]<\/xmp><\/font>/ s/<name>\(.*\)$/<hr><h2>\1<\/h2><p>/ s/<note>\(.*\)$/<hr><hr><hr><h1> NEXT POSITION \1<\/h1><p>/ s/<!-- *PC:\(.*\)-- *>/<hr><hr><hr><h1> NEXT POSITION \1<\/h1><p>/ s/<location>/<br>Location:/ s/<fax>/<br>Fax: / s/<coords>/<br>OS reference: / s/<website> *ANY/<br>Web-site: ANY/ s/<website> *\(.*\)$/<br>Web-site: <a HREF="http:\/\/\1">\1<\/a>/ $a\ </body></html> ' # sort out the form and destination of the output ONAME=$1.html if test x"$OPTIONS" = x-v; then SEDSCRIPT= ONAME=$1.txt # cut out the sed stage if debugging fi DIR="/home/pjbrown/public_html/tmp" OFILE=$DIR/$ONAME rm -f $OFILE #$MATCHER -Z $OPTIONS $1 "$RECIPE" "$CONTEXT""$CONTEXT1""$CONTEXT2" | sed -e "$SEDSCRIPT" >$OFILE $MATCHER -Z $1 $OPTIONS "$RECIPE" "$CONTEXT""$CONTEXT1""$CONTEXT2" "$OUTPUTSTAGE" | sed -e "$SEDSCRIPT" >$OFILE # link t#out to output file to ease viewing it # THE FINAL STAGE THAT DISPLAYS THE OUTPUT USING NETSCAPE rm -f t#out ln -s $OFILE t#out echo "--------- MATCHES ARE IN NETSCAPE WINDOW -----------" NETSCAPE=netscape if test x$HOSTTYPE = xsun4; then NETSCAPE=/usr/dt/bin/netscape fi $NETSCAPE -remote 'openURL(http://www.dcs.ex.ac.uk/~pjbrown/tmp/'$ONAME')'