[MonetDB-users] Problem with (Tijah) search query for StreetTiVo

Ying Zhang Y.Zhang at cwi.nl
Fri Dec 7 18:20:29 CET 2007


Hello all,

When executing the attached search query in the streettivo bobo  
collection, I get the following errors:

$ mclient -lx -p 60000 a.xq
MAPI  = monetdb at localhost:60000
QUERY = import module namespace stvc = "http://monetdb.cwi.nl/streettivo/search 
"
             at "/export/scratch0/streettivo/streettivo/mxq/search.xq";

         stvc:search("bobo camperen")
ERROR = !ERROR: interpret_params: reverse(param 1): invalid BAT.
         !ERROR: interpret_params: exist(param 1): evaluation error.
         !ERROR: interpret_params: not(param 1): evaluation error.

$ cat a.xq
import module namespace stvc = "http://monetdb.cwi.nl/streettivo/search"
     at "/export/scratch0/streettivo/streettivo/mxq/search.xq";

stvc:search("bobo camperen")

The function "search()" is implemented as the following (see also the  
attachment):

1. module namespace stvc = "http://monetdb.cwi.nl/streettivo/search";
2. declare namespace tijah = 'http://dbappl.cs.utwente.nl/pftijah/';

3. stvc:search($keywords as xs:string) as node()* {
4.  let $config := doc("config.xml")
5.  (: number of programs to be returned :)
6.  let $numPrograms := exactly-one($config/stv-config/nr-programs/ 
text())
7.  (: number of fragments to be returned per program :)
8.  let $numFrags := exactly-one($config/stv-config/nr-fragments/text())
9.  (: number of sentences to be ranked by TIJAH :)
10.  let $numSentences := exactly-one($config/stv-config/nr-sentences/ 
text())

11.  let $query := tijah:tokenize($keywords)
12.  let $nexi := if ($query) then
13.                concat("//(asr|teletext)[about(.,", $query, ")]// 
sentence[about(.,", $query, ")]")
14.               else "//sentence[about(., asdkjasdkj)]" (: in case  
query is only a stop word :)
15.  let $opt  := <TijahOptions ft-index="SpeechOut"  
returnNumber="{$numSentences}" />
16.  let $res := tijah:queryall-id($nexi,$opt)
17.  let $nodes := tijah:nodes($res)
18.  let $resultlist :=
19.    for $pid in distinct-values ($nodes/../@progID)
20.    let $sentences :=
21.      for $s in $nodes[../@progID = $pid]
22.      order by tijah:score($res, $s) descending
23.      return $s
24.    let $best := $sentences[1]
25.    let $speech := $best/..
26.    let $pscore := tijah:score($res, exactly-one($best))
27.    order by $pscore descending
28.    return element program {
29.            attribute thumbnail-image {$speech/@thumbnail_image},
30.            attribute video-file {$speech/@video-file},
31.            attribute startDT {$speech/@startDT},
32.            attribute channel {$speech/@channel},
33.            attribute title {$speech/@title},
34.            attribute progID {$pid},
35.            attribute score {$pscore},
36.            subsequence(
37.                for $fragment in $sentences
38.                return element fragment {
39.                        $fragment/@*,
40.                        $fragment/text() },
41.                1, $numFrags) }
42.  return
43.    subsequence($resultlist, 1, $numPrograms) (: first result page :)
44. };


The problem starts in lines 16 and 17.  It feels like that the error  
will occur, as soon as the return value of
the function "tijah:queryall-id" or "tijah:nodes" is used.  Above  
error occurs, if I
- query the original function, or
- skip lines 17 - 43 and return <res>{$res}</res>
- skip lines 18 - 43 and return $nodes

I use the latest stable version, compiled using the monetdb-install.sh  
script as the following:

$ monetdb-install.sh --prefix=$STV_HOME/monetdb --build=$STV_TEMP/ 
monetdb_build --enable-xquery --nightly=stable --enable-debug

System info:

$ uname -a
Linux andorea.ins.cwi.nl 2.6.20-1.2933.fc6 #1 SMP Mon Mar 19 11:00:19  
EDT 2007 x86_64 x86_64 x86_64 GNU/Linux


Would some Tijah experts please have a lot at this problem?  I'm not  
sure if the problem is in the Tijah functions or somewhere else in  
MonetDB/XQuery.

Thanks a lot!

Regards,

Jennie

-------------- next part --------------
A non-text attachment was scrubbed...
Name: search.xq
Type: application/octet-stream
Size: 2175 bytes
Desc: not available
URL: <http://www.monetdb.org/pipermail/users-list/attachments/20071207/9353061a/attachment.obj>
-------------- next part --------------



More information about the users-list mailing list