xquery2src

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

xquery2src

Molnár Balázs-2
Hello Burak,

The current version of xquery2src does not seem to support namespace  
declarations (declare namespace ...; ). Do you plan to implement  
this ? When do you think you would make available the new Scalax  
package ?

The relevance of this is that currently my application ( a financial  
planner for insurance companies)  is implemented all the way using  
XSL  and XQuery calculations. My research area at the moment is to  
find a programming environment which allows the use of my business  
terms - as opposed to the XML domain specific approach of XSL/XQuery  
- and supports a relatively painless migration path. XQuery  
calculations are the first area in my application I would use for  
benchmarking an alternative architecture.

regards,
Balazs

Reply | Threaded
Open this post in threaded view
|

declaring a namespace for XML literal, was Re: xquery2src

Burak Emir
Hello Molnár,

Hopefully, I will release updated and v1.4.0.3-checked scalax before
beginning of next week. (I noticed that v1.4.0.4 has a bug appearing
when mixing in the MarkupReader class which v1.4.0.3 doesn't have ... ).

about the question: I don't recall the exact namespace-declaration
syntax of XQuery for now, but it should be easy to support this.

Since it might be useful for scala.xml hackers, I'll give some more
details here.
--
An XML literal <bla:foo ....xmlns:ga="gu">kids</foo> is translated in
something like this
val $tmp = $scp
{
    val $scp = new NamespaceBinding("ga", "gu", $tmp); // shares the old
bindings
   Elem("bla","foo", attrs, $scp, kids)
}

(Actually, the namespace business is what makes everything look so ugly,
blocks, variables...)

The way to declare a namespace mapping from prefix "ga" to URI "gu"
would thus be something like the following.

declare namespace ga = gu;
(morecode)
==>

val $tmp = $scp
{
    val $scp = new NamespaceBinding("ga", "gu", $tmp); // shares the old
bindings
    (morecode)
}

The special variable $scp is visible in every program, because it is
defined in Predef.scala
--

I hope the scalax tools can account for "a relatively painless migration
path", that was in principle what they were made for.

cheers,
Burak

Molnár Balázs wrote:

> Hello Burak,
>
> The current version of xquery2src does not seem to support namespace  
> declarations (declare namespace ...; ). Do you plan to implement  this
> ? When do you think you would make available the new Scalax  package ?
>
> The relevance of this is that currently my application ( a financial  
> planner for insurance companies)  is implemented all the way using  
> XSL  and XQuery calculations. My research area at the moment is to  
> find a programming environment which allows the use of my business  
> terms - as opposed to the XML domain specific approach of XSL/XQuery  
> - and supports a relatively painless migration path. XQuery  
> calculations are the first area in my application I would use for  
> benchmarking an alternative architecture.
>
> regards,
> Balazs
>


--
Burak Emir

http://lamp.epfl.ch/~emir

Reply | Threaded
Open this post in threaded view
|

announce: new scalax source "release"

Burak Emir
In reply to this post by Molnár Balázs-2
Dear Molnar and others,

Molnár Balázs wrote:

> When do you think you would make available the new Scalax  package ?
>
I put the new tarball of the sources on
http://lamp.epfl.ch/~emir/projects (it includes also some other little
tools)

schema2src (data binding tool)
xquery2src (translates XQuery to Scala)
xslt2src (translates XSLT to Scala)
pex (persistent xml)
xinc (Rusty Harold's SAXXIncluder in Scala)

plus the sources used in the draft book are now part  of the archive.
Get more for your money - now :-)

Note: I did not add namespace declaration support to xquery. But I'd
gladly check in a patch :-)

Here's another way of keeping up to date with scalax: since we are
gathering all our Scala projects together, you could also get the latest
scalax stuff directly from the Scala SVN  repository. This is described
on http://scala.epfl.ch/downloads/svn.html

hope you find this useful. cheers,
Burak

--
Burak Emir

http://lamp.epfl.ch/~emir

Reply | Threaded
Open this post in threaded view
|

supporting user-defined funs in xquery2src

Burak Emir
Hello,

would it be ok to assume that each namespace prefix f is bound in the
same xquery file?

Then adding this could be straightforward. A full implementation that
handles imports seems like more work.

cheers,
B.

Molnár Balázs wrote:

> Any plans on supporting XQuery function definitions like this one here ?
>
> declare function f:fibo($n as xs:integer) as item() {
>     if ($n = 0)
>     then 0
>     else if ($n = 1)
>     then 1
>     else (f:fibo($n - 1) + f:fibo($n -2))
> };
>
>
> regards,
> Balazs



--
Burak Emir

http://lamp.epfl.ch/~emir