From jidanni at jidanni.org Mon Apr 1 21:20:04 2013 From: jidanni at jidanni.org (jidanni at jidanni.org) Date: Tue, 02 Apr 2013 13:20:04 +0800 Subject: [xquery-talk] let's comment out a line in XQuery Message-ID: <87ppydy0e3.fsf@jidanni.org> I'm back, and it's proven!: there is no way for me to remember the xquery complex full comment syntax for more than one month. Solution. put comments into a separate file. OK. From lists at fgeorges.org Tue Apr 2 09:34:13 2013 From: lists at fgeorges.org (Florent Georges) Date: Tue, 2 Apr 2013 18:34:13 +0100 (BST) Subject: [xquery-talk] let's comment out a line in XQuery In-Reply-To: <87ppydy0e3.fsf@jidanni.org> References: <87ppydy0e3.fsf@jidanni.org> Message-ID: <1364924053.30264.YahooMailNeo@web28902.mail.ir2.yahoo.com> jidanni at jidanni.org wrote: > there is no way for me to remember the xquery complex full > comment syntax for more than one month. ? The "smiley syntax", complex?? Really? -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ From msokolov at safaribooksonline.com Tue Apr 2 10:23:24 2013 From: msokolov at safaribooksonline.com (Michael Sokolov) Date: Tue, 02 Apr 2013 14:23:24 -0400 Subject: [xquery-talk] let's comment out a line in XQuery In-Reply-To: <1364924053.30264.YahooMailNeo@web28902.mail.ir2.yahoo.com> References: <87ppydy0e3.fsf@jidanni.org> <1364924053.30264.YahooMailNeo@web28902.mail.ir2.yahoo.com> Message-ID: <515B221C.3050900@safaribooksonline.com> On 04/02/2013 01:34 PM, Florent Georges wrote: > jidanni at jidanni.org wrote: > > >> there is no way for me to remember the xquery complex full >> comment syntax for more than one month. >> > The "smiley syntax", complex? Really? > > IIRC he's all het up about {} not being syntactically valid, preventing {(: $expression :)}. -- Michael Sokolov Senior Architect Safari Books Online From dlee at calldei.com Tue Apr 2 10:27:12 2013 From: dlee at calldei.com (David Lee) Date: Tue, 2 Apr 2013 18:27:12 +0000 Subject: [xquery-talk] let's comment out a line in XQuery In-Reply-To: <515B221C.3050900@safaribooksonline.com> References: <87ppydy0e3.fsf@jidanni.org> <1364924053.30264.YahooMailNeo@web28902.mail.ir2.yahoo.com> <515B221C.3050900@safaribooksonline.com> Message-ID: <9ca1a240ca174c9e80ee05c6bf9dd796@BY2PR08MB014.namprd08.prod.outlook.com> XQuery comments are (: trivial :) Where exactly they work is complicated ... until you understand XQuery then its trivial. ---------------------------------------- David A. Lee dlee at calldei.com http://www.xmlsh.org -----Original Message----- From: talk-bounces at x-query.com [mailto:talk-bounces at x-query.com] On Behalf Of Michael Sokolov Sent: Tuesday, April 02, 2013 2:23 PM To: Florent Georges Cc: talk at x-query.com; jidanni at jidanni.org Subject: Re: [xquery-talk] let's comment out a line in XQuery On 04/02/2013 01:34 PM, Florent Georges wrote: > jidanni at jidanni.org wrote: > > >> there is no way for me to remember the xquery complex full >> comment syntax for more than one month. >> > The "smiley syntax", complex? Really? > > IIRC he's all het up about {} not being syntactically valid, preventing {(: $expression :)}. -- Michael Sokolov Senior Architect Safari Books Online _______________________________________________ talk at x-query.com http://x-query.com/mailman/listinfo/talk From jidanni at jidanni.org Tue Apr 2 10:28:19 2013 From: jidanni at jidanni.org (jidanni at jidanni.org) Date: Wed, 03 Apr 2013 02:28:19 +0800 Subject: [xquery-talk] let's comment out a line in XQuery References: <515B221C.3050900@safaribooksonline.com> Message-ID: <874nfookho.fsf@jidanni.org> MS> IIRC he's all het up about {} ... Yes something like that. Anyway there's no point in discussing it again. I just want to say "doctors have proven that the most one can remember is (: and :)." From lists at fgeorges.org Wed Apr 3 10:54:01 2013 From: lists at fgeorges.org (Florent Georges) Date: Wed, 3 Apr 2013 19:54:01 +0100 (BST) Subject: [xquery-talk] First draft of the Web Application spec Message-ID: <1365015241.73497.YahooMailNeo@web28905.mail.ir2.yahoo.com> ? Hi, ? I thought you might be interested in the following announce, as it is about a spec for writing XQuery main modules and libraries (among other technologies) to implement server-side response to HTTP requests. ? Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ ? Hi, ? I am very pleased to announce the first public draft of the "Web Application" spec from the W3C EXPath CG.? It is available at: ??? http://expath.org/spec/webapp ? The goal is to define a general purpose binding to HTTP, on the server side.? The spec defines how components are passed the HTTP request information, how they return the HTTP response to send back, and how requests are dispatched to which components. ? Components can be XSLT, XQuery and/or XProc components.? The can be used to serve resources (or web pages), to create filters, and to implement specific error handlers. ? Servlex is an open-source implementation of this specification. See the following links for more information on the EXPath initiative, on the W3C EXPath CG, and on Servlex: ??? http://expath.org/ ??? http://w3.org/community/expath/ ??? http://github.com/fgeorges/servlex ? Comments welcome! ? Regards, -- Florent Georges http://fgeorges.org/ http://h2oconsulting.be/ From jidanni at jidanni.org Thu Apr 4 04:04:41 2013 From: jidanni at jidanni.org (jidanni at jidanni.org) Date: Thu, 04 Apr 2013 20:04:41 +0800 Subject: [xquery-talk] XQuery Update vs. Perl Message-ID: <87eheqfqna.fsf@jidanni.org> Gentlemen, though I read http://docs.basex.org/wiki/XQuery_Update http://docs.oracle.com/cd/E17276_01/html/gsg_xml/cxx/modifydocument.html it seems nothing can beat #!/usr/bin/perl while(<>){ s!!$&1relativeToGround!; print; } for simply inserting nodes ___and getting the whole modified document back, and not just the modified Point nodes___. How can I do $ perl above_program.pl < input > output but instead e.g., with basex etc.? P.S., I also want to change all the 120.8663222,24.1810570 120.8666897,24.1811994 120.8661032,24.1812131 to 120.8663222,24.1810570,10 120.8666897,24.1811994,10 120.8661032,24.1812131,10 I bet it is 1000 times easier with perl. To see the source I want to modify, do $ wget http://jidanni.org/location/zaokeng.kmz $ unzip zaokeng.kmz From jidanni at jidanni.org Thu Apr 4 20:12:40 2013 From: jidanni at jidanni.org (jidanni at jidanni.org) Date: Fri, 05 Apr 2013 12:12:40 +0800 Subject: [xquery-talk] XQuery Update vs. Perl References: Message-ID: <87k3ohd39j.fsf@jidanni.org> OK, I figured out how to do most of it: copy $c := doc("zaokeng.kml") modify ( for $d in $c//*:Point return insert node ( 1, relativeToGround ) before $d/*:coordinates ) return $c As far as inserting things into the text of a node, well as you can see in http://www.mail-archive.com/basex-talk%40mailman.uni-konstanz.de/msg02434.html if I let basex's doc() get its hands on it my significant whitespace gets zapped anyway... From Martin.Honnen at gmx.de Fri Apr 12 10:25:01 2013 From: Martin.Honnen at gmx.de (Martin Honnen) Date: Fri, 12 Apr 2013 19:25:01 +0200 Subject: [xquery-talk] Need xquery function for "number of days between two dates" In-Reply-To: <1365786251.91929.YahooMailNeo@web141603.mail.bf1.yahoo.com> References: <1365786251.91929.YahooMailNeo@web141603.mail.bf1.yahoo.com> Message-ID: <5168436D.2050509@gmx.de> sudheshna iyer wrote: > I need a xquery function which takes two dates and return number of days > that lapsed between these two dates. Input to this function can be a 2 > strings of type "mm/dd/yyyy 00:00:00". > > Can any of you have a function handy to do this? Well there is an xs:dateTime data type supporting this: days-from-duration(current-dateTime() - xs:dateTime('2013-01-01T00:00:00')) You would first need to convert your date time format to the xs:dateTime format of yyyy-mm-ddThh:mm:ss respectively construct xs:dateTime values from your format. From John.Snelson at marklogic.com Wed Apr 24 05:57:55 2013 From: John.Snelson at marklogic.com (John Snelson) Date: Wed, 24 Apr 2013 12:57:55 +0000 Subject: [xquery-talk] Xquery and API documentation In-Reply-To: References: Message-ID: Try xquerydoc, which can extract XQDoc comments and style them in HTML and markdown. It's written in pure XQuery 1.0, with a small amount of XProc to drive the initial execution. https://github.com/xquery/xquerydoc John On 24 Apr 2013, at 13:40, Jakob Fix wrote: > Hi, > > I'm looking for ways to generate API documentation from our Xquery code. Of course, there is Xqdoc, but I'm looking to get something that is a) a bit better-looking and more importantly, b) usable by the developer who wants to try out the API. > > I've been looking at Swagger [1] which seems to do what I want. It expects a JSON file that would need to be generated from the Xquery code. I think I remember Adam Retter giving a talk on how to use 3.0 annotations for defining the API in Prague a couple of years ago. > > Are there already efforts underway to get something like this going? > > I would be most interested, > Jakob. > > [1] https://developers.helloreverb.com/swagger/ > > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk From adam.retter at googlemail.com Wed Apr 24 06:21:51 2013 From: adam.retter at googlemail.com (Adam Retter) Date: Wed, 24 Apr 2013 14:21:51 +0100 Subject: [xquery-talk] Xquery and API documentation In-Reply-To: References: Message-ID: Hi Jakob, I also recently saw Swagger and was very impressed and was considering doing something with it at some point. The XQuery 3.0 annotations for defining a REST API are known as RESTXQ. If the platform you are using supports RESTXQ and introspection, then you could probably quite easily write a small XQuery script to find the annotated functions and create the JSON file for Swagger. If your on eXist you could probably even write the function as a RESTXQ function, making the api-doc a REST API function too :-) Another option would be if you have RESTXQ support but no introspection, to use rest:resource-functions() function to get the details of the annotated functions and then create JSON from that. Cheers Adam. On 24 April 2013 13:40, Jakob Fix wrote: > Hi, > > I'm looking for ways to generate API documentation from our Xquery code. Of > course, there is Xqdoc, but I'm looking to get something that is a) a bit > better-looking and more importantly, b) usable by the developer who wants to > try out the API. > > I've been looking at Swagger [1] which seems to do what I want. It expects a > JSON file that would need to be generated from the Xquery code. I think I > remember Adam Retter giving a talk on how to use 3.0 annotations for > defining the API in Prague a couple of years ago. > > Are there already efforts underway to get something like this going? > > I would be most interested, > Jakob. > > [1] https://developers.helloreverb.com/swagger/ > > > _______________________________________________ > talk at x-query.com > http://x-query.com/mailman/listinfo/talk -- Adam Retter skype: adam.retter tweet: adamretter http://www.adamretter.org.uk From dsewell at virginia.edu Tue Apr 30 20:01:01 2013 From: dsewell at virginia.edu (David Sewell) Date: Tue, 30 Apr 2013 23:01:01 -0400 (EDT) Subject: [xquery-talk] Fuctions and variables in replacement string of fn:replace() Message-ID: When using fn:replace(), is it kosher or illegal to construct the replacement string dynamically using a function? In some cases this seems to work (tested in Saxon and MarkLogic): xquery version "1.0"; let $string := "Now, let's SEND OUT for QUICHE!!" let $match := "[A-Z][A-Z]+" return replace($string, $match, concat("$0","$0")) ==> Now, let's SENDSEND OUTOUT for QUICHEQUICHE!! but in other cases it doesn't. For example, lower-case("$0") has no effect. And substring("$0", 1, 1) throws an error. DS -- David Sewell, Editorial and Technical Manager ROTUNDA, The University of Virginia Press PO Box 400314, Charlottesville, VA 22904-4314 USA Email: dsewell at virginia.edu Tel: +1 434 924 9973 Web: http://rotunda.upress.virginia.edu/ From liam at w3.org Tue Apr 30 20:14:27 2013 From: liam at w3.org (Liam R E Quin) Date: Tue, 30 Apr 2013 23:14:27 -0400 Subject: [xquery-talk] Fuctions and variables in replacement string of fn:replace() In-Reply-To: References: Message-ID: <1367378067.27683.19.camel@slave.barefootcomputing.com> On Tue, 2013-04-30 at 23:01 -0400, David Sewell wrote: > When using fn:replace(), is it kosher or illegal to construct the > replacement string dynamically using a function? In some cases this > seems to work (tested in Saxon and MarkLogic): > > xquery version "1.0"; > let $string := "Now, let's SEND OUT for QUICHE!!" > let $match := "[A-Z][A-Z]+" > return replace($string, $match, concat("$0","$0")) > ==> Now, let's SENDSEND OUTOUT for QUICHEQUICHE!! > > but in other cases it doesn't. For example, lower-case("$0") has no > effect. And substring("$0", 1, 1) throws an error. In your first example, return replace($string, $match, concat("$0","$0")) the replace function gets called with 3 arguments: replace( "Now, let's SEND OUT for QUICHE!!", "[A-Z][A-Z]+", "$0$0" ) Now, replace() treats $0 as whatever matched - it is not a variable reference, even though it looks like one. Th $ sign is special to replace(). However, lower-case("$0") will return "$0" since neither $ nor 0 is an upper case letter. substring("$0", 1, 1) ought to return a $ sign, and if you use that as an argument to replace(0 you'll get an error, because replace() wants dollar signs to be followed by digits. Hope that helps. Liam -- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml