Re: [basex-talk] HTTP response and raising error()

2015-08-13 Thread Marc van Grootel
Hi Christian and Dirk, >> Nothing major but I was wondering what the thinking was behind >> returning a 400 when fn:error is raised. Basically that says "client, >> your mistake not mine" where in most cases I guess a 500 would be more >> appropriate. > > The rationale behind this was that a REST

Re: [basex-talk] BaseX "subcollections"

2015-08-13 Thread Christian Grün
Hi Tim, There is no fixed collection layer in BaseX. However, a single database can contain millions of documents with arbitrary paths, and you can always specify target paths when adding or replacing documents. This also applies if you add more than one file at a time: OPEN db1 ADD TO /colls

Re: [basex-talk] HTTP response and raising error()

2015-08-13 Thread Christian Grün
Hi Marc, > Nothing major but I was wondering what the thinking was behind > returning a 400 when fn:error is raised. Basically that says "client, > your mistake not mine" where in most cases I guess a 500 would be more > appropriate. The rationale behind this was that a RESTXQ developer can use f

Re: [basex-talk] BaseX "subcollections"

2015-08-13 Thread Tim Thompson
Thanks, Dirk. Basically, I just want to create hierarchical collections within a database, with some subcollections being possible empty. But if I do CREATE DB parent, I'm not able to follow that with something like, CREATE DB parent/child. Is this possible by other means? (Sorry for the newbie que

Re: [basex-talk] HTTP response and raising error()

2015-08-13 Thread Dirk Kirsten
Hello Marc, you are correct. This is the advantage if you see the XQuery code Christian writes, you will discover all the undocumented magic things. But I added a little documentation at http://docs.basex.org/wiki/RESTXQ#XQuery_Errors, so you all know how you can return the mighty 418 status code

Re: [basex-talk] HTTP response and raising error()

2015-08-13 Thread Marc van Grootel
Ah, ok. Didn't know about the third argument. I didn't realize that an int as $error-object would be interpreted as returning that as status code. Is this documented? I mean how BaseX deals with the third argument? I couldn't find it. The spec leaves it open to implementations. --Marc On Thu, Aug

Re: [basex-talk] HTTP response and raising error()

2015-08-13 Thread Dirk Kirsten
Hi Marc, I agree, I think 500 would be more in line with the HTTP status code definitions.. It wasn't really an issue for us in our commercial projects ever (as we mostly send custom status code) and I guess this is why no one cared/noticed, but it would be cleaner to use 500 by default. By the wa

[basex-talk] HTTP response and raising error()

2015-08-13 Thread Marc van Grootel
Hi, Nothing major but I was wondering what the thinking was behind returning a 400 when fn:error is raised. Basically that says "client, your mistake not mine" where in most cases I guess a 500 would be more appropriate. Where is this decided (RESTXQ?) and is there an easy way to change the statu

Re: [basex-talk] BaseX "subcollections"

2015-08-13 Thread Dirk Kirsten
Hello Tim, I am not sure I understand your question completely. Basically every way how you can add a document to a database you can specify a path, e.g. using the XQuery database module or by using the CREATE document to create a new database and initialize it. Is there anything specific you are