Hi Lars,
hm, that's difficult to tell. All I can say is that this sounds
unusual, so I'm coming up with my standard questions: Do you think you
could build us a little example that allows us to reproduce the
problem? Have you tried the latest version of BaseX?
Best,
Christian
On Mon, May 18, 2015 at 1:35 PM, Lars Johnsen <yoonsen@gmail.com> wrote:
>
> I am running a web script in two identical versions (identical as in "cut
> and paste"), one via RESTXQ and one vi REST. The response is different, and
> I wondered what may be the trouble.
>
> For example the output (the URLs only works locally) for
> http://ljohnsen:8984/hyphens/mellom
> is the same as
> http://ljohnsen:8984/rest?run=hyphen-show.xq&word=mellom
>
> which is a set of hyphenation data:
> mellom
> mel - lom 17005
> Mel - lom 144
> mel - lom. 50
>
> but if "mellom" is exchanged with "nasjonalbiblioteket" only the REST
> version shows any result, which then is the same as I get experimenting in
> the GUI.
>
> The actual script is added below, and which runs in both versions
> (identical apart form the rest and restxq interfaces), it uses full text
> search, but results differ when run under the REST-regime.
>
> All the best
> Lars G Johnsen
> National Library of Norway
>
> module namespace page = 'http://basex.org/modules/web-page';
>
> declare
> %rest:path("/hyphens/{$word}")
> %output:method("html")
>
> function page:show-hyphens($word) {
> let $db := db:open('hyphen-data')
> let $hyphens := for $hyp in $db/hyphens/hyphens[full contains text
> {$word}]
> group by $first := $hyp/first, $second := $hyp/second
> let $count := count($hyp)
> order by xs:int($count) descending
> return element p {
> attribute freq {$count},
> $first, " - ", $second, $count
> }
>
> let $total := sum($hyphens//@freq)
> let $div := element div {
> element p {$word},
> for $hyp in $hyphens
> return element div {
> attribute class {"hyph"},
> attribute style {"font-size:", 1 +round(xs:int($hyp//@freq/data())
> div $total,1) || "em"},
> $hyp
>
> }
> }
> return
> <html encoding="UTF-8">
> <head>
> <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"
> />
> <title>Orddelinger</title>
> </head>
> <body>{$div}
> </body>
> </html>
>
> };