[Monetdb-developers] Unimplemented XQuery standard functions

Maurice van Keulen m.vankeulen at utwente.nl
Fri Aug 3 15:36:10 CEST 2007


Hi Djoerd,

I desperately needed tokenize() myself, so I wrote my own version in
XQuery. Incredably slow, but it works. Note that $sep should be a string
with only one character.

declare function pxml:poormansTokenize($s as xs:string, $sep as xs:string)
{
   let $slen := string-length($s)
      ,$split := for $i in (1 to $slen) return substring($s,$i,1)
      ,$pos := (0,(for $c at $p in $split where $c eq $sep return
$p),$slen+1)
      ,$len := for $i in (2 to count($pos))
               return exactly-one($pos[$i]) - exactly-one($pos[$i - 1]) - 1
   for $p at $i in $len
   return substring($s,exactly-one($pos[$i])+1,$p)
};

Hope this helps.

Kind regards,
Maurice.

Djoerd Hiemstra wrote:
> Dear all,
>
> For demo purposes we are in need for implementations of some XQuery
> standard functions, especially fn:tokenize() and fn:base-uri().
>
> Are there plans for implementing more (or all) standard functions?
>
> Best,  Djoerd.
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Monetdb-developers mailing list
> Monetdb-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/monetdb-developers
>   

-- 
----------------------------------------------------------------------
Dr.Ir. M. van Keulen - Assistant Professor, Data Management Technology
Univ. of Twente, Dept of EEMCS, POBox 217, 7500 AE Enschede, Netherlands
Email: m.vankeulen at utwente.nl, Phone: +31 534893688, Fax: +31 534892927
Room: ZI 3039, WWW: http://www.cs.utwente.nl/~keulen





More information about the developers-list mailing list