BaseX 13
This article presents the highlights of BaseX 13 and summarizes the changes that may require adjustments when migrating existing projects from BaseX 12. All additions and updates are listed in the Changelog.
Highlights
XQuery
- XQuery 4.0 with XPath navigation on JSON, destructuring, records and around 80 new standard functions.
- Parallel evaluation and memoization (see XQuery Functions).
- A new HTTP Client, TAR, Zstandard and XZ archives, JSON Lines, and fuzzy string matching.
Storage
- All index structures, including the full-text index, are kept up to date after updates (
UPDINDEXis now enabled by default). - Fuzzy full-text queries are faster, integer comparisons are rewritten for index access, and thesauri can be indexed.
- Inputs larger than main memory are moved to disk.
db:inspectchecks storage structures for inconsistencies.
Editor
- The GUI renders much faster.
- Code completion, function signatures, go to declaration and code formatting.
- Project-wide search and replace with undo; files changed on disk are reloaded.
Web
- The DBA has been redesigned, and WebDAV is back as an XQuery application.
- RESTXQ applications can be deployed as ZIP archives.
- WebSockets support path templates and permission checks.
- BaseX runs in Jakarta EE 10 containers.
Security
- Authentication is salted, and passwords can be stored as PBKDF2 hashes (see User Management).
- Code can be untrusted, and external resources are only fetched if
TRUSTEXTERNALis enabled. - Permissions are also checked for opened databases and WebSocket handshakes.
- Outdated algorithms (MD5, DES) were removed.
Critical Changes
The following changes can prevent BaseX from starting or clients from connecting, change results without raising an error, or affect many existing applications. Most other changes raise errors that point to the required adjustment.
- Java: Java 21 or later is required (see Prerequisites).
- Configuration: Existing
.basexfiles are no longer rewritten, old values ofPARALLELandHTTPLOCALremain effective, and a.basexfile in an ancestor directory may now determine the home directory (see Configuration). - Server:
basexhttpno longer starts a database server on port 1984 (see Database Server). - Clients: Clients of BaseX 8 to 12 and third-party bindings without the salted handshake cannot connect, users with
digesthashes can no longer log in, and HTTP Digest authentication was removed (see Authentication). - Web application: A Jakarta EE 10 servlet container is required, and custom
web.xmlandjetty.xmlfiles must be checked. RESTXQ may dispatch requests to different functions, and WebSocket errors are only sent to clients by%ws:errorfunctions (see Web Server, RESTXQ and WebSockets). - Downgrades: Databases and values written by BaseX 13 may be rejected by BaseX 12 (see Compatibility).
- Full-text: Terms with characters such as
ßoræare only found after the index has been rebuilt (see Full-Text Index). - Whitespace:
STRIPWSpreserves whitespace in mixed content (see Options). - Options: Boolean options of standard functions must be booleans:
fn:serialize($data, { 'indent': 'no' })raises an error (see Standard Functions). - External resources: DTDs, entities, XInclude documents and schemas are only fetched if
TRUSTEXTERNALis enabled, and modules loaded withfn:load-xquery-moduleare untrusted (see Standard Functions). - Results:
ft:thesaurustraverses one level and omits the queried term,http:send-requestreturns lower-case header names and follows fewer redirects,fn:decode-from-uriandfn:parse-urikeep plus signs,file:deleteignores missing paths, quotes in unquoted CSV fields are kept, HTML is serialized as version 5.0, trace output is dropped for users without CREATE permission, and dates without timezone may shift by an hour (see Functions, Language and Serialization).
Prerequisites
BaseX 13 requires Java 21 or later (see Startup).
Configuration
The .basex configuration file is no longer rewritten when BaseX is started:
- Entries of an existing file take precedence over the defaults. To adopt the new defaults of
PARALLELandHTTPLOCAL, remove the entries, or delete the file to have a new one created. - Removed options (e.g.
FAIRLOCK,SPLITSIZE) are reported as unknown on every start until they are removed from the file. - Local options no longer need to be placed after the
Local Optionscomment. - The ancestors of the current user directory are also searched for a
.basexor.basexhomefile, which may result in a different home directory (see Configuration).
Databases
Compatibility
Databases created with BaseX 12 can be opened with BaseX 13, including their index structures. A database created or updated with BaseX 13 remains readable by BaseX 12 if…
- it has not been updated since it was created,
UPDINDEXis disabled (it is now enabled by default),- it was optimized with
OPTIMIZEordb:optimize, or - the text, attribute, token and full-text indexes are all disabled.
Otherwise, BaseX 12 rejects it. Small databases (up to 100,000 nodes) remain readable after updates (see Updates).
BaseX 12 cannot read a database at all if…
- Mixed content: the new
FTMIXEDoption is enabled and a full-text index exists. Drop the index, or disable the option and optimize the database. - Namespaces: its namespace structure has more than 4,096 entries. Such structures are stored in a compact format.
XQuery values are stored in a new format. Value resources (see db:put-value) and stores written by BaseX 12 can be read by BaseX 13, and they are converted to the new format when they are written next. Values written by BaseX 13 are rejected by BaseX 12.
Full-Text Index
The token normalization of the full-text index was standardized: characters that denote multiple letters are expanded (ß → ss, æ → ae, …), and missing and incorrect mappings were fixed. Full-text indexes created with older versions remain usable, but terms with affected characters are only found after the index has been rebuilt, e.g. with CREATE INDEX or OPTIMIZE ALL.
Options
UPDINDEX: Enabled by default: value indexes of new databases are kept up-to-date after updates. Disable it to keep updated databases readable by BaseX 12 (see Compatibility).STRIPWS: Only whitespace-only text nodes are discarded; whitespace in mixed content is preserved.PARALLEL: The default was raised to32.MIXUPDATESwas removed: usejob:executeto run updating and non-updating queries side by side.LSERRORwas removed: useusing fuzzy N errorsor theerrorsoption of the Full-Text Functions.FAIRLOCKandSPLITSIZEwere removed: non-fair locking is always used, and index structures are always split based on the available main memory.TAILCALLSwas removed: tail calls are always eliminated.ADDCACHEwas removed: large inputs are moved to disk automatically. Remove it from command scripts and database options.FORCECREATEwas removed: usedb:createto create databases.INTPARSE: Unresolvable entity references are replaced withU+FFFDinstead of?.db:system,db:info,INFO: Section names are no longer localized.TEXTINCLUDE,ATTRINCLUDE,TOKENINCLUDE,FTINCLUDE: Invalid name patterns were ignored before; now, index creation fails.
Server and Clients
Database Server
- With the new default of
HTTPLOCAL, the HTTP server no longer starts a Database Server instance. Startbasexhttpwith-L(see Command-Line Options) or disable the option if Clients need to connect on port 1984. - Servers are stopped via the network instead of a stop file, and only from the same host. Stop servers with the binaries of the same version.
Authentication
The login handshake of the Server Protocol has been changed from digest to salted authentication, and the unsalted digest (MD5) password algorithm was removed (see User Management):
- Clients of versions 8 to 12 can no longer connect. Third-party bindings must implement the salted handshake; the bindings in the BaseX repository have been updated.
- Clients of Version 13 cannot connect to older servers.
- HTTP Digest authentication was removed: the
Digestvalue ofAUTHMETHODis no longer supported, anddigestentries inAUTHALGORITHMSare ignored. UseBasicauthentication via HTTPS instead. Digest authentication of the HTTP Client is still supported. digesthashes inusers.xmlare ignored and dropped when the file is written next.- The client-side fallback to cram-md5 authentication, the outdated clients and the XML:DB API were removed.
- Permissions are also checked for databases that have already been opened.
- CREATE permission is required to access external resources, including modules imported with
at, stop-word and thesaurus files, serialization parameter documents, and paths or URLs passed toADD,PUT,BINARY PUTanddb:put-binary. RESTXQ modules are exempt.
Web Server
- BaseX is based on the Jetty EE10 environment. It can be deployed in any Jakarta EE 10 servlet container (Servlet 6.0 and WebSocket 2.1: Apache Tomcat 10.1, Jetty 12, WildFly 27 or later). Containers based on the
javax.servletAPI are not supported (see Servlet Container). - Static resources are served by a servlet of BaseX; the directory is specified via the
pathparameter. If you use a customweb.xmlfile, compare it with the one of the distribution. - The HTTP port is specified via
HTTPPORTor-h.jetty.xmlis no longer part of the distribution: an existing file inWEB-INFis still used, and-hoverrides its port. Remove it unless it contains custom settings. - WebDAV runs as a RESTXQ application. Locks are kept in main memory, and the
~webdavdatabase is not used anymore. - Permission errors of REST queries are answered with
403instead of400.
RESTXQ
- Server-side forwarding (the
rest:forwardelement andweb:forward) was dropped. Usejob:executeto combine multiple steps in a single request. - Functions with method annotations take precedence over functions without, and HEAD requests are dispatched to GET functions first. Automatic OPTIONS and HEAD responses follow RFC 9110.
- Requests that match no function are answered with a specific status code (e.g.
415if the content type is missing), and permission errors with403instead of500(see Response). - Request bodies of type
application/xqueryare converted to strings.
WebSockets
- The
%ws:header-paramannotation was removed: use the Request Functions instead, which can now be called in WebSocket handlers. - Without a
%ws:errorfunction, no error message is sent to the client. - The result of
ws:evalis sent as a single message, and errors are reported to the client.
Language
The implementation follows the latest drafts of XQuery 4.0. The following language features were changed or dropped:
- Record types: A record has a fixed set of fields. Optional fields (
field?) and the wildcard (*) were removed, field access is strict, and subtyping is width-invariant. - Record declarations: Declared record types are nominative. Declarations with identical fields define distinct types.
- Record constructors: Built-in record types (e.g.
fn:division-record,fn:parsed-csv-structure-record) have no constructor functions anymore. - Methods: The
%methodannotation was replaced by the=?>operator. - The map and array filter (e.g.
[ 1, 2, 3 ]?[. != 2]) was removed. - Node tests:
node()matches XML nodes and JNodes, andxnode()matches XML nodes only.gnode()was removed: usenode()instead, and replacenode()withxnode()where JNodes must be excluded. - Casting: Casting from strings follows XSD 1.1; casts to
xs:anyURInever fail. - The
nondeterministicprefix for dynamic function calls was removed: calls of functions that are statically unknown are treated as nondeterministic (see XQuery Extensions). - Dates and times without timezone are adjusted with the implicit timezone of the query, a fixed offset, instead of the daylight-saving-aware offset of the system zone. Results may shift by an hour, e.g. in
convert:dateTime-to-integeror SQL parameters. order by:NaNprecedes all numbers. Results only change withempty greatest.- Without ICU,
fn:collationreturns a UCA collation URI. - The BaseX-specific regular expression flags
j,!and;were removed.
Functions
Renamed and Removed
The following functions were renamed or removed:
| Description | BaseX 13 | BaseX 12 |
|---|---|---|
| Insert separator between items | fn:insert-separator |
fn:sequence-join, fn:intersperse |
| Parse CSV rows | fn:parse-csv?rows |
fn:csv-to-arrays |
| Return function identity | removed | fn:function-identity |
| Return subsequence between matching items | fn:drop-while, fn:take-while |
fn:subsequence-where |
| Return key-value pairs of a map | map:entries (singleton maps) |
map:pairs |
| Build map from key-value pairs | map:build |
map:of-pairs |
| Return keys of matching entries | map:keys, map:filter |
map:keys-where |
| Functions: Higher-order functions | removed | Higher-Order Functions Module |
| Return intermediate results of a fold | fn:scan (results wrapped in arrays) |
hof:scan-left |
| Fold non-empty sequence without seed | fn:fold-left |
hof:fold-left1 |
| Return greatest items | fn:sort-by, fn:sort-with |
hof:top-k-by, hof:top-k-with |
| Pad string | fn:pad-string |
string:format |
| Convert between strings and binary data | Binary Functions | convert:binary-to-string, convert:string-to-base64, convert:string-to-hex |
| Convert between durations and numbers | fn:seconds, fn:duration-to-seconds (seconds instead of milliseconds) |
convert:integer-to-dayTime, convert:dayTime-to-integer |
| Forward request | removed | web:forward |
Standard Functions
- Boolean options must be supplied as booleans. For example,
fn:serialize($data, { 'indent': 'no' })raises an error; use{ 'indent': false() }instead. fn:doc,fn:parse-xml,fn:parse-xml-fragment: Thestrip-spaceoption acceptsall,noneorconditionalinstead of a boolean. Theentity-expansion-limitandallow-external-entitiesoptions were removed.fn:doc,fn:doc-available,fn:parse-xml,fn:parse-xml-fragment: External DTDs and entities, XInclude documents and referenced schemas are only fetched if thetrust-externaloption orTRUSTEXTERNALis enabled.fn:load-xquery-module: Loaded modules are untrusted by default and cannot access external resources. Enable thetrustedoption to grant them the permissions of the calling code.fn:deep-equal: Thefalse-on-errorandnormalize-spaceoptions were removed.fn:replace: The captured groups are passed to replacement functions as a map instead of a sequence ($groups?1instead of$groups[1]). The old form is still supported if the parameter is declared asxs:untypedAtomic*.fn:decode-from-uri: Plus signs are no longer decoded as spaces.fn:parse-uri: Plus signs are only decoded as spaces in query parameters.array:join: The$separatorparameter was removed.array:members,array:of-members: JNodes are used instead of value records.
Data Formats
- CSV Functions:
field-delimiterwas renamed back toseparator, and quotes in unquoted fields are adopted as literal characters.row-delimiter,skip-empty,strict-quotingand thexqueryandw3-arraysformats (usew3) were removed. - JSON Functions:
number-parserwas replaced withnumber-format. Thexqueryandbasicformats (usew3andw3-xml) were removed. - HTML Functions: If no HTML parser is available, the input is wrapped in an
htmlelement. - Archive Functions: Duplicate entry names raise an error (before, the last entry was kept), and
archive:create-fromrejects multiple entries forgzip. Error codes are reported with thearchiveprefix (before:admin).
Databases and Full-Text
db:put-binary:$inputis restricted to binary items and strings, which are interpreted as URIs.db:put,db:put-binary,db:put-value,PUT,BINARY PUT: Only the resource at the specified path is replaced; resources below the path are kept. A binary and a value resource can no longer share a path. Storing a binary or value resource at the path of a directory raises an error.PUTand REST PUT requests with XML input replace binary resources with XML documents (before, the input was written into the binary resource).- Store Functions: All opened stores are kept in main memory, and a newly opened store no longer overwrites the default store.
ft:thesaurus, Thesaurus: By default, one level is traversed instead of all levels. Specify thelevelsoption or a level range (e.g.at most 10 levels) to traverse more levels. The queried term is no longer returned.ft:mark,ft:extract: The name of the marker element must be an NCName.
Files and Processes
file:read-text-lines: The$offsetand$lengthparameters were removed.file:delete: Non-existing paths are ignored.proc:system,proc:execute: Output that is invalid in the chosen encoding is rejected unless thefallbackoption is enabled. String input is encoded with the specifiedencodinginstead of UTF-8.proc:propertyand related functions require CREATE permission.
HTTP
http:send-request: Response header names are returned in lower case; binary response bodies of GET requests are returned as lazy items. Compressed responses are requested by default. Redirects to another origin are followed without credentials, and redirects fromhttpstohttpare not followed. ABaseXuser agent is sent by default. Bodies of typeapplication/xqueryare returned as strings. Error codes follow the EXPath specification:HC0003becameHC0004,HC0004becameHC0005, and timeouts raiseHC0006.web:response-header: Themessageattribute was removed.web:error:$err:valuecontains the message instead of the status code.
Jobs and Evaluation
job:execute: If the calling query holds locks, the job may only read databases read-locked by it; otherwise, ajob:deadlockerror is raised. Move the database access of the calling query to a separate job, or usejob:eval.job:eval: Services require anid, and thememory,timeoutandpermissionoptions are rejected for services.job:list-detailsreturns the full job string.xquery:eval: Thepermissionoption also applies to returned function items.- Repository: All functions and commands require ADMIN permission (before: CREATE).
REPO LISTreturns absolute paths.
Other Modules
crypto:encrypt,crypto:decrypt:DESwas removed.crypto:generate-signature: The defaults areSHA256andRSA_SHA256.- Cache Functions: By default, entries expire after 24 hours. Set
CACHETTLor thettloption ofcache:initto0to keep them indefinitely. string:ngrams,string:ngram-similarity: The n-gram length is supplied via thenoption.string:soundex: A string without letters yields an empty string.
Serialization
- The default of
html-versionchanged from4.0to5.0. - With
html-versionandversion, control characters that the requested version does not allow raise an error. - The custom parameters
indents,newlineandtabulatorare superseded by the standard parametersindent-unitandline-ending. - Adaptive method: Doubles and floats are output as JSON numbers (
1.0e0→1), and QNames as#prefix:local(before:#Q{uri}local). BaseX method: Floats are output as JSON numbers. - The output of
fn:traceandfn:messageis serialized with the BaseX method instead of the adaptive method ("A"→A), and it is dropped for users without CREATE permission.
Graphical User Interface
Only a single GUI instance is opened per project directory, and the fullscreen mode was removed (see Graphical User Interface).