From james.fuller.2007 at gmail.com Wed Oct 1 10:17:51 2008 From: james.fuller.2007 at gmail.com (James Fuller) Date: Wed Oct 1 00:18:09 2008 Subject: [xquery-talk] Advancing with XQuery article Message-ID: Hello All, I have had my xquery article published at IBM ... I thought I would post it here http://www.ibm.com/developerworks/edu/x-dw-x-advxquery.html?S_TACT=105AGX06&S_CMP=HP You will need to logon to IBM for this tutorial (free register). To run code samples you will need Michael Kay's excellent SAXON-SA XQuery and XSLT processor(yes, so u need to own it or have 30 day trial) and Apache Ant (which is used to run code samples). cheers, Jim Fuller From andrew.j.welch at gmail.com Wed Oct 1 10:39:41 2008 From: andrew.j.welch at gmail.com (Andrew Welch) Date: Wed Oct 1 01:39:59 2008 Subject: [xquery-talk] Advancing with XQuery article In-Reply-To: References: Message-ID: <74a894af0810010139l43a68d35v792a553c304f87a7@mail.gmail.com> Clicking "register now or sign in" takes me to "webpage not available".... Any chance you can post it elsewhere? (having to register is lame even if it is "free") 2008/10/1 James Fuller : > Hello All, > > I have had my xquery article published at IBM ... I thought I would post it here > > http://www.ibm.com/developerworks/edu/x-dw-x-advxquery.html?S_TACT=105AGX06&S_CMP=HP > > You will need to logon to IBM for this tutorial (free register). > > To run code samples you will need Michael Kay's excellent SAXON-SA > XQuery and XSLT processor(yes, so u need to own it or have 30 day > trial) and Apache Ant (which is used to run code samples). > > cheers, Jim Fuller > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk > -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ From james.fuller.2007 at gmail.com Wed Oct 1 11:48:39 2008 From: james.fuller.2007 at gmail.com (James Fuller) Date: Wed Oct 1 01:48:54 2008 Subject: [xquery-talk] Advancing with XQuery article In-Reply-To: <74a894af0810010139l43a68d35v792a553c304f87a7@mail.gmail.com> References: <74a894af0810010139l43a68d35v792a553c304f87a7@mail.gmail.com> Message-ID: On Wed, Oct 1, 2008 at 10:39 AM, Andrew Welch wrote: > Clicking "register now or sign in" takes me to "webpage not available".... > > Any chance you can post it elsewhere? (having to register is lame > even if it is "free") I have put PDF to here as well http://jim.fuller.name/x-advxquery-pdf.pdf I will put up the full package in a few days (e.g. source code) ... occupied with another release currently. hth, J > > > 2008/10/1 James Fuller : >> Hello All, >> >> I have had my xquery article published at IBM ... I thought I would post it here >> >> http://www.ibm.com/developerworks/edu/x-dw-x-advxquery.html?S_TACT=105AGX06&S_CMP=HP >> >> You will need to logon to IBM for this tutorial (free register). >> >> To run code samples you will need Michael Kay's excellent SAXON-SA >> XQuery and XSLT processor(yes, so u need to own it or have 30 day >> trial) and Apache Ant (which is used to run code samples). >> >> cheers, Jim Fuller >> _______________________________________________ >> talk@x-query.com >> http://x-query.com/mailman/listinfo/talk >> > > > > -- > Andrew Welch > http://andrewjwelch.com > Kernow: http://kernowforsaxon.sf.net/ > From mike at saxonica.com Wed Oct 1 12:25:00 2008 From: mike at saxonica.com (Michael Kay) Date: Wed Oct 1 11:25:23 2008 Subject: [xquery-talk] Advancing with XQuery article In-Reply-To: References: <74a894af0810010139l43a68d35v792a553c304f87a7@mail.gmail.com> Message-ID: Good article. A few comments: 1>XQuery allows you to bind a prefix to an empty string to indicate placing an element into the default element namespace I don't think that's correct. declare namespace p = ""; makes p unavailable for use. To quote: "If the URILiteral part of a namespace declaration is a zero-length string, any existing namespace binding for the given prefix is removed from the statically known namespaces. " 2>If you had a system-property() function, it would be relatively easy to implement XQuery function libraries made up of XQuery processor specific functions. It wouldn't actually help much, because the function bindings would still fail. You need a compile-time conditional, like XSLT 2.0's use-when (or some analog to xsl:import). 3>fn:not(fn:deep-equal($a,$b)) Why do so many people use the "fn:" prefix, it seems totally unnecessary? 4>Note: It's been kindly pointed out to me that these functions can check equality of datatypes as well I'm not sure what you mean by that, but it seems misleading. Datatypes aren't values and can't be compared. And if you mean that deep-equal() requires two values to have the same type, it doesn't - a decimal can still compare equal to a double. 5>fn:not(fn:boolean(fn:compare($a, $b))) Can't see why you would want to do this rather than using "eq". If you want to force codepoint collation, use a third argument to compare(), or use codepoint-equal(). 6>Note that this is a naive implementation of assertion (for example, even when disabled, it still calls the test:assert function, albeit with almost no processing cost). In Saxon there should be zero run-time cost - if($DEBUG) then ... else - gets optimized at compile time if DEBUG has a constant value. (In fact, a number of your examples will probably be evaluated entirely at compile time - check by using -explain. 7>As with the local:factorial example, you have a tail recursive function. No, the treewalker function is not tail-recursive. The recursive call is nested inside an element constructor which is itself inside a for loop. (But since the recursion depth is the depth of the XML tree, this doesn't matter.) 8>filter.xq Saxon will probably optimize this to declare function local:filter($func, $seq as item()*) as item()* { $seq[saxon:call($func, .)] }; but I wonder why you didn't write it that way? It seems to be the common XQuery trap of using complex FLWOR expressions where simple XPath expressions will do. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of James Fuller > Sent: 01 October 2008 09:49 > To: Andrew Welch > Cc: talk@x-query.com > Subject: Re: [xquery-talk] Advancing with XQuery article > > On Wed, Oct 1, 2008 at 10:39 AM, Andrew Welch > wrote: > > Clicking "register now or sign in" takes me to "webpage not > available".... > > > > Any chance you can post it elsewhere? (having to register is lame > > even if it is "free") > > I have put PDF to here as well > > http://jim.fuller.name/x-advxquery-pdf.pdf > > I will put up the full package in a few days (e.g. source code) ... > occupied with another release currently. > > hth, J > > > > > > > > 2008/10/1 James Fuller : > >> Hello All, > >> > >> I have had my xquery article published at IBM ... I > thought I would > >> post it here > >> > >> > http://www.ibm.com/developerworks/edu/x-dw-x-advxquery.html?S_TACT=10 > >> 5AGX06&S_CMP=HP > >> > >> You will need to logon to IBM for this tutorial (free register). > >> > >> To run code samples you will need Michael Kay's excellent SAXON-SA > >> XQuery and XSLT processor(yes, so u need to own it or have 30 day > >> trial) and Apache Ant (which is used to run code samples). > >> > >> cheers, Jim Fuller > >> _______________________________________________ > >> talk@x-query.com > >> http://x-query.com/mailman/listinfo/talk > >> > > > > > > > > -- > > Andrew Welch > > http://andrewjwelch.com > > Kernow: http://kernowforsaxon.sf.net/ > > > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From james.fuller.2007 at gmail.com Wed Oct 1 14:27:32 2008 From: james.fuller.2007 at gmail.com (James Fuller) Date: Wed Oct 1 12:12:02 2008 Subject: [xquery-talk] Advancing with XQuery article In-Reply-To: References: <74a894af0810010139l43a68d35v792a553c304f87a7@mail.gmail.com> Message-ID: On Wed, Oct 1, 2008 at 12:25 PM, Michael Kay wrote: > Good article. A few comments: thank you > 1>XQuery allows you to bind a prefix to an empty string to indicate placing > an > element into the default element namespace > > I don't think that's correct. > > declare namespace p = ""; > > makes p unavailable for use. To quote: "If the URILiteral part of a > namespace declaration is a zero-length string, any existing namespace > binding for the given prefix is removed from the statically known > namespaces. " I think I have conflated some of the finer points of what the spec says and what XQuery processors actually do. Its important to note that the original article and source code was written against several XQuery processors which I think has contributed to some slight differences. That being said, I still think that most of the article is 'true' in a 'dwim' sense as to what happens when you are actually using XQuery. I will go see why I said this once I get the chance to run it against the various XQuery processors again. > 2>If you had a system-property() function, it would be relatively easy to > implement > XQuery function libraries made up of XQuery processor specific functions. > > It wouldn't actually help much, because the function bindings would still > fail. You need a compile-time conditional, like XSLT 2.0's use-when (or some > analog to xsl:import). yes, but system-property() does help in writing checks for software ... probably would have helped to explicitly say that this would be useful in creating tests or a self check for installation/configuration versus dynamic runtime of code that 'does something useful'. However, I don't think u will convince me that not having the function is a benefit (which btw I don't think u are doing)... it is useful in XSLT and I think it would be useful in XQuery. > > 3>fn:not(fn:deep-equal($a,$b)) > > Why do so many people use the "fn:" prefix, it seems totally unnecessary? I always use the 'less touch typing is better' principle ... though I think I simply looked at the various specs and decided to blindly follow. > 4>Note: It's been kindly pointed out to me that these functions can check > equality of > datatypes as well > > I'm not sure what you mean by that, but it seems misleading. Datatypes > aren't values and can't be compared. And if you mean that deep-equal() > requires two values to have the same type, it doesn't - a decimal can still > compare equal to a double. I disagree that it is misleading people; I agree that I should probably explicitly state that this type of comparison is useful sometimes in unit testing scenarios. I find this kind of testing of basic assumptions especially true in immature technologies where processors across the spectrum are not 100% compliant or stable. > 5>fn:not(fn:boolean(fn:compare($a, $b))) > > Can't see why you would want to do this rather than using "eq". If you want > to force codepoint collation, use a third argument to compare(), or use > codepoint-equal(). serious brain cramp here ... of course u are right > 6>Note that this is a naive implementation of assertion (for example, even > when disabled, it still calls the test:assert function, albeit with almost > no > processing cost). > > In Saxon there should be zero run-time cost - if($DEBUG) then ... else - > gets optimized at compile time if DEBUG has a constant value. (In fact, a > number of your examples will probably be evaluated entirely at compile time > - check by using -explain. yes, I defer back to original code which I had written across several XQuery processors ... > > 7>As with the local:factorial example, you have a tail recursive function. > > No, the treewalker function is not tail-recursive. The recursive call is > nested inside an element constructor which is itself inside a for loop. (But > since the recursion depth is the depth of the XML tree, this doesn't > matter.) ugggg ... forgot about the element constructor bit ... thx for pointing out where I got this completely wrong .... other XQuery processors seem to have inferred tail recursion on such constructions (I would say some pretty optimistic xquery optimization in effect). I hope the principle is clear, just need to get the source code slightly amended ;) > 8>filter.xq > > Saxon will probably optimize this to > > declare function local:filter($func, $seq as item()*) as item()* { > $seq[saxon:call($func, .)] > }; > > but I wonder why you didn't write it that way? It seems to be the common > XQuery trap of using complex FLWOR expressions where simple XPath > expressions will do. I used to be constantly switching between FLWR and XPATH and found the results somewhat unreadable (for me). So what I do now is write FLWR form first, then if I have the time go back and optimize with XPATH. enough of my excuses, many many thanks for taking the time to read the article and thanks once again for the fantastic XQuery processor. cheers, Jim Fuller From remi at gide.net Fri Oct 3 16:17:13 2008 From: remi at gide.net (=?UTF-8?Q?R=C3=A9mi_Dewitte?=) Date: Fri Oct 3 06:17:35 2008 Subject: [xquery-talk] Optimizations Message-ID: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> Hi, I have made a little experiment after reading Michael (Kay) blog posts about optimizations and recent James Fuller article. I have a question quite specific to saxon still interesting in general. Why in the following example even the function call is not skipped ? XQuery is :: declare variable $level := 3; declare function local:debug($what){ if($level >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($dosmthg),$dosmthg) When I run saxon with -explain we get Cheers, R?mi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/a4459d62/attachment.htm From remi at gide.net Fri Oct 3 16:23:45 2008 From: remi at gide.net (=?UTF-8?Q?R=C3=A9mi_Dewitte?=) Date: Fri Oct 3 06:24:03 2008 Subject: [xquery-talk] Re: Optimizations In-Reply-To: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> References: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> Message-ID: <2184b2340810030623j3d4cbc5aq1a979294318e7c5d@mail.gmail.com> Hi again, In the same spirit, this is not at all optimized. Maybe I need Saxon SA ? declare variable $level as xs:integer := 3 ; declare function local:debug($l as xs:integer,$what){ if($l >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($level,$dosmthg),$dosmthg) R?mi On Fri, Oct 3, 2008 at 3:17 PM, R?mi Dewitte wrote: > Hi, > > I have made a little experiment after reading Michael (Kay) blog posts > about optimizations and recent James Fuller article. > > I have a question quite specific to saxon still interesting in general. > > Why in the following example even the function call is not skipped ? > > > XQuery is :: > > declare variable $level := 3; > > declare function local:debug($what){ > if($level >=4) then > {$what} > else () > }; > > let $dosmthg := test trace > > return > (local:debug($dosmthg),$dosmthg) > > When I run saxon with -explain we get > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Cheers, > R?mi > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/4ddd291d/attachment.htm From mike at saxonica.com Fri Oct 3 16:14:27 2008 From: mike at saxonica.com (Michael Kay) Date: Fri Oct 3 07:14:49 2008 Subject: [xquery-talk] Optimizations In-Reply-To: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> References: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> Message-ID: I think you ran this with Saxon-B. Saxon-SA does more powerful optimizations, and produces One of the optimizations that's done in Saxon-SA but not in Saxon-B is function inlining. Michael Kay http://www.saxonica.com/ _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of R?mi Dewitte Sent: 03 October 2008 14:17 To: talk@x-query.com Subject: [xquery-talk] Optimizations Hi, I have made a little experiment after reading Michael (Kay) blog posts about optimizations and recent James Fuller article. I have a question quite specific to saxon still interesting in general. Why in the following example even the function call is not skipped ? XQuery is :: declare variable $level := 3; declare function local:debug($what){ if($level >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($dosmthg),$dosmthg) -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/c7c4e0b3/attachment.htm From mike at saxonica.com Fri Oct 3 16:27:01 2008 From: mike at saxonica.com (Michael Kay) Date: Fri Oct 3 07:27:24 2008 Subject: [xquery-talk] Re: Optimizations In-Reply-To: <2184b2340810030623j3d4cbc5aq1a979294318e7c5d@mail.gmail.com> References: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> <2184b2340810030623j3d4cbc5aq1a979294318e7c5d@mail.gmail.com> Message-ID: <6DC73D75147140EE8153D7A06C3E35B2@Sealion> This is a case where Saxon (even Saxon-SA) has stopped optimizing when it could have achieved a little more. The relevant part of the final expression tree is and it hasn't noticed that the condition is now constant. Deciding when to stop optimizing is the trickiest part of the exercise - if you go on too long, optimization can take longer than any run-time savings it is delivering. In this occasion, two more passes would have paid dividends - one to evaluate the condition, the other to reduce the to (). Michael Kay http://www.saxonica.com/ _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of R?mi Dewitte Sent: 03 October 2008 14:24 To: talk@x-query.com Subject: [xquery-talk] Re: Optimizations Hi again, In the same spirit, this is not at all optimized. Maybe I need Saxon SA ? declare variable $level as xs:integer := 3 ; declare function local:debug($l as xs:integer,$what){ if($l >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($level,$dosmthg),$dosmthg) R?mi On Fri, Oct 3, 2008 at 3:17 PM, R?mi Dewitte wrote: Hi, I have made a little experiment after reading Michael (Kay) blog posts about optimizations and recent James Fuller article. I have a question quite specific to saxon still interesting in general. Why in the following example even the function call is not skipped ? XQuery is :: declare variable $level := 3; declare function local:debug($what){ if($level >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($dosmthg),$dosmthg) When I run saxon with -explain we get Cheers, R?mi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/e3510ab1/attachment-0001.htm From remi at gide.net Fri Oct 3 17:38:28 2008 From: remi at gide.net (=?UTF-8?Q?R=C3=A9mi_Dewitte?=) Date: Fri Oct 3 07:38:46 2008 Subject: [xquery-talk] Re: Optimizations In-Reply-To: <6DC73D75147140EE8153D7A06C3E35B2@Sealion> References: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> <2184b2340810030623j3d4cbc5aq1a979294318e7c5d@mail.gmail.com> <6DC73D75147140EE8153D7A06C3E35B2@Sealion> Message-ID: <2184b2340810030738g19bded27j78ff0f0aaabd75af@mail.gmail.com> Thanks Michael for these explanations, It is very good to know these details. And a good motivation to buy Saxon-SA. R?mi On Fri, Oct 3, 2008 at 4:27 PM, Michael Kay wrote: > This is a case where Saxon (even Saxon-SA) has stopped optimizing when it > could have achieved a little more. The relevant part of the final expression > tree is > > > > > > > > > > > > > > > > > > > > and it hasn't noticed that the condition is now constant. > > Deciding when to stop optimizing is the trickiest part of the exercise - if > you go on too long, optimization can take longer than any run-time savings > it is delivering. In this occasion, two more passes would have paid > dividends - one to evaluate the condition, the other to reduce the > to (). > > Michael Kay > http://www.saxonica.com/ > > > > ------------------------------ > *From:* talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] *On > Behalf Of *R?mi Dewitte > *Sent:* 03 October 2008 14:24 > *To:* talk@x-query.com > *Subject:* [xquery-talk] Re: Optimizations > > Hi again, > > In the same spirit, this is not at all optimized. > Maybe I need Saxon SA ? > > > declare variable $level as xs:integer := 3 ; > > declare function local:debug($l as xs:integer,$what){ > if($l >=4) then > {$what} > else () > }; > > let $dosmthg := test trace > > return > (local:debug($level,$dosmthg),$dosmthg) > > > R?mi > > On Fri, Oct 3, 2008 at 3:17 PM, R?mi Dewitte wrote: > >> Hi, >> >> I have made a little experiment after reading Michael (Kay) blog posts >> about optimizations and recent James Fuller article. >> >> I have a question quite specific to saxon still interesting in general. >> >> Why in the following example even the function call is not skipped ? >> >> >> XQuery is :: >> >> declare variable $level := 3; >> >> declare function local:debug($what){ >> if($level >=4) then >> {$what} >> else () >> }; >> >> let $dosmthg := test trace >> >> return >> (local:debug($dosmthg),$dosmthg) >> >> When I run saxon with -explain we get >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> Cheers, >> R?mi >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/a0be439a/attachment.htm From mike at saxonica.com Fri Oct 3 16:50:46 2008 From: mike at saxonica.com (Michael Kay) Date: Fri Oct 3 07:51:10 2008 Subject: [xquery-talk] Re: Optimizations In-Reply-To: <2184b2340810030738g19bded27j78ff0f0aaabd75af@mail.gmail.com> References: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> <2184b2340810030623j3d4cbc5aq1a979294318e7c5d@mail.gmail.com> <6DC73D75147140EE8153D7A06C3E35B2@Sealion> <2184b2340810030738g19bded27j78ff0f0aaabd75af@mail.gmail.com> Message-ID: <6449640970B745E3AA6379C37E12BF40@Sealion> It's now handling this case. It was actually doing the final optimization pass, the problem was that the "compareToInteger" expression, which is only introduced by the optimizer in a previous phase, wasn't being recognized as a candidate for further rewrite when the second operand became constant. Optimizers only improve by trying them out on new test cases, so it's always good to get feedback like this. Michael Kay http://www.saxonica.com/ _____ From: remidewitte@gmail.com [mailto:remidewitte@gmail.com] On Behalf Of R?mi Dewitte Sent: 03 October 2008 15:38 To: Michael Kay Cc: talk@x-query.com Subject: Re: [xquery-talk] Re: Optimizations Thanks Michael for these explanations, It is very good to know these details. And a good motivation to buy Saxon-SA. R?mi On Fri, Oct 3, 2008 at 4:27 PM, Michael Kay wrote: This is a case where Saxon (even Saxon-SA) has stopped optimizing when it could have achieved a little more. The relevant part of the final expression tree is and it hasn't noticed that the condition is now constant. Deciding when to stop optimizing is the trickiest part of the exercise - if you go on too long, optimization can take longer than any run-time savings it is delivering. In this occasion, two more passes would have paid dividends - one to evaluate the condition, the other to reduce the to (). Michael Kay http://www.saxonica.com/ _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of R?mi Dewitte Sent: 03 October 2008 14:24 To: talk@x-query.com Subject: [xquery-talk] Re: Optimizations Hi again, In the same spirit, this is not at all optimized. Maybe I need Saxon SA ? declare variable $level as xs:integer := 3 ; declare function local:debug($l as xs:integer,$what){ if($l >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($level,$dosmthg),$dosmthg) R?mi On Fri, Oct 3, 2008 at 3:17 PM, R?mi Dewitte wrote: Hi, I have made a little experiment after reading Michael (Kay) blog posts about optimizations and recent James Fuller article. I have a question quite specific to saxon still interesting in general. Why in the following example even the function call is not skipped ? XQuery is :: declare variable $level := 3; declare function local:debug($what){ if($level >=4) then {$what} else () }; let $dosmthg := test trace return (local:debug($dosmthg),$dosmthg) When I run saxon with -explain we get Cheers, R?mi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/c626ac0e/attachment-0001.htm From remi at gide.net Fri Oct 3 18:13:03 2008 From: remi at gide.net (=?UTF-8?Q?R=C3=A9mi_Dewitte?=) Date: Fri Oct 3 08:13:22 2008 Subject: [xquery-talk] Re: Optimizations In-Reply-To: <6449640970B745E3AA6379C37E12BF40@Sealion> References: <2184b2340810030617r6181c7d9n7f1b95accec37986@mail.gmail.com> <2184b2340810030623j3d4cbc5aq1a979294318e7c5d@mail.gmail.com> <6DC73D75147140EE8153D7A06C3E35B2@Sealion> <2184b2340810030738g19bded27j78ff0f0aaabd75af@mail.gmail.com> <6449640970B745E3AA6379C37E12BF40@Sealion> Message-ID: <2184b2340810030813v2908a46ck739b1a4cca9f600c@mail.gmail.com> To be honest this is this kind of feature (like differed evaluation of variables) I really like in XQuery and specifically in saxon. It allows a logging module without paying any runtime penalty if a level is disabled. With the limit of not being able to change logging level at runtime but I am ok with that. R?mi On Fri, Oct 3, 2008 at 4:50 PM, Michael Kay wrote: > It's now handling this case. It was actually doing the final optimization > pass, the problem was that the "compareToInteger" expression, which is only > introduced by the optimizer in a previous phase, wasn't being recognized as > a candidate for further rewrite when the second operand became constant. > > Optimizers only improve by trying them out on new test cases, so it's > always good to get feedback like this. > > Michael Kay > http://www.saxonica.com/ > > ------------------------------ > *From:* remidewitte@gmail.com [mailto:remidewitte@gmail.com] *On Behalf Of > *R?mi Dewitte > *Sent:* 03 October 2008 15:38 > *To:* Michael Kay > *Cc:* talk@x-query.com > *Subject:* Re: [xquery-talk] Re: Optimizations > > Thanks Michael for these explanations, > It is very good to know these details. And a good motivation to buy > Saxon-SA. > > R?mi > > On Fri, Oct 3, 2008 at 4:27 PM, Michael Kay wrote: > >> This is a case where Saxon (even Saxon-SA) has stopped optimizing when >> it could have achieved a little more. The relevant part of the final >> expression tree is >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> and it hasn't noticed that the condition is now constant. >> >> Deciding when to stop optimizing is the trickiest part of the exercise - >> if you go on too long, optimization can take longer than any run-time >> savings it is delivering. In this occasion, two more passes would have paid >> dividends - one to evaluate the condition, the other to reduce the >> to (). >> >> Michael Kay >> http://www.saxonica.com/ >> >> >> >> ------------------------------ >> *From:* talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] *On >> Behalf Of *R?mi Dewitte >> *Sent:* 03 October 2008 14:24 >> *To:* talk@x-query.com >> *Subject:* [xquery-talk] Re: Optimizations >> >> Hi again, >> >> In the same spirit, this is not at all optimized. >> Maybe I need Saxon SA ? >> >> >> declare variable $level as xs:integer := 3 ; >> >> declare function local:debug($l as xs:integer,$what){ >> if($l >=4) then >> {$what} >> else () >> }; >> >> let $dosmthg := test trace >> >> return >> (local:debug($level,$dosmthg),$dosmthg) >> >> >> R?mi >> >> On Fri, Oct 3, 2008 at 3:17 PM, R?mi Dewitte wrote: >> >>> Hi, >>> >>> I have made a little experiment after reading Michael (Kay) blog posts >>> about optimizations and recent James Fuller article. >>> >>> I have a question quite specific to saxon still interesting in general. >>> >>> Why in the following example even the function call is not skipped ? >>> >>> >>> XQuery is :: >>> >>> declare variable $level := 3; >>> >>> declare function local:debug($what){ >>> if($level >=4) then >>> {$what} >>> else () >>> }; >>> >>> let $dosmthg := test trace >>> >>> return >>> (local:debug($dosmthg),$dosmthg) >>> >>> When I run saxon with -explain we get >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> Cheers, >>> R?mi >>> >> >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081003/e2cf1db5/attachment.htm From mike at saxonica.com Wed Oct 15 22:55:17 2008 From: mike at saxonica.com (Michael Kay) Date: Wed Oct 15 13:54:39 2008 Subject: [xquery-talk] How do different XQuery products implement modules? Message-ID: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> The XQuery WG has been considering the behaviour of module imports with an eye to clarifying and cleaning it up, as it appears to be both underspecified in some cases and over-complicated in others. Currently a great deal of the behaviour is implementation-defined, which may be necessary to handle the necessary differences between one environment and another, or may turn out to be unnecessary. Clearly it would be better if we could offer users a stronger guarantee of interoperability without over-constraining implementations. We are seeking feedback to discover how existing implementations have interpreted the spec in order to guide our decisions. If you're involved with an implementation, especially one that isn't directly represented on the Working Group, we'd be grateful for answers to the following questions (and any other comments on the general area): 1. Is the module URI just an arbitrary character string, or does it have any semantics? 1a. In particular, is it the location of a resource on the web? 2. Do you allow several different modules in the same query to have the same module URI? 2a. if so, can different "import module" declarations import different subsets of these? 3. Can users import a module without specifying a location URI? If so, how is the module located? 4. If import module specifies a location URI, is it used, and if so how? 5. If import module specifies more than one location URI, how are they used? 5b. If multiple location URIs are allowed, what happens if import module specifies the same location URI more than once? 6. What happens when two modules A and B both import module URI M 6a. specifying the same location URI 6b. specifying different location URIs 6c. without specifying a location URI 7. Is it possible (by means of multiple imports) to create two different "instances" of the same module in a query, with distinct values of global variables, or do all imports get the same instance with a common set of variables? From christian.gruen at gmail.com Thu Oct 16 02:00:27 2008 From: christian.gruen at gmail.com (Christian Gruen) Date: Wed Oct 15 15:59:49 2008 Subject: [xquery-talk] How do different XQuery products implement modules? In-Reply-To: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> References: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> Message-ID: Hi Michael, some comments regarding the module implementation in BaseX: > 1. Is the module URI just an arbitrary character string, or does it have > any semantics? ..the module URI is handled as a simple URI instance without special semantics (non-empty, differing from the XML namespace, ..) > 2. Do you allow several different modules in the same query to have the > same module URI? ..yep. > 2a. if so, can different "import module" declarations import different > subsets of these? ..nope. > 3. Can users import a module without specifying a location URI? If so, > how is the module located? ..no; only coders accessing can do so. > 4. If import module specifies a location URI, is it used, and if so how? ..similar to the doc(..) function. > 5. If import module specifies more than one location URI, how are they > used? ..they are all sequentially parsed. > 5b. If multiple location URIs are allowed, what happens if > import module specifies the same location URI more than once? ..the known location URIs are skipped. > 6. What happens when two modules A and B both import module URI M > > 6a. specifying the same location URI ..again, the known location URIs are skipped. > 6b. specifying different location URIs ..if the resulting modules have different contents, everything works fine - see 2) - otherwise, an error will be thrown because of duplicate function/variable declarations. > 6c. without specifying a location URI ..an error will be thrown - see 3) > 7. Is it possible (by means of multiple imports) to create two different > "instances" of the same module in a query, with distinct values of global > variables, or do all imports get the same instance with a common set of > variables? ..all imports share the same instance. Hope this helps, Christian BaseX http://www.basex.org From per at bothner.com Wed Oct 15 19:53:53 2008 From: per at bothner.com (Per Bothner) Date: Wed Oct 15 18:53:46 2008 Subject: [xquery-talk] How do different XQuery products implement modules? In-Reply-To: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> References: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> Message-ID: <48F69EB1.90402@bothner.com> Answers for Qexo: [I wrote the code a number of years ago, so in some cases my memory might be off, so I am looking at teh code to refresh my memory.] Michael Kay wrote: > 1. Is the module URI just an arbitrary character string, or does it have any > semantics? It can be be arbitrary string, but it is "mangled" to the name of a "package" in the Java class hierarchy, similar to the JAXB mangling. > 1a. In particular, is it the location of a resource on the web? No. > 2. Do you allow several different modules in the same query to have the same > module URI? Yes. > 2a. if so, can different "import module" declarations import different > subsets of these? Possibly, but it isn't supported or recommended. > 3. Can users import a module without specifying a location URI? Yes, but the module has to either have been previously compiled to a Java class (in the current class path), or the imported module must have been "registered" with the module manager - which happens when compiling multiple modules on the same "compilation line". > If so, how is the module located? It mangles the namespace to a package name. It then looks for a class named $ModuleMap$ in that packages. This class contains a list of all modules whose namespace mangle to this package name. The compiler loads the $ModuleMap$ class, and selects the modules whose namespace URIs match. When a module is compiled, the compiler creates a class in the package corresponding to the module's URI. The name of the class is a mangling of the last component of the source file name, within the package created by mangling the namespace URI. The compiler then updates the $ModuleMap$ to include the compiled module(s). If $ModuleMap$ already exists, then the class is first is loaded so the old contents can be merged into the $ModuleMap$ that gets written out. > 4. If import module specifies a location URI, is it used, and if so how? A source file is looked for. It also mangles the source file name and the namespace URI to yield a class name, and looks for that as well. It will work if it finds either. If both are found, it will compre time-stamps. > 5. If import module specifies more than one location URI, how are they used? Each location URI must map to a module; all are loaded. > 5b. If multiple location URIs are allowed, what happens if > import module specifies the same location URI more than once? Hm. That should be an error, but I don't think I test that, > 6. What happens when two modules A and B both import module URI M > > 6a. specifying the same location URI Same module. > 6b. specifying different location URIs Not sure - it should be an error. > 6c. without specifying a location URI Same module, found using mangled class - see 3, > 7. Is it possible (by means of multiple imports) to create two different > "instances" of the same module in a query, with distinct values of global > variables, or do all imports get the same instance with a common set of > variables? The latter. By default a module variables are compiled to static fields of the module class, so they're inherently shared. There is a compiler option to compile to instance variables. In that case a single "module instance" will be allocated, global to the current "module context". -- --Per Bothner per@bothner.com http://per.bothner.com/ From yuin405 at gmail.com Thu Oct 16 17:36:54 2008 From: yuin405 at gmail.com (Makoto YUI) Date: Thu Oct 16 00:36:17 2008 Subject: [xquery-talk] How do different XQuery products implement modules? In-Reply-To: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> References: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> Message-ID: <48F6EF16.1040900@gmail.com> Hi Michael, Some comments regarding the work-in-progress module implementation in XBird. > 1. Is the module URI just an arbitrary character string, or does it have any > semantics? A module URI represents generic URI reference defined by RFC 2396 [1]. [1] http://www.ietf.org/rfc/rfc2396.txt > 1a. In particular, is it the location of a resource on the web? Possibly. > 2. Do you allow several different modules in the same query to have the same > module URI? Not allowed. It causes a static error "err:XQST0047". http://www.w3.org/TR/xquery/#ERRXQST0047 > 2a. if so, can different "import module" declarations import different > subsets of these? > 3. Can users import a module without specifying a location URI? If so, how > is the module located? At least one URIs are required due to [2]. [2] http://www.w3.org/TR/xquery/#doc-xquery-ModuleImport > 4. If import module specifies a location URI, is it used, and if so how? (1) Connected to the remote object that the URI locates. (2) Read and parse the object. > 5. If import module specifies more than one location URI, how are they used? Currently, only the first one is used. It would be better to use the first 'live' remote resource. > 5b. If multiple location URIs are allowed, what happens if > import module specifies the same location URI more than once? > 6. What happens when two modules A and B both import module URI M > > 6a. specifying the same location URI [6a-1] When same target namespaces (module URIs) are specified. See 2. [6a-2] When distinct target namespaces (module URIs) are specified. The resource that a location URI specifies might be a dynamic content. Thus, child modules are individually parsed and imported to the parent module. As a consequence, it often follows an error (err:XQST0049 or err:XQST0034) for *static* contents. http://www.w3.org/TR/xquery/#ERRXQST0049 http://www.w3.org/TR/xquery/#ERRXQST0034 Skip loading a module on same location may be preferred. > 6b. specifying different location URIs 6b turns into the same result to 6a. > 6c. without specifying a location URI As written in 3 and 1. > 7. Is it possible (by means of multiple imports) to create two different > "instances" of the same module in a query, with distinct values of global > variables, or do all imports get the same instance with a common set of > variables? Possible if the target namespaces differ. But it is practically impossible because a library module must have a namespace URI that is the same as the target namespace [3,4]. [3] http://www.w3.org/TR/xquery/#doc-xquery-ModuleDecl [4] http://www.w3.org/TR/xquery/#ERRXQST0048 What a wired behavior that does not actually allow loading a module multiple times :-{ I think simply allowing users to override a module URI with a target namespace makes it (both behavior conceptually) possible. #Of course, topic 7 closely related to topic 2 and 6a-2. Hope this helps, Makoto YUI -- XBird - Light-weight XQuery processor and XML database system written in Java. http://code.google.com/p/xbird/ From Andy.K.Chang at aexp.com Thu Oct 16 13:03:24 2008 From: Andy.K.Chang at aexp.com (Andy K Chang) Date: Thu Oct 16 12:03:40 2008 Subject: [xquery-talk] Andy K Chang is out of office Message-ID: I will be out of the office starting 10/14/2008 and will not return until 10/17/2008. Hi, I will be out of office from 10/14 till 10/16. Returing on 10/17. During this time, my delegate will be: Jules A Mahabir for RA Joseph K Durnell for z/Linux and CSP pilot For anything else, please contact my leader Randall W Latham. Please note that I may come back to work (work at home) on 10/16. And I will be checking e-mail during these 3 days. Should you have any urgent matter, you may also contact me on my cell: 480-203-3964 American Express made the following annotations on Thu Oct 16 2008 13:03:20 ------------------------------------------------------------------------------ "This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you." American Express a ajouté le commentaire suivant le Thu Oct 16 2008 13:03:20 Ce courrier et toute pièce jointe qu'il contient sont réservés au seul destinataire indiqué et peuvent renfermer des renseignements confidentiels et privilégiés. Si vous n'êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courrier ou de toute pièce jointe est interdite. Si vous avez reçu cette communication par erreur, veuillez nous en aviser par courrier et détruire immédiatement le courrier et les pièces jointes. Merci. ****************************************************************************** ------------------------------------------------------------------------------- From Y.Forkl at srz.de Fri Oct 17 16:12:21 2008 From: Y.Forkl at srz.de (Yves Forkl) Date: Fri Oct 17 06:13:17 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output Message-ID: <48F88F35.80706@srz.de> Hi, from a very simple XML input, I would like to create a CSV-like output, putting each record (as I see them) in a line of its own, with its fields separated by some delimiter like a semicolon. It works quite well, except that a space gets inserted at the front of each line starting from the second line in the output. My demo input is: A 33 1,5 A 33 0,5 B 22 0,5 My XQuery file has: declare namespace saxon="http://saxon.sf.net/"; declare option saxon:output "method=text"; let $entries := /list/entry for $property1 in distinct-values($entries/property1), $property2 in distinct-values($entries[property1 = $property1]/property2) let $selected_entries := $entries[property1 = $property1 and property2 = $property2] order by $property1, $property2 return( concat( string-join( ($property1, $property2, replace(xs:string( sum(for $quantity in $selected_entries/quantity return xs:decimal(replace($quantity, ",", ".")))), "\.", ",")), ";"), " ")) The result as obtained with Saxon 8.8.0.4J is: A;33;2 B;22;0,5 It is the space at the beginning of the second line that I can't get away with. Can you explain what I am doing wrong here and maybe suggest a solution? (Another question: Within my "quantity" elements, I use the German decimal separator which is a comma. Is there a more elegant way than translating it to a dot and back, like above, when summing up the values found in this element?) Yves From mike at saxonica.com Fri Oct 17 16:04:47 2008 From: mike at saxonica.com (Michael Kay) Date: Fri Oct 17 07:05:25 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F88F35.80706@srz.de> References: <48F88F35.80706@srz.de> Message-ID: <8E936D55898F473EB1555EEDBDF5F929@Sealion> Your query is returning a sequence of strings, and when that gets serialized using the text output method, the strings are shown space-separated. (You would appreciate this if your query were simply "//property1/string()".) The obvious way to prevent this is to wrap your whole query in string-join(, '') In fact you could then get rid of the concat() from your query and use  as the second argument of string-join() instead. Doing that directly might not be very legible: you could put the query in a function to get around this. > (Another question: Within my "quantity" elements, I use the > German decimal separator which is a comma. Is there a more > elegant way than translating it to a dot and back, like > above, when summing up the values found in this element?) Not really. You can do simple translations like this using translate() rather than replace(), but it's no less code. Michael Kay http://www.saxonica.com/ > -----Original Message----- > From: talk-bounces@x-query.com > [mailto:talk-bounces@x-query.com] On Behalf Of Yves Forkl > Sent: 17 October 2008 14:12 > To: talk@x-query.com > Subject: [xquery-talk] Whitespace problem in CSV-like output > > Hi, > > from a very simple XML input, I would like to create a > CSV-like output, putting each record (as I see them) in a > line of its own, with its fields separated by some delimiter > like a semicolon. > > It works quite well, except that a space gets inserted at the > front of each line starting from the second line in the output. > > My demo input is: > > > > > A > 33 > 1,5 > > > A > 33 > 0,5 > > > B > 22 > 0,5 > > > > My XQuery file has: > > declare namespace saxon="http://saxon.sf.net/"; declare > option saxon:output "method=text"; > > let $entries := /list/entry > > for $property1 in distinct-values($entries/property1), > $property2 in distinct-values($entries[property1 = > $property1]/property2) > let $selected_entries := $entries[property1 = $property1 and > property2 = $property2] > order by $property1, $property2 > return( > concat( > string-join( > ($property1, $property2, > replace(xs:string( > sum(for $quantity in $selected_entries/quantity > return xs:decimal(replace($quantity, > ",", ".")))), > "\.", > ",")), > ";"), > " ")) > > The result as obtained with Saxon 8.8.0.4J is: > > A;33;2 > B;22;0,5 > > It is the space at the beginning of the second line that I > can't get away with. Can you explain what I am doing wrong > here and maybe suggest a solution? > > (Another question: Within my "quantity" elements, I use the > German decimal separator which is a comma. Is there a more > elegant way than translating it to a dot and back, like > above, when summing up the values found in this element?) > > Yves > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk From john.snelson at oracle.com Fri Oct 17 16:18:19 2008 From: john.snelson at oracle.com (John Snelson) Date: Fri Oct 17 07:19:41 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F88F35.80706@srz.de> References: <48F88F35.80706@srz.de> Message-ID: <48F89EAB.8050809@oracle.com> Hi Yves, The whitespace is added as a separator when the multiple strings returned from your query are concatenated. To stop it, wrap the entire query in a call to string-join(), like this: string-join( let $entries := /list/entry for $property1 in distinct-values($entries/property1), ...... ";"), " ")), "") XQuery doesn't have a built in way to read numbers using decimal commas, so the way you are doing it is about as good as it gets. John Yves Forkl wrote: > Hi, > > from a very simple XML input, I would like to create a CSV-like output, > putting each record (as I see them) in a line of its own, with its > fields separated by some delimiter like a semicolon. > > It works quite well, except that a space gets inserted at the front of > each line starting from the second line in the output. > > My demo input is: > > > > > A > 33 > 1,5 > > > A > 33 > 0,5 > > > B > 22 > 0,5 > > > > My XQuery file has: > > declare namespace saxon="http://saxon.sf.net/"; > declare option saxon:output "method=text"; > > let $entries := /list/entry > > for $property1 in distinct-values($entries/property1), > $property2 in distinct-values($entries[property1 = > $property1]/property2) > let $selected_entries := $entries[property1 = $property1 and > property2 = $property2] > order by $property1, $property2 > return( > concat( > string-join( > ($property1, $property2, > replace(xs:string( > sum(for $quantity in $selected_entries/quantity > return xs:decimal(replace($quantity, ",", ".")))), > "\.", > ",")), > ";"), > " ")) > > The result as obtained with Saxon 8.8.0.4J is: > > A;33;2 > B;22;0,5 > > It is the space at the beginning of the second line that I can't get > away with. Can you explain what I am doing wrong here and maybe suggest > a solution? > > (Another question: Within my "quantity" elements, I use the German > decimal separator which is a comma. Is there a more elegant way than > translating it to a dot and back, like above, when summing up the values > found in this element?) > > Yves > _______________________________________________ > talk@x-query.com > http://x-query.com/mailman/listinfo/talk -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From danmbox at gmail.com Fri Oct 17 18:38:09 2008 From: danmbox at gmail.com (Dan Muresan) Date: Fri Oct 17 07:38:26 2008 Subject: [xquery-talk] Re: How do different XQuery products implement modules? In-Reply-To: References: <3B50C167F30C4DC5A8983A90C77D5AAF@Sealion> Message-ID: <48F8A351.3@gmail.com> Hi, here are the answers for Zorba (http://www.zorba-xquery.com/): >> 1. Is the module URI just an arbitrary character string, or does it >> have any semantics? It is an arbitrary character string. >> 1a. In particular, is it the location of a resource on the web? This is not required; however, users can supply module URI resolvers that may choose to attach arbitrary meaning to the module URI (this is work in progress). >> 2. Do you allow several different modules in the same query to have >> the same module URI? Yes, but all modules sharing the same module URI must be imported from a single "import module" declaration (by specifying multiple location hints). >> 2a. if so, can different "import module" declarations import different >> subsets of these? No. >> 3. Can users import a module without specifying a location URI? If so, how >> is the module located? Not by default. However, a user-supplied module URI resolver can process the module namespace and location hints arbitrarily to generate one (or more) final locations. >> 4. If import module specifies a location URI, is it used, and if so how? It is used to locate a local file or a web location. >> 5. If import module specifies more than one location URI, how are they >> used? By default, each location hint URI is processed separately to yield a separate LibraryModule. Custom module URI resolvers can do whatever the user wants (possibly yielding fewer or more LibraryModule's than the supplied hints). >> 5b. If multiple location URIs are allowed, what happens if >> import module specifies the same location URI more than once? By default, redundant hints are ignored. >> 6. What happens when two modules A and B both import module URI M >> >> 6a. specifying the same location URI A single instance of the module M is created. >> 6b. specifying different location URIs If the two location URIs are equivalent up to relative URI resolution, same as above. If not, then two distinct modules are imported. >> 6c. without specifying a location URI This can only happened with a user-supplied module URI resolver, and the result then depends on the user's code. >> 7. Is it possible (by means of multiple imports) to create two different >> "instances" of the same module in a query, with distinct values of global >> variables, or do all imports get the same instance with a common set of >> variables? A single instance of a module is ever created. If a module is addressable by two distinct URI's (e.g. in Unix, if file mod2.xq is a symlink to mod1.xq), then these behave as two separate modules with identical source code. -- Dan Muresan From Y.Forkl at srz.de Fri Oct 17 18:19:38 2008 From: Y.Forkl at srz.de (Yves Forkl) Date: Fri Oct 17 08:20:25 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <8E936D55898F473EB1555EEDBDF5F929@Sealion> References: <48F88F35.80706@srz.de> <8E936D55898F473EB1555EEDBDF5F929@Sealion> Message-ID: <48F8AD0A.6090502@srz.de> I am very grateful to both of you for your valuable suggestions. It is a bit disappointing to see that XQuery does not offer a simple, general method to create CSV-type files, at least not in my case. I have picked up the idea to use functions, but rather than encapsulating the query, I (for now) prefer to put the string manipulation operations into functions so that I can reuse them and use them for parametrization. So now I have: xquery version "1.0" encoding "ISO-8859-1"; declare namespace saxon="http://saxon.sf.net/"; declare namespace my="http://xmlns.srz.de/yforkl/xquery/functions"; declare option saxon:output "method=text"; declare function my:join-fields-into-record ( $fields as xs:string*, $delimiter as xs:string ) as xs:string { concat(string-join($fields, $delimiter), " ") } ; declare function my:join-records-into-lines ( $records as xs:string* ) as xs:string { string-join($records, "") } ; my:join-records-into-lines( let $entries := /list/entry for $property1 in distinct-values($entries/property1), $property2 in distinct-values( $entries[property1 = $property1]/property2) let $selected_entries := $entries[property1 = $property1 and property2 = $property2] order by $property1, $property2 return( my:join-fields-into-record( ($property1, $property2, translate( xs:string( sum( for $quantity in $selected_entries/quantity return xs:decimal(translate($quantity, ",", ".")))), ".", ",")), ";")) ) NB: While the names of the functions seem to suggest that the line feed should rather be appended in my:join-records-into-lines than in my:join-fields-into-record, I don't see any easy way to do this. Yves From per at bothner.com Fri Oct 17 03:19:25 2008 From: per at bothner.com (Per Bothner) Date: Fri Oct 17 09:20:08 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F88F35.80706@srz.de> References: <48F88F35.80706@srz.de> Message-ID: <48F8589D.7030105@bothner.com> Yves Forkl wrote: > Hi, > > from a very simple XML input, I would like to create a CSV-like > output, putting each record (as I see them) in a line of its own, with > its fields separated by some delimiter like a semicolon. A trick is to use text nodes, because that suppresses the extra spaces: let $entries := doc("file:/home/bothner/tmp/demo.xml")/list/entry for $property1 in distinct-values($entries/property1), $property2 in distinct-values($entries[property1 = $property1]/property2) let $selected_entries := $entries[property1 = $property1 and property2 = $property2] order by $property1, $property2 return( string-join( ($property1, $property2, replace(xs:string( sum(for $quantity in $selected_entries/quantity return xs:decimal(replace($quantity, ",", ".")))), "\.", ",")), ";"), text{" "}) Produces: A;33;2 B;22;0,5 (I haven't tested this on Saxon, just Qexo.) From john.snelson at oracle.com Fri Oct 17 18:23:32 2008 From: john.snelson at oracle.com (John Snelson) Date: Fri Oct 17 09:24:51 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F8AD0A.6090502@srz.de> References: <48F88F35.80706@srz.de> <8E936D55898F473EB1555EEDBDF5F929@Sealion> <48F8AD0A.6090502@srz.de> Message-ID: <48F8BC04.7010606@oracle.com> Yves Forkl wrote: > It is a bit disappointing to see that XQuery does not offer a simple, > general method to create CSV-type files, at least not in my case. What would be simpler than what you have written here? > NB: While the names of the functions seem to suggest that the line feed > should rather be appended in my:join-records-into-lines than in > my:join-fields-into-record, I don't see any easy way to do this. Redefine your functions like this: declare function my:join-fields-into-record ( $fields as xs:string*, $delimiter as xs:string ) as xs:string { string-join($fields, $delimiter) } ; declare function my:join-records-into-lines ( $records as xs:string* ) as xs:string { string-join($records, " ") } ; John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From ivanpedruzzi at gmail.com Fri Oct 17 16:36:42 2008 From: ivanpedruzzi at gmail.com (Ivan Pedruzzi) Date: Fri Oct 17 12:37:16 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F8589D.7030105@bothner.com> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> Message-ID: <6ce57d220810171236x487829ack5fc2f69cc817849a@mail.gmail.com> DataDirect XQuery allows to pipe a CSV converter among others. In this particular example the input document has a perfect structure and can be directly piped. declare option ddtek:serialize "method=CSV:root=list:row=entry"; / result A,33,"1,5" A,33,"0,5" B,22,"0,5" Ivan Pedruzzi DataDirect Technologies http://www.xquery.com/data-integration/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081017/c9f03358/attachment.htm From mike at saxonica.com Sat Oct 18 00:07:27 2008 From: mike at saxonica.com (Michael Kay) Date: Fri Oct 17 15:08:04 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <6ce57d220810171236x487829ack5fc2f69cc817849a@mail.gmail.com> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> <6ce57d220810171236x487829ack5fc2f69cc817849a@mail.gmail.com> Message-ID: <3835910ED02D45E19D1EEB58255A1F3B@Sealion> Nice! Michael Kay http://www.saxonica.com/ _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Ivan Pedruzzi Sent: 17 October 2008 20:37 To: talk@x-query.com Subject: Re: [xquery-talk] Whitespace problem in CSV-like output DataDirect XQuery allows to pipe a CSV converter among others. In this particular example the input document has a perfect structure and can be directly piped. declare option ddtek:serialize "method=CSV:root=list:row=entry"; / result A,33,"1,5" A,33,"0,5" B,22,"0,5" Ivan Pedruzzi DataDirect Technologies http://www.xquery.com/data-integration/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081017/be80ae08/attachment.htm From Y.Forkl at srz.de Mon Oct 20 12:44:39 2008 From: Y.Forkl at srz.de (Yves Forkl) Date: Mon Oct 20 02:43:12 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F8589D.7030105@bothner.com> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> Message-ID: <48FC5307.7000402@srz.de> Per Bothner wrote: > A trick is to use text nodes, because that suppresses the extra spaces: This provides for a really neat solution, thank you very much for this suggestion. Trying to understand why it is working (it does, tested it with Saxon): Appending the line feed as a text node seems to influence on the interpretation of the other items returned that are now seen as text nodes, too, (and thus serialized as immediately adjacent strings) rather than as strings that need to be separated with spaces. Is that correct? Yves From Y.Forkl at srz.de Mon Oct 20 13:00:40 2008 From: Y.Forkl at srz.de (Yves Forkl) Date: Mon Oct 20 02:59:07 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48F8BC04.7010606@oracle.com> References: <48F88F35.80706@srz.de> <8E936D55898F473EB1555EEDBDF5F929@Sealion> <48F8AD0A.6090502@srz.de> <48F8BC04.7010606@oracle.com> Message-ID: <48FC56C8.2020100@srz.de> John Snelson wrote: > Yves Forkl wrote: >> It is a bit disappointing to see that XQuery does not offer a simple, >> general method to create CSV-type files, at least not in my case. > > What would be simpler than what you have written here? Well... Maybe an extension function like the one DataDirect XQuery seems to offer, as he have learned? :-) Seriously, I was somehow puzzled about the complexity of the whitespace problem in the simple task of writing out some fields into the lines of a file. >> NB: While the names of the functions seem to suggest that the line >> feed should rather be appended in my:join-records-into-lines than in >> my:join-fields-into-record, I don't see any easy way to do this. > > Redefine your functions like this: > > declare function my:join-fields-into-record > ( $fields as xs:string*, > $delimiter as xs:string ) as xs:string { > string-join($fields, $delimiter) > } ; > declare function my:join-records-into-lines > ( $records as xs:string* ) as xs:string { > string-join($records, " ") > } ; Sorry for being so terse. I meant: It would be natural to change the functions exactly this way, but this will drop the line feed of the last line in the output, which would be undesirable. So I prefer to keep the functions unchanged, irrespectively of their slightly misleading names (or rather use text nodes than functions to get whitespace right). Yves From Y.Forkl at srz.de Mon Oct 20 13:08:39 2008 From: Y.Forkl at srz.de (Yves Forkl) Date: Mon Oct 20 03:07:07 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <6ce57d220810171236x487829ack5fc2f69cc817849a@mail.gmail.com> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> <6ce57d220810171236x487829ack5fc2f69cc817849a@mail.gmail.com> Message-ID: <48FC58A7.7060507@srz.de> Ivan Pedruzzi wrote: > DataDirect XQuery allows to pipe a CSV converter among others. > > In this particular example the input document has a perfect structure > and can be directly piped. > > declare option ddtek:serialize "method=CSV:root=list:row=entry"; Thank you very much for this hint. However, I am not just copying row-type elements from the input file, but rather summing up the values found in the "quantity" children of the entries, after grouping them by the content of "property1" and "property2" (see the first message in this thread). I wonder how I could perform this task using the above approach. Yves From john.snelson at oracle.com Mon Oct 20 12:12:04 2008 From: john.snelson at oracle.com (John Snelson) Date: Mon Oct 20 03:11:09 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48FC56C8.2020100@srz.de> References: <48F88F35.80706@srz.de> <8E936D55898F473EB1555EEDBDF5F929@Sealion> <48F8AD0A.6090502@srz.de> <48F8BC04.7010606@oracle.com> <48FC56C8.2020100@srz.de> Message-ID: <48FC5974.7010207@oracle.com> Yves Forkl wrote: > John Snelson wrote: >> Yves Forkl wrote: >>> It is a bit disappointing to see that XQuery does not offer a simple, >>> general method to create CSV-type files, at least not in my case. >> >> What would be simpler than what you have written here? > > Well... Maybe an extension function like the one DataDirect XQuery seems > to offer, as he have learned? :-) Seriously, I was somehow puzzled about > the complexity of the whitespace problem in the simple task of writing > out some fields into the lines of a file. Well, DataDirect's method seems to require you to construct a custom XML structure, and specify a implementation specific serialization method. Your current method requires that you create some strings, and join them with string-join(). I'm not sure there's a lot of difference between the two. I agree that using a space as a separator between atomic items when outputting them can be confusing - but at other times it's actually very useful. It's now a widespread practice in both XQuery and XSLT 2.0, so I don't know how much it could be changed. >>> NB: While the names of the functions seem to suggest that the line >>> feed should rather be appended in my:join-records-into-lines than in >>> my:join-fields-into-record, I don't see any easy way to do this. >> >> Redefine your functions like this: >> >> declare function my:join-fields-into-record >> ( $fields as xs:string*, >> $delimiter as xs:string ) as xs:string { >> string-join($fields, $delimiter) >> } ; >> declare function my:join-records-into-lines >> ( $records as xs:string* ) as xs:string { >> string-join($records, " ") >> } ; > > Sorry for being so terse. I meant: It would be natural to change the > functions exactly this way, but this will drop the line feed of the last > line in the output, which would be undesirable. So I prefer to keep the > functions unchanged, irrespectively of their slightly misleading names > (or rather use text nodes than functions to get whitespace right). It would seem to be a bug if it drops the last line feed in the output. John -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From andrew.j.welch at gmail.com Mon Oct 20 12:28:24 2008 From: andrew.j.welch at gmail.com (Andrew Welch) Date: Mon Oct 20 03:26:41 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48FC5307.7000402@srz.de> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> <48FC5307.7000402@srz.de> Message-ID: <74a894af0810200328r59f12635s41c89b9182be3838@mail.gmail.com> > Trying to understand why it is working (it does, tested it with Saxon): > Appending the line feed as a text node seems to influence on the > interpretation of the other items returned that are now seen as text nodes, > too, (and thus serialized as immediately adjacent strings) rather than as > strings that need to be separated with spaces. Adjacent text nodes are merged into a single text node... so a sequence of text nodes becomes a single text node, requiring no separators. For example: "//text()" will ultimately return a single text node "for $x in //text() return xs:string($x)" will return sequence of strings separated by a space (provided count($x) > 1) -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/ From Y.Forkl at srz.de Mon Oct 20 13:34:24 2008 From: Y.Forkl at srz.de (Yves Forkl) Date: Mon Oct 20 03:32:57 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48FC5974.7010207@oracle.com> References: <48F88F35.80706@srz.de> <8E936D55898F473EB1555EEDBDF5F929@Sealion> <48F8AD0A.6090502@srz.de> <48F8BC04.7010606@oracle.com> <48FC56C8.2020100@srz.de> <48FC5974.7010207@oracle.com> Message-ID: <48FC5EB0.5080407@srz.de> John Snelson wrote: > Well, DataDirect's method seems to require you to construct a custom XML > structure, and specify a implementation specific serialization method. > Your current method requires that you create some strings, and join them > with string-join(). I'm not sure there's a lot of difference between the > two. You are right that both approaches don't have what I was looking for: A pre-cooked solution for writing CSV rows and cells. But that's OK, now I have what I need and at the same time I have learned some useful things. > I agree that using a space as a separator between atomic items when > outputting them can be confusing - but at other times it's actually very > useful. It's now a widespread practice in both XQuery and XSLT 2.0, so I > don't know how much it could be changed. That's completely true. I'm familiar (and happy) with the space insertion rules of XSLT 2.0 (if I may use this non-technical term here), but still have to wrap my head around the way XQuery serializes the results of multiple iterations. > It would seem to be a bug if it drops the last line feed in the output. Unfortunately not: Of course, string-join's separator character (here: line feed) is by definition not to be appended after the last item. That's why changing the functions doesn't work out. Yves From mike at saxonica.com Mon Oct 20 12:35:51 2008 From: mike at saxonica.com (Michael Kay) Date: Mon Oct 20 03:34:12 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48FC5307.7000402@srz.de> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> <48FC5307.7000402@srz.de> Message-ID: > > A trick is to use text nodes, because that suppresses the > extra spaces: > > This provides for a really neat solution, thank you very much > for this suggestion. > > Trying to understand why it is working (it does, tested it > with Saxon): It's basically a side-effect of the rules for constructing element content. If you do this: {for $i in 1 to 10 return $i*$i} you get 1 4 9 16 25 36 49 64 81 100 But if you do this: let $input :=

A large flock of geese flew overhead

return {$input//text()} you get A large flock of geese flew overhead To achieve this, the rule is that a space is inserted between two atomic values, but it is not inserted between two text nodes, or between an atomic value and a text node. Per's solution exploits this by creating a text node as a way to disable the insertion of spaces. (I considered the same solution myself, but thought it too obscure.) The rules might seem strange, but the idea is that they give the right answer most of the time without you having to think about it. You've hit on an example where that isn't the case, unfortunately. Michael Kay http://www.saxonica.com/ From john.snelson at oracle.com Mon Oct 20 12:41:57 2008 From: john.snelson at oracle.com (John Snelson) Date: Mon Oct 20 03:40:59 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48FC5EB0.5080407@srz.de> References: <48F88F35.80706@srz.de> <8E936D55898F473EB1555EEDBDF5F929@Sealion> <48F8AD0A.6090502@srz.de> <48F8BC04.7010606@oracle.com> <48FC56C8.2020100@srz.de> <48FC5974.7010207@oracle.com> <48FC5EB0.5080407@srz.de> Message-ID: <48FC6075.5080606@oracle.com> Yves Forkl wrote: > John Snelson wrote: >> It would seem to be a bug if it drops the last line feed in the output. > > Unfortunately not: Of course, string-join's separator character (here: > line feed) is by definition not to be appended after the last item. > That's why changing the functions doesn't work out. Ah, yes. I wasn't thinking about that :-). -- John Snelson, Oracle Corporation http://snelson.org.uk/john Berkeley DB XML: http://oracle.com/database/berkeley-db/xml XQilla: http://xqilla.sourceforge.net From ivanpedruzzi at gmail.com Mon Oct 20 12:31:12 2008 From: ivanpedruzzi at gmail.com (Ivan Pedruzzi) Date: Mon Oct 20 08:31:45 2008 Subject: [xquery-talk] Whitespace problem in CSV-like output In-Reply-To: <48FC58A7.7060507@srz.de> References: <48F88F35.80706@srz.de> <48F8589D.7030105@bothner.com> <6ce57d220810171236x487829ack5fc2f69cc817849a@mail.gmail.com> <48FC58A7.7060507@srz.de> Message-ID: <6ce57d220810200831k6bb0170ft3f626c1de008789@mail.gmail.com> On Mon, Oct 20, 2008 at 6:08 AM, Yves Forkl wrote: > Ivan Pedruzzi wrote: > > DataDirect XQuery allows to pipe a CSV converter among others. >> In this particular example the input document has a perfect structure and >> can be directly piped. >> declare option ddtek:serialize "method=CSV:root=list:row=entry"; >> > > Thank you very much for this hint. > > However, I am not just copying row-type elements from the input file, but > rather summing up the values found in the "quantity" children of the > entries, after grouping them by the content of "property1" and "property2" > (see the first message in this thread). > > I wonder how I could perform this task using the above approach. > > We have blogged the solution here http://www.xml-connection.com/2008/10/generating-non-xml-files-from-xquery-is.html Hope this helps Ivan > Yves > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081020/e45bbff2/attachment.htm From kennorth at sbcglobal.net Wed Oct 22 03:27:31 2008 From: kennorth at sbcglobal.net (Ken North) Date: Wed Oct 22 02:28:14 2008 Subject: [xquery-talk] [ANN] DataServices World runs November 20 in San Jose Message-ID: <599462.34175.qm@web81303.mail.mud.yahoo.com> DataServices World Spring 2008 was successful so the conference has assembled a distinguished faculty for the Fall event in Silicon Valley. DataServices World offers a program for those interested in technology for data integration and data access, with emphasis on service-oriented architecture (SOA), web-oriented architecture (WOA) and cloud computing solutions. Presenting the program are experts and thought leaders from the University of California, IBM, Adobe Systems, Yahoo!, Reuters, Oracle, salesforce.com, DataDirect Technologies, Netrics and m2mi Corporation. When: November 20, 2008 Where: Fairmont Hotel in San Jose, California DataServices World explores enterprise and Internet computing technologies that enable us to operate with SQL, XML and disparate data sources. The conference program examines the data services layer, service data modeling, machine intelligence for adaptive service infrastructure, data in the cloud, LiveCycle Data Services, authorization/authentication and Universal Services for creating XML end-to-end applications. Besides technical presentations, the agenda includes a workshop and Power Panel. The panel will discuss "The Future of Database and Data Services in a Time of SOA and Cloud Computing". It follows the "Data Quality, Data Access and Data Services Workshop". DataServices World runs November 20 as one of four co-located conferences at the Fairmont Hotel in San Jose, California. Running from November 19-21 are SOAWorld, Cloud Computing Expo and Virtualization Conference. Conference Program: http://www.DataServicesWorld.com/events/DSWorld2008/Fallprogram.htm Registration: http://www.dataservicesworld.sys-con.com Ken North ------------------- www.KNComputing.com From oliver at xqsharp.com Thu Oct 23 18:11:36 2008 From: oliver at xqsharp.com (Oliver Hallam) Date: Thu Oct 23 09:14:13 2008 Subject: [xquery-talk] How do different XQuery products implement modules? Message-ID: <4900A238.6090602@xqsharp.com> This is the behaviour of XQSharp: > 1. Is the module URI just an arbitrary character string, or does it > have any > semantics? The value of the module URI is used only as a namespace. > 1a. In particular, is it the location of a resource on the web? If it is, that is irrelevant. Could be used for library documentation. > 2. Do you allow several different modules in the same query to have > the same > module URI? Yes. > 2a. if so, can different "import module" declarations import different > subsets of these? Each "import module" statement can import a subset of the modules in a library allowing access to those functions imported. Checking for XQST0034 and XQST0036 is performed for each query and only takes into account the modules imported. > 3. Can users import a module without specifying a location URI? If so, > how > is the module located? The static context allows for a set of location hints to be provided for any given module namespace. These hints are used alongside any given in the query, so if no hints are given, then the hints given in the static context are used. > 4. If import module specifies a location URI, is it used, and if so how? The URI is resolved, and the source of the module is retrived from that location. > 5. If import module specifies more than one location URI, how are they > used? Each location hint specifies the location of a module and all the modules are imported as in the answer to question 4. > 5b. If multiple location URIs are allowed, what happens if > import module specifies the same location URI more than once? The location hints are treated as a set - that is, any repeated URIs are ignored > 6. What happens when two modules A and B both import module URI M > > 6a. specifying the same location URI The module is resolved once, and its functions and global variables are added to the set available to A and B. > 6b. specifying different location URIs Each location URI is loaded as a separate module, and A and B can only use the subset of the module they imported. Conflict resolution is only performed on a per-module basis, so it is possible for A and B to refer to different functions in M with the same name. This allows for modules to be built against different versions of the same library (which may or may not be a good thing). > 6c. without specifying a location URI Since the location hints in the static context are added to all library imports, the sections of the library defined by these modules are accessible to every module that imports that namespace > 7. Is it possible (by means of multiple imports) to create two different > "instances" of the same module in a query, with distinct values of global > variables, or do all imports get the same instance with a common set of > variables? All global variables and functions are global to the query. Global variables are uniquely identified by their name and the location hint of the module that defined them. If we were to perform the XPST0034 checking on a per library basis, then a global variable would be uniquely identified by its name. Oliver Hallam XQSharp.com From roger.holmes76 at yahoo.co.uk Sat Oct 25 16:02:25 2008 From: roger.holmes76 at yahoo.co.uk (Roger Holmes) Date: Sat Oct 25 08:09:30 2008 Subject: [xquery-talk] Saxon-SA versus Xalan Message-ID: <570375.69708.qm@web28416.mail.ukl.yahoo.com> Hi, I am in the early stages of working with Saxon-B but was wondering as to the added benefits of Saxon-SA's transformation with schema validation versus Xalan?with Xerces.? My understanding is that Xalan provides support for Xerces to do XML transformation and schema validation. My understanding also is that Saxon ultimately expands an Xquery string does its conversion and at some stage hold its resultSet as XML nodes. Can these XML nodes prior to output?by Saxon-B be transformed and validated via Xalan and Xerces ? I? think?I've answered my own question in a way, is?the flaw in my logic that validation with Xalan will only happen after a successful / unsuccessful output of XML nodes whereas Saxon does it on the route to generating XML ? OR is the difference that the Saxon implementation simply offers far better performance to make Xalan a consideration ? Thanks, Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081025/0f290e56/attachment.htm From mike at saxonica.com Sat Oct 25 18:10:39 2008 From: mike at saxonica.com (Michael Kay) Date: Sat Oct 25 09:11:10 2008 Subject: [xquery-talk] Saxon-SA versus Xalan In-Reply-To: <570375.69708.qm@web28416.mail.ukl.yahoo.com> References: <570375.69708.qm@web28416.mail.ukl.yahoo.com> Message-ID: Are you talking XQuery or XSLT? Because Xalan is an XSLT processor, and this is an XQuery list. (Saxon does both XSLT and XQuery). You can of course run schema validation prior to transformation using a schema processor that is entirely separate from the XSLT or XQuery engine. (You can can then choose any schema validator, including Saxon-SA or Xerces, and any transformation engine, including Saxon-B or Xalan). But this isn't the same as running a schema-aware transformation or query. When you run a schema-aware transformation or query, as well as ensuring that the input document is valid against the schema, you also get additional benefits: * compile-time checking of the query or transformation code against the schema * optimization of the query or transformation to take advantage of schema knowledge * polymorphic operations based on schema-defined types, for example sorting dates as dates and numbers as numbers. Michael Kay http://www.saxonica.com/ _____ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Roger Holmes Sent: 25 October 2008 16:02 To: talk@x-query.com Subject: [xquery-talk] Saxon-SA versus Xalan Hi, I am in the early stages of working with Saxon-B but was wondering as to the added benefits of Saxon-SA's transformation with schema validation versus Xalan with Xerces. My understanding is that Xalan provides support for Xerces to do XML transformation and schema validation. My understanding also is that Saxon ultimately expands an Xquery string does its conversion and at some stage hold its resultSet as XML nodes. Can these XML nodes prior to output by Saxon-B be transformed and validated via Xalan and Xerces ? I think I've answered my own question in a way, is the flaw in my logic that validation with Xalan will only happen after a successful / unsuccessful output of XML nodes whereas Saxon does it on the route to generating XML ? OR is the difference that the Saxon implementation simply offers far better performance to make Xalan a consideration ? Thanks, Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081025/f39d48bc/attachment.htm From conor at us.ibm.com Sat Oct 25 17:02:46 2008 From: conor at us.ibm.com (Conor O'Mahony) Date: Sat Oct 25 13:03:08 2008 Subject: [xquery-talk] Information on Demand Conference Message-ID: I will be out of the office starting 10/24/2008 and will not return until 11/03/2008. I am at the IBM Information on Demand conference. For urgent matters, please call my mobile phone (617-792-8507). Thanks! -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081025/ed6d5c68/attachment.htm From roger.holmes76 at yahoo.co.uk Sun Oct 26 17:29:25 2008 From: roger.holmes76 at yahoo.co.uk (Roger Holmes) Date: Sun Oct 26 09:30:27 2008 Subject: [xquery-talk] Saxon-SA versus Xalan Message-ID: <551984.21188.qm@web28412.mail.ukl.yahoo.com> Thanks, that clear up my confusion. ________________________________ From: Michael Kay To: Roger Holmes ; talk@x-query.com Sent: Saturday, 25 October, 2008 17:10:39 Subject: RE: [xquery-talk] Saxon-SA versus Xalan Are you talking XQuery or XSLT? Because Xalan is an XSLT processor, and this is an XQuery list. (Saxon does both XSLT and XQuery). ? You can of course run schema validation prior to transformation using a schema processor that is entirely separate from the XSLT or XQuery engine. (You can can then choose any schema validator, including Saxon-SA or Xerces, and any transformation engine, including Saxon-B or Xalan). But this isn't the same as running a schema-aware transformation or query. When you run a schema-aware transformation or query, as well as ensuring that the input document is valid against the schema, you also get additional benefits: ? * compile-time checking of the query or transformation code against the schema ? * optimization of the query or transformation to take advantage of schema knowledge ? * polymorphic operations based on schema-defined types, for example sorting dates as dates and numbers as numbers. ? Michael Kay http://www.saxonica.com/ ? ? ________________________________ From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of Roger Holmes Sent: 25 October 2008 16:02 To: talk@x-query.com Subject: [xquery-talk] Saxon-SA versus Xalan Hi, I am in the early stages of working with Saxon-B but was wondering as to the added benefits of Saxon-SA's transformation with schema validation versus Xalan?with Xerces.? My understanding is that Xalan provides support for Xerces to do XML transformation and schema validation. My understanding also is that Saxon ultimately expands an Xquery string does its conversion and at some stage hold its resultSet as XML nodes. Can these XML nodes prior to output?by Saxon-B be transformed and validated via Xalan and Xerces ? I? think?I've answered my own question in a way, is?the flaw in my logic that validation with Xalan will only happen after a successful / unsuccessful output of XML nodes whereas Saxon does it on the route to generating XML ? OR is the difference that the Saxon implementation simply offers far better performance to make Xalan a consideration ? Thanks, Roger -------------- next part -------------- An HTML attachment was scrubbed... URL: http://x-query.com/pipermail/talk/attachments/20081026/d3d2f8dc/attachment.htm From nick at xqsharp.com Wed Oct 29 15:52:56 2008 From: nick at xqsharp.com (Nick Jones) Date: Wed Oct 29 07:52:56 2008 Subject: [xquery-talk] XQSharp 0.9 Technical Preview released Message-ID: <490886D8.5070200@xqsharp.com> We are pleased to announce the first public release of XQSharp at http://www.xqsharp.com/ XQSharp is a fast, schema-aware, standards-compliant XQuery processor built for the Microsoft .NET Framework. The free XQSharp 0.9 technical preview includes XQuery.exe, a command line XQuery 1.0 processor, together with full documentation and code samples. Regards, The XQSharp team From kennorth at sbcglobal.net Fri Oct 31 12:17:42 2008 From: kennorth at sbcglobal.net (Ken North) Date: Fri Oct 31 11:18:47 2008 Subject: [xquery-talk] XML, Security, Semantics and Enterprise 2.0 (Dr. Amjad Umar's predictions) Message-ID: <001801c93b8d$5c395ae0$2301a8c0@DURANTE> "XML, Security, Semantics and Enterprise 2.0" http://www.ibmdatabasemag.com/story/showArticle.jhtml?articleID=211600831 Dr. Amjad Umar speaks about XML, XQuery and next-generation enterprise software. His prediction about XQuery will be of interest to readers of this list. ======== Ken North =========== www.KNComputing.com www.DataServicesWorld.com www.CloudComputingSummit.com www.LinkedDataSummit.com www.WebServicesSummit.com www.SQLSummit.com www.GridSummit.com