[basex-talk] Proposal for programmatically setting index options
Hi, The index settings for a database can make a huge difference to query performance. I have been playing with a database where the time for a query using distinct-values went from 4secs to 4ms by increasing the MAXCATS value. Currently it is rather fiddly to change these values, particularly to this programmatically. with different values per database. I would find it useful there was an easier way to do this. A quick suggestion as to how this might be done: db:optimize could be extended to taker a third argument that matched the format of in indexes portion of the db:info command indexes uptodatetrue/uptodate textindexON/textindex attributeindexON/attributeindex fulltextindexOFF/fulltextindex updindexOFF/updindex maxcats100/maxcats maxlen96/maxlen /indexes e.g db:optimize(mydb,fn:true(),$indexopts) This would rebuild mydb using the settings specified in $indexopts. The extra argument could also be added to db:create. /Andy ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
[basex-talk] Question regarding BaseX support for id and idref
Hello BaseX-Talk, I am new to the boards and BaseX in general. I have been looking for a open source NoSQL database with expressive query abilities and I think BaseX fits the bill. Its been an exciting journey as I am new to the whole X platform aside from the angle brackets... As I think many are. I am currently exploring the capabilities of RestXQ and the xml stack. I especially like its potential coupled with knockout.js, and a truly flexible RESTful metadata/hypermedia driven api. I have implemented an api of this nature in .Net however the metadata and querying capabilities are hindered and unnecessarily complex where I feel xml and XQuery make this dynamic orchestration quite gracefully. Unfortunately I am stuck now that I am exploring referential relationships and xml. I am trying to understand the support BaseX and XML in general has for referential nodes especially when dealing with queries. For example I know the xml standard defines id and idref however I have not been able to find any documentation on these in BaseX or XML in general. For example does BaseX handle idiosyncrasies of id and idref or must I handle these in my queries? For example: let $context := item id=10 child idref=2 /itemitem id=20 child idref=2 / child idref=1 //itemitem id=30 / child id=1 name=firstChild /child id=2 name=secondChild / for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return $itemWithFirstChild/@id I would like this to return 10 20Now this example uses a dynamic context node however in the application these would exist as nodes in the database... If it does fully support this how do I enable it or get it to work? Also what about XLink? Any help would be greatly appreciated. Thanks again for your time.- James ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] Question regarding BaseX support for id and idref
On Mon, 2013-05-13 at 19:15 -0600, James Wright wrote: [...] I know the xml standard defines id and idref however I have not been able to find any documentation on these in BaseX or XML in general. For example does BaseX handle idiosyncrasies of id and idref or must I handle these in my queries? For example: let $context := item id=10 Note that an XML ID must be an identifier, so must start with a name start character (a letter)... let $context := item id=10 child idref=2 /itemitem id=20 child idref=2 / child idref=1 //itemitem id=30 / child id=1 name=firstChild /child id=2 name=secondChild / for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return $itemWithFirstChild/@id I think this got garbled somewhere - e.g. there aren't enough end tags. Make sure you turn off HTML formatting in your email program. I would like this to return 10 20Now this example uses a dynamic context node however in the application these would exist as nodes in the database... If it does fully support this how do I enable it or get it to work? One way to get started with BaseX would be to use the basexgui program in the bin directory to create a database (there's also a command-line program to do it; I use the Perl and PHP APIs too on www.fromoldbooks.org). People usually do joins by value in XML and XQuery; ID/IDREF only work with older DTD technology, or with xml:id; I don't know if BaseX has support for them. But if it does the values must be IDs :) So you're on the right lines. Also what about XLink? It's not used very much. As a standard it solved the wrong problems, unfortunately. Easy for me to say in hindsight. The XQuery Use Cases on www.w3.org/TR may be helpful; there's also a chapter on XQuery using BaseX for examples in a book I co-authored last year, Beginning XML 5th edition. 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 ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Re: [basex-talk] Question regarding BaseX support for id and idref
Liam, I think that answers my question and is what I expected. So basically BaseX and maybe XQuery as a whole does not respect or understand the id/idref concept formally and thus will not automatically join. This isn't a 'problem' so much as an attempt to insure I do not reproduce what already exists. Does this sound correct? For example if I had a node named item with 2 child nodes simply referencing another childitem node by ID but not inline. with item as the context node. If I wrote: childitem I would expect the nodes being referenced not the inline nodes with the references on them. But this is not how it works.. Right? I need to handle the relationship explicitly. - James Subject: Re: [basex-talk] Question regarding BaseX support for id and idref From: l...@w3.org To: james...@hotmail.com CC: basex-talk@mailman.uni-konstanz.de Date: Mon, 13 May 2013 21:36:34 -0400 On Mon, 2013-05-13 at 19:15 -0600, James Wright wrote: [...] I know the xml standard defines id and idref however I have not been able to find any documentation on these in BaseX or XML in general. For example does BaseX handle idiosyncrasies of id and idref or must I handle these in my queries? For example: let $context := item id=10 Note that an XML ID must be an identifier, so must start with a name start character (a letter)... let $context := item id=10 child idref=2 /itemitem id=20 child idref=2 / child idref=1 //itemitem id=30 / child id=1 name=firstChild /child id=2 name=secondChild / for $itemWithFirstChild in $context/item[child/@name = 'firstChild']return $itemWithFirstChild/@id I think this got garbled somewhere - e.g. there aren't enough end tags. Make sure you turn off HTML formatting in your email program. I would like this to return 10 20Now this example uses a dynamic context node however in the application these would exist as nodes in the database... If it does fully support this how do I enable it or get it to work? One way to get started with BaseX would be to use the basexgui program in the bin directory to create a database (there's also a command-line program to do it; I use the Perl and PHP APIs too on www.fromoldbooks.org). People usually do joins by value in XML and XQuery; ID/IDREF only work with older DTD technology, or with xml:id; I don't know if BaseX has support for them. But if it does the values must be IDs :) So you're on the right lines. Also what about XLink? It's not used very much. As a standard it solved the wrong problems, unfortunately. Easy for me to say in hindsight. The XQuery Use Cases on www.w3.org/TR may be helpful; there's also a chapter on XQuery using BaseX for examples in a book I co-authored last year, Beginning XML 5th edition. 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 ___ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk