Changes

Jump to navigation Jump to search
50 bytes removed ,  17:26, 27 March 2015
no edit summary
that are already supported by BaseX.
==Maps==
A ''map'' is a function that associates a set of keys with values, resulting in a collection of key/value pairs. Each key/value pair in a map is called an entry. A key is an arbitrary atomic value, and the associated value is an arbitrary sequence. Within a map, no two entries have the same key, when compared using the {{Code|eq}} operator. It is not necessary that all the keys should be mutually comparable (for example, they can include a mixture of integers and strings).
Maps may be compared using the {{Code|fn:deep-equal}} function. The [[Map Module]] describes the available set of map functions.
==Arrays==
{{Version|8.1}}: Arrays are now based on an efficient [http://en.wikipedia.org/wiki/Finger_tree Finger Tree] implementation.
Like all other values, arrays are immutable. For example, the <code>[[Array Module#array:reverse|array:reverse]]</code> function creates a new array containing a re-ordering of the members of an existing array, but the existing array is not changed by the operation. Like sequences, arrays have no identity. It is meaningful to compare the contents of two arrays, but there is no way of asking whether they are "the same array": two arrays with the same content are indistinguishable.
===Atomization===
If an array is ''atomized'', all of its members will be atomized. As a result, an atomized item may now result in more than one item. Some examples:
Arrays can be compared with the {{Code|fn:deep-equal}} function. The [[Array Module]] describes the available set of array functions.
==Lookup Operator==
The lookup operator provides some syntactic sugar to access values of maps or array members at a specified position. It is introduced by the question mark ({{Code|?}}) and followed by a specifier. The specifier can be:
</pre>
==Arrow Operator==
The arrow operator applies a function to a value. The value is used as the first argument to the function. It is introduced with the characters <code>=></code>, and it is followed by the function to be called. If <code>$v</code> is a value and <code>f()</code> is a function, then <code>$v=>f()</code> is equivalent to <code>f($v)</code>, and <code>$v=>f($j)</code> is equivalent to <code>f($v, $j)</code>. This is further illustrated by an example:
The syntax makes nested function calls more readable, as it is easy to see if parentheses are balanced.
==Serialization==
Two [[Serialization]] methods have been added to the [http://www.w3.org/TR/xslt-xquery-serialization-31 Serialization spec]:
===Adaptive Serialization===
In BaseX, {{Code|adaptive}} is used as the new default serialization method. It provides a textual representation for all XDM types, including maps and arrays, functions, attributes, and namespaces. All items will be separated using the value of the {{Code|item-separator}} parameter, or a newline if no value is specified:
</pre>
===JSON Serialization===
The new {{Code|json}} serialization output method can be used to serialize XQuery maps, arrays, atomic values and empty sequences as JSON.
</pre>
==Functions==
The following functions of the [http://www.w3.org/TR/xpath-functions-31/ XQuery 3.1 Functions and Operators] Working Draft have been added. Please be aware that the functions are still subject to change:
===Map Functions===
The following map functions are now available:
Please check out the [[Map Module]] for more details.
===Array Functions===
The following array functions are now available:
Please check out the [[Array Module]] for more details.
===JSON Functions===
XQuery now provides native support for JSON objects. Strings and resources can be parsed to XQuery items and, as [[#JSON Serialization|shown above]], serialized back to their original form.
====fn:parse-json====
; Signatures
</pre>
====fn:json-docs====
; Signatures
</pre>
===fn:sort===
; Signatures
</pre>
===fn:contains-token===
; Signatures
</pre>
===fn:parse-ietf-date===
; Signature
</pre>
===fn:apply===
; Signatures
</pre>
===fn:random-number-generator===
; Signatures
</pre>
===fn:format-number===
The function has been extended to support scientific notation:
</pre>
===fn:tokenize===
If no separator is specified as second argument, a string will be tokenized at whitespace boundaries:
</pre>
===fn:trace===
The second argument can now be omitted:
</pre>
==Binary Data==
Items of type <code>xs:hexBinary</code> and <code>xs:base64Binary</code> can now be compared against each other. The following queries all yield {{Code|true}}:
</pre>
==Collations==
XQuery 3.1 provides a new default collation, which allows for a case-insensitive comparison of ASCII characters (<code>A-Z</code> = <code>a-z</code>). This query returns <code>true</code>:
</pre>
==Pending Features==
The following functions have not been implemented yet:
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu