Changes

Jump to navigation Jump to search
96 bytes removed ,  18:35, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
…or add context parameters in the {{Code|web.xml}} file of your [[Web Application]]:
<syntaxhighlight pre lang="'xquery"'>
<context-param>
<param-name>org.basex.stripws</param-name>
Note that {{Option|STRIPWS}} only applies to stored XML and not to XML constructed within XQuery source files. Within XQuery code, the standard {{Code|boundary-space}} setting applies. This defaults to {{Code|strip}}. To preserve XML whitespace in XQuery modules, add the following to the prolog:
<syntaxhighlight pre lang="'xquery"'>
declare boundary-space preserve;
<xml> </xml>
The new feature can e.g. be used to store maps in a database:
<syntaxhighlight pre lang="'xquery"'>
db:put-value(
'factbook',
…and use them as index later on:
<syntaxhighlight pre lang="'xquery"'>
let $cities := db:get-value('factbook', 'cities')
for $country in ('Japan', 'Indonesia', 'Malaysia')
Lock detection will be performed after the first step, and the code resulting from this step offers much more insight into which specific databases need to be locked. As a result, local locks can be applied to many more queries than before, and many queries can now run in parallel. An example:
<syntaxhighlight pre lang="'xquery"'>
declare variable $n external;
db:get('names-' || $n)
XQuery Update provides constructs to [[XQuery Update#Main-Memory Updates|update XML nodes in main memory]]. The data structures for in-memory representations of XML resources have been revised, such that updates can be performed orders of magnitudes faster than before. With BaseX 9.x, the following query runs for several minutes, whereas it can now be computed in a few seconds:
<syntaxhighlight pre lang="'xquery"'>
<xml>{
(1 to 1000000) ! <child/>
; Store data:
<syntaxhighlight pre lang="'xquery"'>
let $email := map:merge(
for $address in db:get('addressbook')//address
; Retrieve data:
<syntaxhighlight pre lang="'xquery"'>
let $name := 'Richard David James'
return store:get('email')($name)
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu