[basex-talk] Embedding BaseX in Clojure web app, pointers needed
Hi, I'm considering to write a web layer for BaseX based in Clojure. It may be a somewhat longer term project but I would like to bring XML and BaseX closer to Clojure programming. Clojure web apps usually are able to run under various servers/containers (Jetty/Netty etc.) and I would like to be able to use Clojure libraries to handle things like request routing, security and authentication outside of BaseX/XQuery. Some questions that I have while I'm orienting myself. Some of it touches on integration areas that are quite new to me so I am happy to get some general pointers that I can use to dig further. For Clojure I found only one BaseX client library [1] which wraps the standard Java TCP client and it seems to work fine. But I have some broader questions such as - Choosing between using the client or much more intimately embedding BaseX as a library. The latter is probably much more complex but I'm figuring this is the only way to get a good integration as the TCP client is rather limited in functionality. But where to start? What layers of the existing servlet integration to peel off, which ones to keep. Is BaseXServer.java a good starting point? - Is the TCP client generally slower than via the Java API? A couple of queries via clj-basex didn't impress me much qua speed (compared to same query via the GUI). Any starting points or general considerations that could help me prune the (re)search tree are very much appreciated. --Marc [1] https://github.com/kouphax/clj-basex
Re: [basex-talk] xquery:eval bug?
Hi Marc, hi Andy, Confirmed, it seems to be the MIXUPDATES option. Once again, I noticed it’s tricky to statically detect which dynamic function calls will perform updates. Obviously, in the given case, there was no updating code at all, so the error message was a bit misleading. Feedback on the MIXUPDATES option is always welcome. I have just uploaded a new snapshot [1]. Christian [1] http://files.basex.org/releases/latest/ On Mon, Jan 18, 2016 at 12:58 PM, Marc van Grootel wrote: > Hi Christian, > > Yes, I think so. I think MIXUPDATES=true could be the difference. I almost > forgot about these as I always run basex from a Gradle script which sets > these [1] > > [1] > https://github.com/theapsgroup/basex-gradle-starter/blob/master/gradle.properties > > -Original Message- > From: basex-talk-boun...@mailman.uni-konstanz.de > [mailto:basex-talk-boun...@mailman.uni-konstanz.de] On Behalf Of Christian > Grün > Sent: Monday, January 18, 2016 11:32 AM > To: Marc van Grootel > Cc: BaseX > Subject: Re: [basex-talk] xquery:eval bug? > > Hi Marc, > > It runs fine on my environment. Could you give me some more information on > your set up (have you assigned any non-default options)? > > Christian > > > On Mon, Jan 18, 2016 at 10:07 AM, Marc van Grootel > wrote: >> Hi Christian, >> >> Seems to work fine with latest snapshot with some straightforward >> cases but I do get an error in some cases which I cannot understand. >> Though I appreciate that it may be difficult to support all types of >> dynamic calls. >> >> The error is: [bxerr:BXXQ0001] No updating expression allowed. >> >> I am not using updating expressions. I also tried this in my little >> test project and it runs against the same error. I haven't been able >> to pinpoint it yet as it happens deep in the bowels of the code. When >> I'm able to I will let you know. >> >> You can use a simple/small set of unit tests to verify [1]. I've >> %unit:ignored the last test that causes the error above. >> >> Cheers, >> --Marc >> >> [1] >> https://github.com/xokomola/origami-examples/blob/master/check/test-ev >> al.xqm >> >> On Fri, Jan 15, 2016 at 6:57 PM, Christian Grün >> wrote: >>> Hi Marc, >>> >>> This was a deliberate restriction: As maps and arrays are function >>> items, and as they can contain references to other functions that >>> have been declared in the evaluated query, it is generally tricky to >>> evaluate and return them dynamically. >>> >>> However, I spent some more thoughts on the underlying semantics, and >>> I may have found a solution that overcomes some of the earlier >>> limitations. >>> >>> A new snapshot is available [1], which now allows you to return >>> function items (incl. maps and arrays) as result of xquery:eval. Your >>> testing feedback will be welcome. >>> >>> Christian >>> >>> [1] http://files.basex.org/releases/latest/ >>> >>> >>> >>> On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel >>> wrote: Hi, I'm trying to return a map or an array from xquery:eval. Seems this is not possible, yet the signature says it returns item()* xquery:eval('1 + 1') => 2 xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*) have no string representation. xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of type map(*) have no string representation. BTW: I saw that xquery:eval#3 is documented as returning item() while the other arities return item()* Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro I figure. -- --Marc >> >> >> >> -- >> --Marc > > __ > This email has been scanned by the Symantec Email Security.cloud service. > For more information please visit http://www.symanteccloud.com > __ > '** > This E-mail and any files transmitted with it are private and confidential > and are solely for the use of the addressee. It may contain material which > is legally privileged. If you are not the addressee, be advised that you > have received this E-mail in error and that any use of it is strictly > prohibited. > > If you have received this E-mail in error, please notify APS on +44 (0)161 > 495 4500, or E-mail administra...@theapsgroup.com. > Any opinions expressed in the E-mail are those of the individual writer of it > and not necessarily the Company unless specifically stated otherwise. There > is no intention to create any legally binding contract or other commitment > through use of this E-mail > > We cannot accept any liability for any loss or damage sustained as a result > of software viruses. It is your responsibility to carry out such virus > checking as is necessary before downloading this E-mail and any attachments > onto
Re: [basex-talk] xquery:eval bug?
Hi Christian, Yes, I think so. I think MIXUPDATES=true could be the difference. I almost forgot about these as I always run basex from a Gradle script which sets these [1] [1] https://github.com/theapsgroup/basex-gradle-starter/blob/master/gradle.properties -Original Message- From: basex-talk-boun...@mailman.uni-konstanz.de [mailto:basex-talk-boun...@mailman.uni-konstanz.de] On Behalf Of Christian Grün Sent: Monday, January 18, 2016 11:32 AM To: Marc van Grootel Cc: BaseX Subject: Re: [basex-talk] xquery:eval bug? Hi Marc, It runs fine on my environment. Could you give me some more information on your set up (have you assigned any non-default options)? Christian On Mon, Jan 18, 2016 at 10:07 AM, Marc van Grootel wrote: > Hi Christian, > > Seems to work fine with latest snapshot with some straightforward > cases but I do get an error in some cases which I cannot understand. > Though I appreciate that it may be difficult to support all types of > dynamic calls. > > The error is: [bxerr:BXXQ0001] No updating expression allowed. > > I am not using updating expressions. I also tried this in my little > test project and it runs against the same error. I haven't been able > to pinpoint it yet as it happens deep in the bowels of the code. When > I'm able to I will let you know. > > You can use a simple/small set of unit tests to verify [1]. I've > %unit:ignored the last test that causes the error above. > > Cheers, > --Marc > > [1] > https://github.com/xokomola/origami-examples/blob/master/check/test-ev > al.xqm > > On Fri, Jan 15, 2016 at 6:57 PM, Christian Grün > wrote: >> Hi Marc, >> >> This was a deliberate restriction: As maps and arrays are function >> items, and as they can contain references to other functions that >> have been declared in the evaluated query, it is generally tricky to >> evaluate and return them dynamically. >> >> However, I spent some more thoughts on the underlying semantics, and >> I may have found a solution that overcomes some of the earlier >> limitations. >> >> A new snapshot is available [1], which now allows you to return >> function items (incl. maps and arrays) as result of xquery:eval. Your >> testing feedback will be welcome. >> >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel >> wrote: >>> Hi, >>> >>> I'm trying to return a map or an array from xquery:eval. Seems this >>> is not possible, yet the signature says it returns item()* >>> >>> xquery:eval('1 + 1') => 2 >>> xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*) >>> have no string representation. >>> xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of >>> type >>> map(*) have no string representation. >>> >>> BTW: I saw that xquery:eval#3 is documented as returning item() >>> while the other arities return item()* >>> >>> Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro I >>> figure. >>> >>> -- >>> --Marc > > > > -- > --Marc __ This email has been scanned by the Symantec Email Security.cloud service. For more information please visit http://www.symanteccloud.com __ '** This E-mail and any files transmitted with it are private and confidential and are solely for the use of the addressee. It may contain material which is legally privileged. If you are not the addressee, be advised that you have received this E-mail in error and that any use of it is strictly prohibited. If you have received this E-mail in error, please notify APS on +44 (0)161 495 4500, or E-mail administra...@theapsgroup.com. Any opinions expressed in the E-mail are those of the individual writer of it and not necessarily the Company unless specifically stated otherwise. There is no intention to create any legally binding contract or other commitment through use of this E-mail We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before downloading this E-mail and any attachments onto your computer system. Allied Publicity Services (Manchester) Ltd Registered Office: Allied Publicity Services (Manchester) Ltd, Chetham House, Bird Hall Lane, Cheadle Heath, Cheshire, SK3 0ZP Company Registration No: 681528 England APS Group Secure Solutions Limited. Registered Office: Chetham House, Bird Hall Lane, Stockport, Cheshire, SK3 0ZP Company Registration No: 07007434 England APS Group (Scotland) Ltd. Registered Office: APS Group (Scotland) Ltd, 21. Tennant Street, Edinburgh, EH6 5NA Company Registration No: SC369510 Scotland '** This E-mail a
Re: [basex-talk] xquery:eval bug?
Works for me if MIXUPDATES is not true. I have found previously that MIXUPDATES has a lot consequences that are not always desirable or predictable - at least for me. /Andy On 18 January 2016 at 10:31, Christian Grün wrote: > Hi Marc, > > It runs fine on my environment. Could you give me some more > information on your set up (have you assigned any non-default > options)? > > Christian > > > On Mon, Jan 18, 2016 at 10:07 AM, Marc van Grootel > wrote: > > Hi Christian, > > > > Seems to work fine with latest snapshot with some straightforward > > cases but I do get an error in some cases which I cannot understand. > > Though I appreciate that it may be difficult to support all types of > > dynamic calls. > > > > The error is: [bxerr:BXXQ0001] No updating expression allowed. > > > > I am not using updating expressions. I also tried this in my little > > test project and it runs against the same error. I haven't been able > > to pinpoint it yet as it happens deep in the bowels of the code. When > > I'm able to I will let you know. > > > > You can use a simple/small set of unit tests to verify [1]. I've > > %unit:ignored the last test that causes the error above. > > > > Cheers, > > --Marc > > > > [1] > https://github.com/xokomola/origami-examples/blob/master/check/test-eval.xqm > > > > On Fri, Jan 15, 2016 at 6:57 PM, Christian Grün > > wrote: > >> Hi Marc, > >> > >> This was a deliberate restriction: As maps and arrays are function > >> items, and as they can contain references to other functions that have > >> been declared in the evaluated query, it is generally tricky to > >> evaluate and return them dynamically. > >> > >> However, I spent some more thoughts on the underlying semantics, and I > >> may have found a solution that overcomes some of the earlier > >> limitations. > >> > >> A new snapshot is available [1], which now allows you to return > >> function items (incl. maps and arrays) as result of xquery:eval. Your > >> testing feedback will be welcome. > >> > >> Christian > >> > >> [1] http://files.basex.org/releases/latest/ > >> > >> > >> > >> On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel > >> wrote: > >>> Hi, > >>> > >>> I'm trying to return a map or an array from xquery:eval. Seems this is > >>> not possible, yet the signature says it returns item()* > >>> > >>> xquery:eval('1 + 1') => 2 > >>> xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*) > >>> have no string representation. > >>> xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of type > >>> map(*) have no string representation. > >>> > >>> BTW: I saw that xquery:eval#3 is documented as returning item() while > >>> the other arities return item()* > >>> > >>> Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro > I figure. > >>> > >>> -- > >>> --Marc > > > > > > > > -- > > --Marc >
Re: [basex-talk] xquery:eval bug?
Hi Marc, It runs fine on my environment. Could you give me some more information on your set up (have you assigned any non-default options)? Christian On Mon, Jan 18, 2016 at 10:07 AM, Marc van Grootel wrote: > Hi Christian, > > Seems to work fine with latest snapshot with some straightforward > cases but I do get an error in some cases which I cannot understand. > Though I appreciate that it may be difficult to support all types of > dynamic calls. > > The error is: [bxerr:BXXQ0001] No updating expression allowed. > > I am not using updating expressions. I also tried this in my little > test project and it runs against the same error. I haven't been able > to pinpoint it yet as it happens deep in the bowels of the code. When > I'm able to I will let you know. > > You can use a simple/small set of unit tests to verify [1]. I've > %unit:ignored the last test that causes the error above. > > Cheers, > --Marc > > [1] > https://github.com/xokomola/origami-examples/blob/master/check/test-eval.xqm > > On Fri, Jan 15, 2016 at 6:57 PM, Christian Grün > wrote: >> Hi Marc, >> >> This was a deliberate restriction: As maps and arrays are function >> items, and as they can contain references to other functions that have >> been declared in the evaluated query, it is generally tricky to >> evaluate and return them dynamically. >> >> However, I spent some more thoughts on the underlying semantics, and I >> may have found a solution that overcomes some of the earlier >> limitations. >> >> A new snapshot is available [1], which now allows you to return >> function items (incl. maps and arrays) as result of xquery:eval. Your >> testing feedback will be welcome. >> >> Christian >> >> [1] http://files.basex.org/releases/latest/ >> >> >> >> On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel >> wrote: >>> Hi, >>> >>> I'm trying to return a map or an array from xquery:eval. Seems this is >>> not possible, yet the signature says it returns item()* >>> >>> xquery:eval('1 + 1') => 2 >>> xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*) >>> have no string representation. >>> xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of type >>> map(*) have no string representation. >>> >>> BTW: I saw that xquery:eval#3 is documented as returning item() while >>> the other arities return item()* >>> >>> Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro I >>> figure. >>> >>> -- >>> --Marc > > > > -- > --Marc
Re: [basex-talk] xquery:eval bug?
Hi Christian, Seems to work fine with latest snapshot with some straightforward cases but I do get an error in some cases which I cannot understand. Though I appreciate that it may be difficult to support all types of dynamic calls. The error is: [bxerr:BXXQ0001] No updating expression allowed. I am not using updating expressions. I also tried this in my little test project and it runs against the same error. I haven't been able to pinpoint it yet as it happens deep in the bowels of the code. When I'm able to I will let you know. You can use a simple/small set of unit tests to verify [1]. I've %unit:ignored the last test that causes the error above. Cheers, --Marc [1] https://github.com/xokomola/origami-examples/blob/master/check/test-eval.xqm On Fri, Jan 15, 2016 at 6:57 PM, Christian Grün wrote: > Hi Marc, > > This was a deliberate restriction: As maps and arrays are function > items, and as they can contain references to other functions that have > been declared in the evaluated query, it is generally tricky to > evaluate and return them dynamically. > > However, I spent some more thoughts on the underlying semantics, and I > may have found a solution that overcomes some of the earlier > limitations. > > A new snapshot is available [1], which now allows you to return > function items (incl. maps and arrays) as result of xquery:eval. Your > testing feedback will be welcome. > > Christian > > [1] http://files.basex.org/releases/latest/ > > > > On Thu, Jan 14, 2016 at 11:17 PM, Marc van Grootel > wrote: >> Hi, >> >> I'm trying to return a map or an array from xquery:eval. Seems this is >> not possible, yet the signature says it returns item()* >> >> xquery:eval('1 + 1') => 2 >> xquery:eval('[1,2]') => ERROR: [FOTY0014] Items of type array(*) >> have no string representation. >> xquery:eval('map { "x": 10 }') => ERROR: [FOTY0014] Items of type >> map(*) have no string representation. >> >> BTW: I saw that xquery:eval#3 is documented as returning item() while >> the other arities return item()* >> >> Tested on 8.3, haven't tested yet on 8.4beta but it's trivial to repro I >> figure. >> >> -- >> --Marc -- --Marc