
Thanks Jan for the clarification.
When I adopt the changes that you recommend, the actual behavior (run)
does not change.
Basically, there are 2 things: grouping results and presenting results
in its original hierarchical organization, and both differ in MPS and
Algebra.
- The grouping of results with distinct-values is different in MPS and
Alg. When I leave out the ORDER BY clause, the results that are
returned have a different ranking. The MPS backend is working as I
would expect, because the results are returned by relevance and
grouped. The Algebra backend discards the original ranking and
presents the results by file name.
- When I use the new ORDER BY clause ( ORDER BY number($cs-group2/num)
), the MPS backend preserves the grouping and orders each group by
num, whereas Algebra gets rid of the grouping and orders all results
by num.
I was quite happy with MPS, because the stuff that I wanted worked with that.
I need to get this working, because we are (supposed to be) doing user
studies with operational systems.
Do you have more tips? Is this a 'bug' with Pftijah?
junte
On Wed, Jan 14, 2009 at 12:35 PM, Jan Rittinger
On Jan 14, 2009, at 11:53, jz@uva wrote:
Hi Jan,
I was also using the GROUP BY construct. This is my query: ... let $qid := tijah:queryall-id($query_nexi, $options) let $nodes := tijah:nodes($qid) let $result := for $node in $nodes return typeswitch ($node) case $elem-node as element(*) return <result> <num> { (count($node/$elem-node/preceding::*) + 1) + This snippet of XQuery is to complex: 'count($node/$elem-node/...'. Both $node and $elem-node contain the tijah-result nodes (with type node() and element(*), respectively). What you want to write is 'count($elem-node/...'.
string-length(tijah:getINEXPath($node)) } </num> <file> { data($node/$elem-node/ancestor-or-self::EAD/@FILE) } file> <title> { data($node/$elem-node/ancestor-or-self::EAD/@TITLE) } </title> ...
<score> { tijah:score($qid, $node/$elem-node) } </score> </result> default return error ("unexpected node")
let $total := count($result) return <results total="{$total}"> { for $res at $rankGlobal in distinct-values($result/file) let $cs-group := $result[file = $res] for $cs-group2 at $rank in $cs-group where exists($cs-group2) this line is unnecessary as there is always exactly one item bound to $cs-group2.
and $rank >= 1 this line is unnecessary as the positional variable always starts from 1 (and can never be less).
and $rank <= 8 and $rankGlobal >= $start and $rankGlobal <= $end order by $cs-group2 cast as xs:integer what do you want here? I very much doubt that you are able to atomize an XML snippet, then cast the string-value into a number and still get something meaningful out.
return <out id="{$res}">{ $cs-group2 }</out> } </results>
With this query, I get different results in MPS and Alg. I guess MPS treats your order by differently---read incorrectly---by ignoring every character data after the first number which accidently is the content of element num.
Perhaps your query already works the way you expect it by replacing the ORDER BY by the following snippet: 'order by number($cs-group2/ num)'.
Jan
-- Jan Rittinger Lehrstuhl Datenbanken und Informationssysteme Wilhelm-Schickard-Institut für Informatik Eberhard-Karls-Universität Tübingen
http://www-db.informatik.uni-tuebingen.de/team/rittinger
------------------------------------------------------------------------------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ MonetDB-users mailing list MonetDB-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-users