From philip.vallone at verizon.net Tue Nov 4 06:08:37 2008
From: philip.vallone at verizon.net (philip.vallone@verizon.net)
Date: Tue Nov 4 04:08:39 2008
Subject: [xquery-talk] Nested FLOWRs
Message-ID: <8550552.956731225800517443.JavaMail.root@vms075.mailsrvcs.net>
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081104/9602e17a/attachment.htm
From mrys at microsoft.com Tue Nov 4 13:39:50 2008
From: mrys at microsoft.com (Michael Rys)
Date: Tue Nov 4 13:37:52 2008
Subject: [xquery-talk] Nested FLOWRs
In-Reply-To: <8550552.956731225800517443.JavaMail.root@vms075.mailsrvcs.net>
References: <8550552.956731225800517443.JavaMail.root@vms075.mailsrvcs.net>
Message-ID: <390310B3D9102C47B28642DB3CB9BE73215E546610@NA-EXMSG-C115.redmond.corp.microsoft.com>
Hi Philip? it is not clear to me why you need the parent axis to do your query or what exactly your required output is (sometimes you copy the value and sometimes you copy the full element).
Note that SQL Server support the parent axis, but not the optional axis feature. So you can write:
SELECT @x.query('declare namespace foo="http://www.foo/schema"; (
{for $x in /foo:root/foo:data2 return
{$x/foo:part_number}
{$x/foo:cage}
{data(($x/../foo:data1[foo:part_number = $x/foo:part_number]/foo:smr)[1])}
}
)')
However, the parent axis is not as efficient as forward navigation, so rewriting this into a forward only expression should be faster:
SELECT @x.query('declare namespace foo="http://www.foo/schema"; (
{for $y in /foo:root, $x in $y/foo:data2 return
{$x/foo:part_number}
{$x/foo:cage}
{data(($y/foo:data1[foo:part_number = $x/foo:part_number]/foo:smr)[1])}
}
)')
Finally, note that the XQuery construction is not that well performing for large amounts of data as if you were using FOR XML. Contact me if you need help with that, since that is not XQuery specific.
Best regards
Michael
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf Of philip.vallone@verizon.net
Sent: Tuesday, November 04, 2008 4:09 AM
To: talk@x-query.com
Subject: [xquery-talk] Nested FLOWRs
Hi,
I am using xquery in a sql 2005 database. Many of the xquery functions and axis are not supported so I am trying to do some work-arounds. In the below example, I have a nested FLOWR $Y which searches the xml file for matches to the current context node "for $y in /foo:root/foo:data1[foo:part_number = $x/foo:part_number][1]"
This works, but is not efficient with large xml content. Sql server doesn't support xpath axises e.g. (parent::foo:root) unless it is used as a predicate, so I a limited on how to navigate up and down the document. Is there a better way?
DECLARE @x xml
SET @x='
1ASD4
smrcode
09998
12234
04568
1ASD4
ASBB7
ZZZSSD4
'
SELECT @x.query('declare namespace foo="http://www.foo/schema"; (
{for $x in /foo:root/foo:data2 return
{$x/foo:part_number}
{$x/foo:cage}
{for $y in /foo:root/foo:data1[foo:part_number = $x/foo:part_number][1]
return
data($y/foo:smr)}
}
)')
Thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081104/7adfb3ce/attachment.htm
From philip.vallone at verizon.net Tue Nov 4 18:07:48 2008
From: philip.vallone at verizon.net (Philip Vallone)
Date: Tue Nov 4 15:07:39 2008
Subject: [xquery-talk] Nested FLOWRs
In-Reply-To: <390310B3D9102C47B28642DB3CB9BE73215E546610@NA-EXMSG-C115.redmond.corp.microsoft.com>
References: <8550552.956731225800517443.JavaMail.root@vms075.mailsrvcs.net>
<390310B3D9102C47B28642DB3CB9BE73215E546610@NA-EXMSG-C115.redmond.corp.microsoft.com>
Message-ID: <002b01c93ed2$283cb050$0401a8c0@MAINCOMPUTER>
Thanks!
________________________________
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of Michael Rys
Sent: Tuesday, November 04, 2008 4:40 PM
To: philip.vallone@verizon.net; talk@x-query.com
Subject: RE: [xquery-talk] Nested FLOWRs
Hi Philip. it is not clear to me why you need the parent axis to do your
query or what exactly your required output is (sometimes you copy the value
and sometimes you copy the full element).
Note that SQL Server support the parent axis, but not the optional axis
feature. So you can write:
SELECT @x.query('declare namespace foo="http://www.foo/schema"; (
{for $x in /foo:root/foo:data2 return
{$x/foo:part_number}
{$x/foo:cage}
{data(($x/../foo:data1[foo:part_number =
$x/foo:part_number]/foo:smr)[1])}
}
)')
However, the parent axis is not as efficient as forward navigation, so
rewriting this into a forward only expression should be faster:
SELECT @x.query('declare namespace foo="http://www.foo/schema"; (
{for $y in /foo:root, $x in $y/foo:data2 return
{$x/foo:part_number}
{$x/foo:cage}
{data(($y/foo:data1[foo:part_number =
$x/foo:part_number]/foo:smr)[1])}
}
)')
Finally, note that the XQuery construction is not that well performing for
large amounts of data as if you were using FOR XML. Contact me if you need
help with that, since that is not XQuery specific.
Best regards
Michael
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of philip.vallone@verizon.net
Sent: Tuesday, November 04, 2008 4:09 AM
To: talk@x-query.com
Subject: [xquery-talk] Nested FLOWRs
Hi,
I am using xquery in a sql 2005 database. Many of the xquery functions and
axis are not supported so I am trying to do some work-arounds. In the below
example, I have a nested FLOWR $Y which searches the xml file for matches to
the current context node "for $y in /foo:root/foo:data1[foo:part_number =
$x/foo:part_number][1]"
This works, but is not efficient with large xml content. Sql server doesn't
support xpath axises e.g. (parent::foo:root) unless it is used as a
predicate, so I a limited on how to navigate up and down the document. Is
there a better way?
DECLARE @x xml
SET @x='
1ASD4
smrcode
09998
12234
04568
1ASD4
ASBB7
ZZZSSD4
'
SELECT @x.query('declare namespace foo="http://www.foo/schema"; (
{for $x in /foo:root/foo:data2 return
{$x/foo:part_number}
{$x/foo:cage}
{for $y in /foo:root/foo:data1[foo:part_number =
$x/foo:part_number][1]
return
data($y/foo:smr)}
}
)')
Thanks,
From philip.vallone at verizon.net Thu Nov 6 12:45:09 2008
From: philip.vallone at verizon.net (philip.vallone@verizon.net)
Date: Thu Nov 6 13:19:44 2008
Subject: [xquery-talk] Xquery XHTML document
Message-ID: <1918465960.2115041225997109998.JavaMail.root@vms246.mailsrvcs.net>
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081106/dbb90244/attachment.htm
From milu71 at gmx.de Thu Nov 6 22:34:32 2008
From: milu71 at gmx.de (Michael Ludwig)
Date: Thu Nov 6 13:34:47 2008
Subject: [xquery-talk] Xquery XHTML document
In-Reply-To: <1918465960.2115041225997109998.JavaMail.root@vms246.mailsrvcs.net>
References: <1918465960.2115041225997109998.JavaMail.root@vms246.mailsrvcs.net>
Message-ID: <20081106213432.GB3656@wladimir>
philip.vallone@verizon.net schrieb am 06.11.2008 um 12:45:09 (-0600):
>
> [...] how would I declare the namespace for elements that do not
> have a prefix? Normally I would use something like this:
> declare namespace foo=http://www.foo.com/foo?
> But XHTML does not have a prefix.
You seem to be confusing (a) namespaces and prefixes, and (b) their
occurrences in input data and XQuery expressions.
But I think you're just looking for:
declare default element namespace "http://example.org/names";
See: http://www.w3.org/TR/xquery/#id-default-namespace
Michael Ludwig
From philip.vallone at verizon.net Fri Nov 7 07:10:10 2008
From: philip.vallone at verizon.net (Philip Vallone)
Date: Fri Nov 7 04:10:25 2008
Subject: [xquery-talk] Xquery XHTML document
In-Reply-To: <20081106213432.GB3656@wladimir>
References: <1918465960.2115041225997109998.JavaMail.root@vms246.mailsrvcs.net>
<20081106213432.GB3656@wladimir>
Message-ID: <001101c940d1$c8cf4860$0401a8c0@MAINCOMPUTER>
Hi Michael,
Thank you for your help. I don?t think I was confusing (a) or (b) but rather
trying to learn how to declare an unprefixed element which has a namespace.
Thanks for the link. I believe this is what I was looking for.
Regards,
Phil
-----Original Message-----
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of Michael Ludwig
Sent: Thursday, November 06, 2008 4:35 PM
To: talk@x-query.com
Subject: Re: [xquery-talk] Xquery XHTML document
philip.vallone@verizon.net schrieb am 06.11.2008 um 12:45:09 (-0600):
>
> [...] how would I declare the namespace for elements that do not
> have a prefix? Normally I would use something like this:
> declare namespace foo=http://www.foo.com/foo?
> But XHTML does not have a prefix.
You seem to be confusing (a) namespaces and prefixes, and (b) their
occurrences in input data and XQuery expressions.
But I think you're just looking for:
declare default element namespace "http://example.org/names";
See: http://www.w3.org/TR/xquery/#id-default-namespace
Michael Ludwig
_______________________________________________
talk@x-query.com
http://x-query.com/mailman/listinfo/talk
From mlu at as-guides.com Fri Nov 7 14:36:11 2008
From: mlu at as-guides.com (Michael Ludwig)
Date: Fri Nov 7 05:36:37 2008
Subject: [xquery-talk] Xquery XHTML document
In-Reply-To: <001101c940d1$c8cf4860$0401a8c0@MAINCOMPUTER>
References: <1918465960.2115041225997109998.JavaMail.root@vms246.mailsrvcs.net> <20081106213432.GB3656@wladimir>
<001101c940d1$c8cf4860$0401a8c0@MAINCOMPUTER>
Message-ID: <4914444B.7080102@as-guides.com>
Philip Vallone schrieb:
> Hi Michael,
>
> Thank you for your help. I dont think I was confusing (a) or (b) but
> rather trying to learn how to declare an unprefixed element which has
> a namespace.
Yes, this sounds like you weren't confusing anything. Sorry :-)
> Thanks for the link. I believe this is what I was looking for.
Good!
Michael Ludwig
From wcandillon at gmail.com Tue Nov 11 15:03:21 2008
From: wcandillon at gmail.com (William Candillon)
Date: Tue Nov 11 06:04:15 2008
Subject: [xquery-talk] Debugging XQuery in a 100% open source environment.
Message-ID: <43b5c44e0811110603t247f445s6e619aa1ce53817d@mail.gmail.com>
Hello folks,
Indeed, the lastest release of Zorba includes an open source XQuery
remote debugger.
You can use it through three medias:
- The lastest release of the XQuery Development Tooltik eclipse
plugin which ships Zorba and provides XQuery debugging support
(http://www.xqdt.org/).
- Zorba command line utility provides a command-line debugger
client with a user experience similar to gdb command-line debugger
(http://www.zorba-xquery.com/doc/zorba-0.9.4/zorba/html/debugger.html).
- Zorba provides a set of high-level C++ API that allows developers
to embed and build front-end XQuery debuggers
(http://www.zorba-xquery.com/doc/zorba-0.9.4/cxx/html/classzorba_1_1ZorbaDebuggerClient.html).
Best regards,
William
--
William Candillon
http://apdt.googlecode.com
From per at bothner.com Sun Nov 23 10:45:34 2008
From: per at bothner.com (Per Bothner)
Date: Sun Nov 23 10:45:38 2008
Subject: [xquery-talk] XQuery static typing algorithms?
Message-ID: <4929A4CE.4060705@bothner.com>
Is there somewhere a reasonably accessible description of the
tree algorithms needed for XQuery static typing? I.e. reasonably
readable code (assuming I can study it without legal IP concerns)
or an article? The Formal Semantics references the 262-page TATA book,
which is more than I'm willing to deal with.
(Not that I have any immediate plans to implement more than
ad hoc static typing for XQuery, but at least it would be nice
to have a road-map, so anything I do is compatible with a real
solution. Though if the algorithms aren't too complicated, maybe
I'll be inspired ...)
--
--Per Bothner
per@bothner.com http://per.bothner.com/
From christian.gruen at gmail.com Sun Nov 23 22:14:05 2008
From: christian.gruen at gmail.com (=?ISO-8859-1?Q?Christian_Gr=FCn?=)
Date: Sun Nov 23 13:14:18 2008
Subject: [xquery-talk] [Announce] BaseX 5.0
Message-ID:
Dear all,
we are glad to announce the new version of BaseX, our XML database and
XQuery processor. It offers a bunch of new and improved features:
- Support of XQuery/XPath Full-Text 1.0, based on the W3C Candidate
Recommendation - presumably the most complete implementation which is
currently available.
- XQuery Conformance: reaching 99.9% of the W3C XQuery Test Suite.
- Implementation of XQuery API for Java (XQJ) and XML:DB API (XAPI).
- New Scatterplot View, advanced Table View.
- Improved XQuery Editor with syntax highlighting and error feedback.
- GUI Auto-Completion features for command, XPath and XQuery input.
- Internationalization. Currently supported: English, Japanese, German.
BaseX is open source. It is developed by the DBIS Group/U Konstanz.
Please find more information at: http://basex.org/
Best regards,
-- Christian Gruen, BaseX Team
From deBakker_Bas at emc.com Mon Nov 24 09:44:38 2008
From: deBakker_Bas at emc.com (Bas de Bakker)
Date: Mon Nov 24 00:45:05 2008
Subject: [xquery-talk] XQuery static typing algorithms?
In-Reply-To: <4929A4CE.4060705@bothner.com>
References: <4929A4CE.4060705@bothner.com>
Message-ID: <1227516278.30342.469.camel@tidore.Xhive.Archipel>
Maybe you can find something useful here:
http://www-db.informatik.uni-tuebingen.de/research/pathfinder/publications
In particular the article "Subtyping For Regular Tree Types : a
JAVA-based Implementation".
Regards,
Bas de Bakker
-----Original Message-----
From: Per Bothner
To: talk@x-query.com
Subject: [xquery-talk] XQuery static typing algorithms?
Date: Sun, 23 Nov 2008 10:45:34 -0800
Is there somewhere a reasonably accessible description of the
tree algorithms needed for XQuery static typing? I.e. reasonably
readable code (assuming I can study it without legal IP concerns)
or an article? The Formal Semantics references the 262-page TATA book,
which is more than I'm willing to deal with.
(Not that I have any immediate plans to implement more than
ad hoc static typing for XQuery, but at least it would be nice
to have a road-map, so anything I do is compatible with a real
solution. Though if the algorithms aren't too complicated, maybe
I'll be inspired ...)
From jens.teubner at inf.ethz.ch Mon Nov 24 13:17:12 2008
From: jens.teubner at inf.ethz.ch (Jens Teubner)
Date: Mon Nov 24 04:17:18 2008
Subject: [xquery-talk] XQuery static typing algorithms?
In-Reply-To: <1227516278.30342.469.camel@tidore.Xhive.Archipel>
References: <4929A4CE.4060705@bothner.com>
<1227516278.30342.469.camel@tidore.Xhive.Archipel>
Message-ID: <20081124121712.GA226@ikdesk25.inf.ethz.ch>
On Mon, Nov 24, 2008 at 09:44:38AM +0100, Bas de Bakker wrote:
> Maybe you can find something useful here:
>
> http://www-db.informatik.uni-tuebingen.de/research/pathfinder/publications
>
> In particular the article "Subtyping For Regular Tree Types : a
> JAVA-based Implementation".
The algorithm in that Master's thesis is essentially based on the
dissertation of Martin Kempa at the University of L?beck, Germany. The
dissertation itself is in German ("Programmierung von XML-basierten
Anwendungen unter Ber?cksichtigung der Sprachbeschreibung"), but you
find some English papers authored by Martin at
http://www.ifis.uni-luebeck.de/~ifis/public/ .
The Pathfinder XQuery compiler uses a similar algorithm internally. It
is very fast and powerful.
However, this is an algorithm for structural subtyping. In many
details, the behavior of this algorithm is different to what the XQuery
specs describe (and it is not always trivial to fix that). Not sure
whether the algorithms in the TATA book have the same problems. My
personal impression is that, if you want to be standards-compliant, the
best way to start is to literally implement all the judgments in the W3C
Formal Semantics.
Static typing is closely related to (a) XML validation and (b) type
matching (i.e., "dynamic typing"). There are two papers on the
Pathfinder publications page (XIME-P and EDBT, respectively), that talk
about these two aspects. Both of them seem to be better aligned with
the official W3C specs than the mentioned subtyping algorithm does.
Best regards,
Jens
--
Jens Teubner
ETH Zurich, Systems Group
Haldeneggsteig 4 / IFW B 48.3
8092 Zurich, Switzerland
Science is what we understand well enough to explain
to a computer. Art is everything else we do.
-- Donald Knuth
From per at bothner.com Mon Nov 24 07:29:49 2008
From: per at bothner.com (Per Bothner)
Date: Mon Nov 24 07:29:48 2008
Subject: [xquery-talk] XQuery static typing algorithms?
In-Reply-To: <20081124121712.GA226@ikdesk25.inf.ethz.ch>
References: <4929A4CE.4060705@bothner.com> <1227516278.30342.469.camel@tidore.Xhive.Archipel>
<20081124121712.GA226@ikdesk25.inf.ethz.ch>
Message-ID: <492AC86D.1040008@bothner.com>
Thanks to both Jens Teubner and Bas de Bakker for your suggestions!
Jens Teubner wrote:
> My personal impression is that, if you want to be standards-compliant, the
> best way to start is to literally implement all the judgments in the W3C
> Formal Semantics.
In general that is good advice, but when it comes to subtyping, then
the Formal Semantics doesn't provide judgements that are implementable,
as far as I can tell:
8.3.2 Subtyping (<:)
...
Note
The above definition, although complete and precise, does not give a
simple means to compute subtyping. Notably the definition above refers
to values, which are not available at static type checking time.
The structural component of the [XPath/XQuery] type system can be
modeled by regular expressions. Regular expressions can be implemented
by means of finite state automata. Computing subtyping between two types
can then be done by computing if inclusion holds between their
corresponding finite state automata.
Finite state automata and how to compute operations on those automata,
such as inclusion, emptiness or intersection, have been extensively
studied and documented in the literature. The interested reader can
consult the relevant literature on tree grammars, for instance
[Languages], or [TATA].
--
--Per Bothner
per@bothner.com http://per.bothner.com/
From mike at saxonica.com Mon Nov 24 17:01:23 2008
From: mike at saxonica.com (Michael Kay)
Date: Mon Nov 24 09:01:32 2008
Subject: [xquery-talk] XQuery static typing algorithms?
In-Reply-To: <492AC86D.1040008@bothner.com>
References: <4929A4CE.4060705@bothner.com> <1227516278.30342.469.camel@tidore.Xhive.Archipel><20081124121712.GA226@ikdesk25.inf.ethz.ch>
<492AC86D.1040008@bothner.com>
Message-ID: <56B6F3817D054DC5A590BE47281AE428@Sealion>
There's a useful paper by Henry Thompson:
http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html
This algorithm is implemented very directly in the Saxon schema processor.
The hardest part is where he refers to Aho & Ullmann for determinizing the
FSA; the A&U algorithm requires very careful reading.
He also published a refinement to handle content models with numeric limits
other than 1 and infinity more efficiently:
http://xtech06.usefulinc.com/schedule/paper/118
I found that one tough to implement directly because he hand-waves about the
rules for determinizing the FSA, which seems to be the tough part. I ended
up doing my own thing with counters - which is highly dangerous in this
space, there is a tendency to find a fundamental flaw in your algorithm
after 3 years exposure in the field.
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: talk-bounces@x-query.com
> [mailto:talk-bounces@x-query.com] On Behalf Of Per Bothner
> Sent: 24 November 2008 15:30
> To: talk@x-query.com
> Subject: Re: [xquery-talk] XQuery static typing algorithms?
>
> Thanks to both Jens Teubner and Bas de Bakker for your suggestions!
>
> Jens Teubner wrote:
> > My personal impression is that, if you want to be
> standards-compliant,
> > the best way to start is to literally implement all the
> judgments in
> > the W3C Formal Semantics.
>
> In general that is good advice, but when it comes to
> subtyping, then the Formal Semantics doesn't provide
> judgements that are implementable, as far as I can tell:
>
> 8.3.2 Subtyping (<:)
>
> ...
>
> Note
>
> The above definition, although complete and precise, does not
> give a simple means to compute subtyping. Notably the
> definition above refers to values, which are not available at
> static type checking time.
>
> The structural component of the [XPath/XQuery] type system
> can be modeled by regular expressions. Regular expressions
> can be implemented by means of finite state automata.
> Computing subtyping between two types can then be done by
> computing if inclusion holds between their corresponding
> finite state automata.
>
> Finite state automata and how to compute operations on those
> automata, such as inclusion, emptiness or intersection, have
> been extensively studied and documented in the literature.
> The interested reader can consult the relevant literature on
> tree grammars, for instance [Languages], or [TATA].
> --
> --Per Bothner
> per@bothner.com http://per.bothner.com/
> _______________________________________________
> talk@x-query.com
> http://x-query.com/mailman/listinfo/talk
From rameshk at prodigygroupindia.com Tue Nov 25 15:44:16 2008
From: rameshk at prodigygroupindia.com (Ramesh K)
Date: Tue Nov 25 02:10:06 2008
Subject: [xquery-talk] transaction managment
Message-ID: <200811251009.mAPA9sPB001934@jhunter.x-query.com>
Hi,
How do I implement transaction management on xml using with xquery.
Can any one please give me suggestion.
Thanks & Regards
Ramesh K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081125/263bae89/attachment.htm
From mike at saxonica.com Tue Nov 25 10:28:54 2008
From: mike at saxonica.com (Michael Kay)
Date: Tue Nov 25 02:25:57 2008
Subject: [xquery-talk] transaction managment
In-Reply-To: <200811251009.mAPA9sPB001934@jhunter.x-query.com>
References: <200811251009.mAPA9sPB001934@jhunter.x-query.com>
Message-ID: <85BE694BFEAA48B5B4E0221C42F7A1EA@Sealion>
I think you'll find that's very dependent on the product/implementation you
are using. There are no transaction management facilities in the XQuery
language itself, but implementations that use an underlying database will
generally offer something.
Michael Kay
http://www.saxonica.com/
_____
From: talk-bounces@x-query.com [mailto:talk-bounces@x-query.com] On Behalf
Of Ramesh K
Sent: 25 November 2008 10:14
To: talk@x-query.com
Subject: [xquery-talk] transaction managment
Hi,
How do I implement transaction management on xml using with xquery.
Can any one please give me suggestion.
Thanks & Regards
Ramesh K
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://x-query.com/pipermail/talk/attachments/20081125/3a146e62/attachment.htm